mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-26 17:42:35 +01:00
57bad703ee
- Adds `--initial-show-state=hidden` support for cefclient and cefsimple where the window launches as initially hidden (no dock thumbnail). - Adds `--hide-window-on-close` support for cefclient where clicking the red traffic light button hides the window instead of closing it.
33 lines
995 B
Plaintext
33 lines
995 B
Plaintext
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
// can be found in the LICENSE file.
|
|
|
|
#include "tests/cefsimple/simple_handler.h"
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#include "include/cef_browser.h"
|
|
|
|
namespace {
|
|
|
|
NSWindow* GetNSWindowForBrowser(CefRefPtr<CefBrowser> browser) {
|
|
NSView* view =
|
|
CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(browser->GetHost()->GetWindowHandle());
|
|
return [view window];
|
|
}
|
|
|
|
} // namespace
|
|
|
|
void SimpleHandler::PlatformTitleChange(CefRefPtr<CefBrowser> browser,
|
|
const CefString& title) {
|
|
NSWindow* window = GetNSWindowForBrowser(browser);
|
|
std::string titleStr(title);
|
|
NSString* str = [NSString stringWithUTF8String:titleStr.c_str()];
|
|
[window setTitle:str];
|
|
}
|
|
|
|
void SimpleHandler::PlatformShowWindow(CefRefPtr<CefBrowser> browser) {
|
|
NSWindow* window = GetNSWindowForBrowser(browser);
|
|
[window makeKeyAndOrderFront:window];
|
|
}
|