- Add support for popup windows.
- Fix select list bugs.
- Add additional tests to cefclient.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@182 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-02-02 02:25:32 +00:00
parent 5911e7027c
commit 02bd128046
8 changed files with 147 additions and 39 deletions

View File

@@ -47,7 +47,11 @@ public:
const CefPopupFeatures& popupFeatures,
CefRefPtr<CefHandler>& handler,
CefString& url,
CefBrowserSettings& settings);
CefBrowserSettings& settings)
{
REQUIRE_UI_THREAD();
return RV_CONTINUE;
}
// Called on the UI thread after a new window is created. The return value is
// currently ignored.

View File

@@ -164,6 +164,14 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
- (IBAction)testJSExecute:(id)sender;
- (IBAction)testRequest:(id)sender;
- (IBAction)testSchemeHandler:(id)sender;
- (IBAction)testPopupWindow:(id)sender;
- (IBAction)testAccelerated2DCanvas:(id)sender;
- (IBAction)testAcceleratedLayers:(id)sender;
- (IBAction)testWebGL:(id)sender;
- (IBAction)testHTML5Video:(id)sender;
- (IBAction)testZoomIn:(id)sender;
- (IBAction)testZoomOut:(id)sender;
- (IBAction)testZoomReset:(id)sender;
@end
@implementation ClientAppDelegate
@@ -203,6 +211,30 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
[testMenu addItemWithTitle:@"Scheme Handler"
action:@selector(testSchemeHandler:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"Popup Window"
action:@selector(testPopupWindow:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"Accelerated 2D Canvas"
action:@selector(testAccelerated2DCanvas:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"Acceledated Layers"
action:@selector(testAcceleratedLayers:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"WebGL"
action:@selector(testWebGL:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"HTML5 Video"
action:@selector(testHTML5Video:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"Zoom In"
action:@selector(testZoomIn:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"Zoom Out"
action:@selector(testZoomOut:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"Zoom Reset"
action:@selector(testZoomReset:)
keyEquivalent:@""];
[testItem setSubmenu:testMenu];
[menubar addItem:testItem];
@@ -325,6 +357,52 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
RunSchemeTest(g_handler->GetBrowser());
}
- (IBAction)testPopupWindow:(id)sender {
if(g_handler.get() && g_handler->GetBrowserHwnd())
RunPopupTest(g_handler->GetBrowser());
}
- (IBAction)testAccelerated2DCanvas:(id)sender {
if(g_handler.get() && g_handler->GetBrowserHwnd())
RunAccelerated2DCanvasTest(g_handler->GetBrowser());
}
- (IBAction)testAcceleratedLayers:(id)sender {
if(g_handler.get() && g_handler->GetBrowserHwnd())
RunAcceleratedLayersTest(g_handler->GetBrowser());
}
- (IBAction)testWebGL:(id)sender {
if(g_handler.get() && g_handler->GetBrowserHwnd())
RunWebGLTest(g_handler->GetBrowser());
}
- (IBAction)testHTML5Video:(id)sender {
if(g_handler.get() && g_handler->GetBrowserHwnd())
RunHTML5VideoTest(g_handler->GetBrowser());
}
- (IBAction)testZoomIn:(id)sender {
if(g_handler.get() && g_handler->GetBrowserHwnd()) {
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
browser->SetZoomLevel(browser->GetZoomLevel() + 0.5);
}
}
- (IBAction)testZoomOut:(id)sender {
if(g_handler.get() && g_handler->GetBrowserHwnd()) {
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
browser->SetZoomLevel(browser->GetZoomLevel() - 0.5);
}
}
- (IBAction)testZoomReset:(id)sender {
if(g_handler.get() && g_handler->GetBrowserHwnd()) {
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
browser->SetZoomLevel(0.0);
}
}
// Sent by the default notification center immediately before the application
// terminates.
- (void)applicationWillTerminate:(NSNotification *)aNotification {
@@ -367,15 +445,6 @@ int main(int argc, char* argv[])
// ClientHandler implementation
CefHandler::RetVal ClientHandler::HandleBeforeCreated(
CefRefPtr<CefBrowser> parentBrowser, CefWindowInfo& createInfo, bool popup,
const CefPopupFeatures& popupFeatures, CefRefPtr<CefHandler>& handler,
CefString& url, CefBrowserSettings& settings)
{
REQUIRE_UI_THREAD();
return RV_CONTINUE;
}
CefHandler::RetVal ClientHandler::HandleAddressChange(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
const CefString& url)
@@ -399,7 +468,8 @@ CefHandler::RetVal ClientHandler::HandleTitleChange(
REQUIRE_UI_THREAD();
// Set the frame window title bar
NSWindow* window = (NSWindow*)m_MainHwnd;
NSView* view = (NSView*)browser->GetWindowHandle();
NSWindow* window = [view window];
std::string titleStr(title);
NSString* str = [NSString stringWithUTF8String:titleStr.c_str()];
[window setTitle:str];

View File

@@ -636,27 +636,6 @@ INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
// ClientHandler implementation
CefHandler::RetVal ClientHandler::HandleBeforeCreated(
CefRefPtr<CefBrowser> parentBrowser, CefWindowInfo& createInfo, bool popup,
const CefPopupFeatures& popupFeatures, CefRefPtr<CefHandler>& handler,
CefString& url, CefBrowserSettings& settings)
{
REQUIRE_UI_THREAD();
if(popup) {
if(popupFeatures.xSet)
createInfo.m_x = popupFeatures.x;
if(popupFeatures.ySet)
createInfo.m_y = popupFeatures.y;
if(popupFeatures.widthSet)
createInfo.m_nWidth = popupFeatures.width;
if(popupFeatures.heightSet)
createInfo.m_nHeight = popupFeatures.height;
}
return RV_CONTINUE;
}
CefHandler::RetVal ClientHandler::HandleAddressChange(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
const CefString& url)