mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	Windows: Switch to aura/views architecture for content window creation (issue #180).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1542 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
		
							
								
								
									
										18
									
								
								cef.gyp
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								cef.gyp
									
									
									
									
									
								
							| @@ -831,6 +831,7 @@ | |||||||
|         # CEF grit resource includes |         # CEF grit resource includes | ||||||
|         '<(DEPTH)/cef/libcef/resources/grit_stub', |         '<(DEPTH)/cef/libcef/resources/grit_stub', | ||||||
|         '<(grit_out_dir)', |         '<(grit_out_dir)', | ||||||
|  |         '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources', | ||||||
|         '<(SHARED_INTERMEDIATE_DIR)/ui/ui_strings', |         '<(SHARED_INTERMEDIATE_DIR)/ui/ui_strings', | ||||||
|         '<(SHARED_INTERMEDIATE_DIR)/webkit', |         '<(SHARED_INTERMEDIATE_DIR)/webkit', | ||||||
|       ], |       ], | ||||||
| @@ -1110,16 +1111,6 @@ | |||||||
|             'libcef/browser/javascript_dialog_win.cc', |             'libcef/browser/javascript_dialog_win.cc', | ||||||
|             'libcef/browser/menu_creator_runner_win.cc', |             'libcef/browser/menu_creator_runner_win.cc', | ||||||
|             'libcef/browser/menu_creator_runner_win.h', |             'libcef/browser/menu_creator_runner_win.h', | ||||||
|             # Include sources for context menu implementation. |  | ||||||
|             '<(DEPTH)/ui/views/controls/menu/menu_2.cc', |  | ||||||
|             '<(DEPTH)/ui/views/controls/menu/menu_2.h', |  | ||||||
|             '<(DEPTH)/ui/views/controls/menu/menu_config.cc', |  | ||||||
|             '<(DEPTH)/ui/views/controls/menu/menu_config.h', |  | ||||||
|             '<(DEPTH)/ui/views/controls/menu/menu_config_win.cc', |  | ||||||
|             '<(DEPTH)/ui/views/controls/menu/menu_listener.cc', |  | ||||||
|             '<(DEPTH)/ui/views/controls/menu/menu_listener.h', |  | ||||||
|             '<(DEPTH)/ui/views/controls/menu/native_menu_win.cc', |  | ||||||
|             '<(DEPTH)/ui/views/controls/menu/native_menu_win.h', |  | ||||||
|             # Include sources for printing. |             # Include sources for printing. | ||||||
|             '<(DEPTH)/chrome/renderer/printing/print_web_view_helper_win.cc', |             '<(DEPTH)/chrome/renderer/printing/print_web_view_helper_win.cc', | ||||||
|           ], |           ], | ||||||
| @@ -1179,6 +1170,13 @@ | |||||||
|             '<(DEPTH)/components/components.gyp:breakpad_host', |             '<(DEPTH)/components/components.gyp:breakpad_host', | ||||||
|           ], |           ], | ||||||
|         }], |         }], | ||||||
|  |         ['use_aura==1', { | ||||||
|  |           'dependencies': [ | ||||||
|  |             '<(DEPTH)/ui/views/controls/webview/webview.gyp:webview', | ||||||
|  |             '<(DEPTH)/ui/views/views.gyp:views', | ||||||
|  |             '<(DEPTH)/ui/views/views.gyp:views_test_support', | ||||||
|  |           ], | ||||||
|  |         }], | ||||||
|       ], |       ], | ||||||
|     }, |     }, | ||||||
|   ], |   ], | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								cef.gypi
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								cef.gypi
									
									
									
									
									
								
							| @@ -4,8 +4,6 @@ | |||||||
|  |  | ||||||
| { | { | ||||||
|   'variables': { |   'variables': { | ||||||
|     'use_ash': 0, |  | ||||||
|     'use_aura': 0, |  | ||||||
|     # Don't use the chrome style plugin with CEF. |     # Don't use the chrome style plugin with CEF. | ||||||
|     'clang_use_chrome_plugins': 0, |     'clang_use_chrome_plugins': 0, | ||||||
|     'conditions': [ |     'conditions': [ | ||||||
| @@ -18,6 +16,9 @@ | |||||||
|         'disable_debugallocation': 1, |         'disable_debugallocation': 1, | ||||||
|       }, { # OS!="win" |       }, { # OS!="win" | ||||||
|         'cef_directory' : '<!(echo $CEF_DIRECTORY)', |         'cef_directory' : '<!(echo $CEF_DIRECTORY)', | ||||||
|  |         # Aura is not yet supported on non-Windows platforms. | ||||||
|  |         'use_ash': 0, | ||||||
|  |         'use_aura': 0, | ||||||
|       }], |       }], | ||||||
|       [ 'OS=="mac"', { |       [ 'OS=="mac"', { | ||||||
|         # Strip symbols and create dSYM files for the Release target. |         # Strip symbols and create dSYM files for the Release target. | ||||||
|   | |||||||
| @@ -56,6 +56,10 @@ | |||||||
| #include "ui/gfx/font_render_params_linux.h" | #include "ui/gfx/font_render_params_linux.h" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #if defined(USE_AURA) | ||||||
|  | #include "ui/views/widget/widget.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| namespace { | namespace { | ||||||
|  |  | ||||||
| class CreateBrowserHelper { | class CreateBrowserHelper { | ||||||
| @@ -148,6 +152,21 @@ bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event, | |||||||
|   return true; |   return true; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // Returns the OS event handle, if any, associated with |event|. | ||||||
|  | CefEventHandle GetCefEventHandle(const content::NativeWebKeyboardEvent& event) { | ||||||
|  | #if defined(USE_AURA) | ||||||
|  |   if (!event.os_event) | ||||||
|  |     return NULL; | ||||||
|  | #if defined(OS_WIN) | ||||||
|  |   return const_cast<CefEventHandle>(&event.os_event->native_event()); | ||||||
|  | #else | ||||||
|  |   return const_cast<CefEventHandle>(event.os_event->native_event()); | ||||||
|  | #endif | ||||||
|  | #else  // !defined(USE_AURA) | ||||||
|  |   return event.os_event; | ||||||
|  | #endif  // !defined(USE_AURA) | ||||||
|  | } | ||||||
|  |  | ||||||
| class CefFileDialogCallbackImpl : public CefFileDialogCallback { | class CefFileDialogCallbackImpl : public CefFileDialogCallback { | ||||||
|  public: |  public: | ||||||
|   explicit CefFileDialogCallbackImpl( |   explicit CefFileDialogCallbackImpl( | ||||||
| @@ -1306,6 +1325,10 @@ void CefBrowserHostImpl::DestroyBrowser() { | |||||||
|   web_contents_.reset(NULL); |   web_contents_.reset(NULL); | ||||||
|   menu_creator_.reset(NULL); |   menu_creator_.reset(NULL); | ||||||
|  |  | ||||||
|  | #if defined(USE_AURA) | ||||||
|  |   window_widget_ = NULL; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   DetachAllFrames(); |   DetachAllFrames(); | ||||||
|  |  | ||||||
|   CefContentBrowserClient::Get()->RemoveBrowserInfo(browser_info_); |   CefContentBrowserClient::Get()->RemoveBrowserInfo(browser_info_); | ||||||
| @@ -1314,9 +1337,15 @@ void CefBrowserHostImpl::DestroyBrowser() { | |||||||
|  |  | ||||||
| gfx::NativeView CefBrowserHostImpl::GetContentView() const { | gfx::NativeView CefBrowserHostImpl::GetContentView() const { | ||||||
|   CEF_REQUIRE_UIT(); |   CEF_REQUIRE_UIT(); | ||||||
|  | #if defined(USE_AURA) | ||||||
|  |   if (!window_widget_) | ||||||
|  |     return NULL; | ||||||
|  |   return window_widget_->GetNativeView(); | ||||||
|  | #else | ||||||
|   if (!web_contents_.get()) |   if (!web_contents_.get()) | ||||||
|     return NULL; |     return NULL; | ||||||
|   return web_contents_->GetView()->GetNativeView(); |   return web_contents_->GetView()->GetNativeView(); | ||||||
|  | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| content::WebContents* CefBrowserHostImpl::GetWebContents() const { | content::WebContents* CefBrowserHostImpl::GetWebContents() const { | ||||||
| @@ -1784,15 +1813,9 @@ bool CefBrowserHostImpl::PreHandleKeyboardEvent( | |||||||
|       if (!GetCefKeyEvent(event, cef_event)) |       if (!GetCefKeyEvent(event, cef_event)) | ||||||
|         return false; |         return false; | ||||||
|  |  | ||||||
| #if defined(OS_WIN) |  | ||||||
|       CefEventHandle os_event = const_cast<CefEventHandle>(&event.os_event); |  | ||||||
| #else |  | ||||||
|       CefEventHandle os_event = event.os_event; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|       cef_event.focus_on_editable_field = focus_on_editable_field_; |       cef_event.focus_on_editable_field = focus_on_editable_field_; | ||||||
|  |  | ||||||
|       return handler->OnPreKeyEvent(this, cef_event, os_event, |       return handler->OnPreKeyEvent(this, cef_event, GetCefEventHandle(event), | ||||||
|                                     is_keyboard_shortcut); |                                     is_keyboard_shortcut); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @@ -1812,15 +1835,9 @@ void CefBrowserHostImpl::HandleKeyboardEvent( | |||||||
|     if (handler.get()) { |     if (handler.get()) { | ||||||
|       CefKeyEvent cef_event; |       CefKeyEvent cef_event; | ||||||
|       if (GetCefKeyEvent(event, cef_event)) { |       if (GetCefKeyEvent(event, cef_event)) { | ||||||
| #if defined(OS_WIN) |  | ||||||
|         CefEventHandle os_event = const_cast<CefEventHandle>(&event.os_event); |  | ||||||
| #else |  | ||||||
|         CefEventHandle os_event = event.os_event; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|         cef_event.focus_on_editable_field = focus_on_editable_field_; |         cef_event.focus_on_editable_field = focus_on_editable_field_; | ||||||
|  |  | ||||||
|         if (handler->OnKeyEvent(this, cef_event, os_event)) |         if (handler->OnKeyEvent(this, cef_event, GetCefEventHandle(event))) | ||||||
|           return; |           return; | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
| @@ -2280,6 +2297,10 @@ CefBrowserHostImpl::CefBrowserHostImpl( | |||||||
|       mouse_cursor_change_disabled_(false), |       mouse_cursor_change_disabled_(false), | ||||||
|       devtools_frontend_(NULL), |       devtools_frontend_(NULL), | ||||||
|       file_chooser_pending_(false) { |       file_chooser_pending_(false) { | ||||||
|  | #if defined(USE_AURA) | ||||||
|  |   window_widget_ = NULL; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   DCHECK(!browser_info_->browser().get()); |   DCHECK(!browser_info_->browser().get()); | ||||||
|   browser_info_->set_browser(this); |   browser_info_->set_browser(this); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -30,6 +30,11 @@ | |||||||
| #include "content/public/browser/web_contents_observer.h" | #include "content/public/browser/web_contents_observer.h" | ||||||
| #include "content/public/common/file_chooser_params.h" | #include "content/public/common/file_chooser_params.h" | ||||||
|  |  | ||||||
|  | #if defined(USE_AURA) | ||||||
|  | #include "third_party/WebKit/public/platform/WebCursorInfo.h" | ||||||
|  | #include "ui/base/cursor/cursor.h" | ||||||
|  | #endif | ||||||
|  |  | ||||||
| namespace content { | namespace content { | ||||||
| struct NativeWebKeyboardEvent; | struct NativeWebKeyboardEvent; | ||||||
| } | } | ||||||
| @@ -44,6 +49,12 @@ namespace net { | |||||||
| class URLRequest; | class URLRequest; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | #if defined(USE_AURA) | ||||||
|  | namespace views { | ||||||
|  | class Widget; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
| struct Cef_Request_Params; | struct Cef_Request_Params; | ||||||
| struct Cef_Response_Params; | struct Cef_Response_Params; | ||||||
| class CefBrowserInfo; | class CefBrowserInfo; | ||||||
| @@ -248,6 +259,10 @@ class CefBrowserHostImpl : public CefBrowserHost, | |||||||
|   static void RegisterWindowClass(); |   static void RegisterWindowClass(); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #if defined(USE_AURA) | ||||||
|  |   ui::PlatformCursor GetPlatformCursor(blink::WebCursorInfo::Type type); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   void OnSetFocus(cef_focus_source_t source); |   void OnSetFocus(cef_focus_source_t source); | ||||||
|  |  | ||||||
|   // The argument vector will be empty if the dialog was cancelled. |   // The argument vector will be empty if the dialog was cancelled. | ||||||
| @@ -579,6 +594,12 @@ class CefBrowserHostImpl : public CefBrowserHost, | |||||||
|   // Current title for the main frame. Only accessed on the UI thread. |   // Current title for the main frame. Only accessed on the UI thread. | ||||||
|   string16 title_; |   string16 title_; | ||||||
|  |  | ||||||
|  | #if defined(USE_AURA) | ||||||
|  |   // Widget hosting the web contents. It will be deleted automatically when the | ||||||
|  |   // associated root window is destroyed. | ||||||
|  |   views::Widget* window_widget_; | ||||||
|  | #endif  // defined(USE_AURA) | ||||||
|  |  | ||||||
|   IMPLEMENT_REFCOUNTING(CefBrowserHostImpl); |   IMPLEMENT_REFCOUNTING(CefBrowserHostImpl); | ||||||
|   DISALLOW_EVIL_CONSTRUCTORS(CefBrowserHostImpl); |   DISALLOW_EVIL_CONSTRUCTORS(CefBrowserHostImpl); | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -11,6 +11,7 @@ | |||||||
| #include <wininet.h> | #include <wininet.h> | ||||||
| #include <winspool.h> | #include <winspool.h> | ||||||
|  |  | ||||||
|  | #include "libcef/browser/content_browser_client.h" | ||||||
| #include "libcef/browser/thread_util.h" | #include "libcef/browser/thread_util.h" | ||||||
|  |  | ||||||
| #include "base/i18n/case_conversion.h" | #include "base/i18n/case_conversion.h" | ||||||
| @@ -23,11 +24,17 @@ | |||||||
| #include "content/public/common/file_chooser_params.h" | #include "content/public/common/file_chooser_params.h" | ||||||
| #include "grit/cef_strings.h" | #include "grit/cef_strings.h" | ||||||
| #include "grit/ui_strings.h" | #include "grit/ui_strings.h" | ||||||
|  | #include "grit/ui_unscaled_resources.h" | ||||||
| #include "net/base/mime_util.h" | #include "net/base/mime_util.h" | ||||||
| #include "third_party/WebKit/public/web/WebInputEvent.h" | #include "third_party/WebKit/public/web/WebInputEvent.h" | ||||||
| #include "third_party/WebKit/public/web/win/WebInputEventFactory.h" | #include "third_party/WebKit/public/web/win/WebInputEventFactory.h" | ||||||
| #include "ui/base/l10n/l10n_util.h" | #include "ui/base/l10n/l10n_util.h" | ||||||
| #include "ui/gfx/win/hwnd_util.h" | #include "ui/gfx/win/hwnd_util.h" | ||||||
|  | #include "ui/views/controls/webview/webview.h" | ||||||
|  | #include "ui/views/layout/fill_layout.h" | ||||||
|  | #include "ui/views/widget/widget.h" | ||||||
|  | #include "ui/views/widget/widget_delegate.h" | ||||||
|  | #include "webkit/common/cursors/webcursor.h" | ||||||
|  |  | ||||||
| #pragma comment(lib, "dwmapi.lib") | #pragma comment(lib, "dwmapi.lib") | ||||||
|  |  | ||||||
| @@ -427,6 +434,174 @@ WORD KeyStatesToWord() { | |||||||
|   return result; |   return result; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // From webkit/common/cursors/webcursor_win.cc. | ||||||
|  |  | ||||||
|  | using blink::WebCursorInfo; | ||||||
|  |  | ||||||
|  | LPCWSTR ToCursorID(WebCursorInfo::Type type) { | ||||||
|  |   switch (type) { | ||||||
|  |     case WebCursorInfo::TypePointer: | ||||||
|  |       return IDC_ARROW; | ||||||
|  |     case WebCursorInfo::TypeCross: | ||||||
|  |       return IDC_CROSS; | ||||||
|  |     case WebCursorInfo::TypeHand: | ||||||
|  |       return IDC_HAND; | ||||||
|  |     case WebCursorInfo::TypeIBeam: | ||||||
|  |       return IDC_IBEAM; | ||||||
|  |     case WebCursorInfo::TypeWait: | ||||||
|  |       return IDC_WAIT; | ||||||
|  |     case WebCursorInfo::TypeHelp: | ||||||
|  |       return IDC_HELP; | ||||||
|  |     case WebCursorInfo::TypeEastResize: | ||||||
|  |       return IDC_SIZEWE; | ||||||
|  |     case WebCursorInfo::TypeNorthResize: | ||||||
|  |       return IDC_SIZENS; | ||||||
|  |     case WebCursorInfo::TypeNorthEastResize: | ||||||
|  |       return IDC_SIZENESW; | ||||||
|  |     case WebCursorInfo::TypeNorthWestResize: | ||||||
|  |       return IDC_SIZENWSE; | ||||||
|  |     case WebCursorInfo::TypeSouthResize: | ||||||
|  |       return IDC_SIZENS; | ||||||
|  |     case WebCursorInfo::TypeSouthEastResize: | ||||||
|  |       return IDC_SIZENWSE; | ||||||
|  |     case WebCursorInfo::TypeSouthWestResize: | ||||||
|  |       return IDC_SIZENESW; | ||||||
|  |     case WebCursorInfo::TypeWestResize: | ||||||
|  |       return IDC_SIZEWE; | ||||||
|  |     case WebCursorInfo::TypeNorthSouthResize: | ||||||
|  |       return IDC_SIZENS; | ||||||
|  |     case WebCursorInfo::TypeEastWestResize: | ||||||
|  |       return IDC_SIZEWE; | ||||||
|  |     case WebCursorInfo::TypeNorthEastSouthWestResize: | ||||||
|  |       return IDC_SIZENESW; | ||||||
|  |     case WebCursorInfo::TypeNorthWestSouthEastResize: | ||||||
|  |       return IDC_SIZENWSE; | ||||||
|  |     case WebCursorInfo::TypeColumnResize: | ||||||
|  |       return MAKEINTRESOURCE(IDC_COLRESIZE); | ||||||
|  |     case WebCursorInfo::TypeRowResize: | ||||||
|  |       return MAKEINTRESOURCE(IDC_ROWRESIZE); | ||||||
|  |     case WebCursorInfo::TypeMiddlePanning: | ||||||
|  |       return MAKEINTRESOURCE(IDC_PAN_MIDDLE); | ||||||
|  |     case WebCursorInfo::TypeEastPanning: | ||||||
|  |       return MAKEINTRESOURCE(IDC_PAN_EAST); | ||||||
|  |     case WebCursorInfo::TypeNorthPanning: | ||||||
|  |       return MAKEINTRESOURCE(IDC_PAN_NORTH); | ||||||
|  |     case WebCursorInfo::TypeNorthEastPanning: | ||||||
|  |       return MAKEINTRESOURCE(IDC_PAN_NORTH_EAST); | ||||||
|  |     case WebCursorInfo::TypeNorthWestPanning: | ||||||
|  |       return MAKEINTRESOURCE(IDC_PAN_NORTH_WEST); | ||||||
|  |     case WebCursorInfo::TypeSouthPanning: | ||||||
|  |       return MAKEINTRESOURCE(IDC_PAN_SOUTH); | ||||||
|  |     case WebCursorInfo::TypeSouthEastPanning: | ||||||
|  |       return MAKEINTRESOURCE(IDC_PAN_SOUTH_EAST); | ||||||
|  |     case WebCursorInfo::TypeSouthWestPanning: | ||||||
|  |       return MAKEINTRESOURCE(IDC_PAN_SOUTH_WEST); | ||||||
|  |     case WebCursorInfo::TypeWestPanning: | ||||||
|  |       return MAKEINTRESOURCE(IDC_PAN_WEST); | ||||||
|  |     case WebCursorInfo::TypeMove: | ||||||
|  |       return IDC_SIZEALL; | ||||||
|  |     case WebCursorInfo::TypeVerticalText: | ||||||
|  |       return MAKEINTRESOURCE(IDC_VERTICALTEXT); | ||||||
|  |     case WebCursorInfo::TypeCell: | ||||||
|  |       return MAKEINTRESOURCE(IDC_CELL); | ||||||
|  |     case WebCursorInfo::TypeContextMenu: | ||||||
|  |       return MAKEINTRESOURCE(IDC_ARROW); | ||||||
|  |     case WebCursorInfo::TypeAlias: | ||||||
|  |       return MAKEINTRESOURCE(IDC_ALIAS); | ||||||
|  |     case WebCursorInfo::TypeProgress: | ||||||
|  |       return IDC_APPSTARTING; | ||||||
|  |     case WebCursorInfo::TypeNoDrop: | ||||||
|  |       return IDC_NO; | ||||||
|  |     case WebCursorInfo::TypeCopy: | ||||||
|  |       return MAKEINTRESOURCE(IDC_COPYCUR); | ||||||
|  |     case WebCursorInfo::TypeNone: | ||||||
|  |       return MAKEINTRESOURCE(IDC_CURSOR_NONE); | ||||||
|  |     case WebCursorInfo::TypeNotAllowed: | ||||||
|  |       return IDC_NO; | ||||||
|  |     case WebCursorInfo::TypeZoomIn: | ||||||
|  |       return MAKEINTRESOURCE(IDC_ZOOMIN); | ||||||
|  |     case WebCursorInfo::TypeZoomOut: | ||||||
|  |       return MAKEINTRESOURCE(IDC_ZOOMOUT); | ||||||
|  |     case WebCursorInfo::TypeGrab: | ||||||
|  |       return MAKEINTRESOURCE(IDC_HAND_GRAB); | ||||||
|  |     case WebCursorInfo::TypeGrabbing: | ||||||
|  |       return MAKEINTRESOURCE(IDC_HAND_GRABBING); | ||||||
|  |   } | ||||||
|  |   NOTREACHED(); | ||||||
|  |   return NULL; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | bool IsSystemCursorID(LPCWSTR cursor_id) { | ||||||
|  |   return cursor_id >= IDC_ARROW;  // See WinUser.h | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // Manages the views-based root window that hosts the web contents. This object | ||||||
|  | // will be deleted automatically when the associated root window is destroyed. | ||||||
|  | class CefWindowDelegateView : public views::WidgetDelegateView { | ||||||
|  |  public: | ||||||
|  |   CefWindowDelegateView() | ||||||
|  |     : web_view_(NULL) { | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Create the Widget and associated root window. | ||||||
|  |   void Init(gfx::AcceleratedWidget parent_widget, | ||||||
|  |             content::WebContents* web_contents, | ||||||
|  |             const gfx::Rect& bounds) { | ||||||
|  |     DCHECK(!web_view_); | ||||||
|  |     web_view_ = new views::WebView(web_contents->GetBrowserContext()); | ||||||
|  |     web_view_->SetWebContents(web_contents); | ||||||
|  |     web_view_->SetPreferredSize(bounds.size()); | ||||||
|  |  | ||||||
|  |     views::Widget* widget = new views::Widget; | ||||||
|  |  | ||||||
|  |     // See CalculateWindowStylesFromInitParams in | ||||||
|  |     // ui/views/widget/widget_hwnd_utils.cc for the conversion of |params| to | ||||||
|  |     // Windows style flags. | ||||||
|  |     views::Widget::InitParams params; | ||||||
|  |     params.parent_widget = parent_widget; | ||||||
|  |     params.bounds = bounds; | ||||||
|  |     params.delegate = this; | ||||||
|  |     params.top_level = true; | ||||||
|  |     // Set the WS_CHILD flag. | ||||||
|  |     params.child = true; | ||||||
|  |     // Set the WS_VISIBLE flag. | ||||||
|  |     params.type = views::Widget::InitParams::TYPE_CONTROL; | ||||||
|  |     // Don't set the WS_EX_COMPOSITED flag. | ||||||
|  |     params.opacity = views::Widget::InitParams::OPAQUE_WINDOW; | ||||||
|  |  | ||||||
|  |     // Results in a call to InitContent(). | ||||||
|  |     widget->Init(params); | ||||||
|  |  | ||||||
|  |     // |widget| should now be associated with |this|. | ||||||
|  |     DCHECK_EQ(widget, GetWidget()); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |  private: | ||||||
|  |   // Initialize the Widget's content. | ||||||
|  |   void InitContent() { | ||||||
|  |     set_background(views::Background::CreateStandardPanelBackground()); | ||||||
|  |     SetLayoutManager(new views::FillLayout()); | ||||||
|  |     AddChildView(web_view_); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // WidgetDelegateView methods: | ||||||
|  |   virtual bool CanResize() const OVERRIDE { return true; } | ||||||
|  |   virtual bool CanMaximize() const OVERRIDE { return true; } | ||||||
|  |   virtual View* GetContentsView() OVERRIDE { return this; } | ||||||
|  |  | ||||||
|  |   // View methods: | ||||||
|  |   virtual void ViewHierarchyChanged( | ||||||
|  |       const ViewHierarchyChangedDetails& details) OVERRIDE { | ||||||
|  |     if (details.is_add && details.child == this) | ||||||
|  |       InitContent(); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |  private: | ||||||
|  |   views::WebView* web_view_; | ||||||
|  |  | ||||||
|  |   DISALLOW_COPY_AND_ASSIGN(CefWindowDelegateView); | ||||||
|  | }; | ||||||
|  |  | ||||||
| }  // namespace | }  // namespace | ||||||
|  |  | ||||||
| // static | // static | ||||||
| @@ -490,12 +665,11 @@ LRESULT CALLBACK CefBrowserHostImpl::WndProc(HWND hwnd, UINT message, | |||||||
|   case WM_SIZE: |   case WM_SIZE: | ||||||
|     // Minimizing resizes the window to 0x0 which causes our layout to go all |     // Minimizing resizes the window to 0x0 which causes our layout to go all | ||||||
|     // screwy, so we just ignore it. |     // screwy, so we just ignore it. | ||||||
|     if (wParam != SIZE_MINIMIZED && browser) { |     if (wParam != SIZE_MINIMIZED && browser && browser->window_widget_) { | ||||||
|       // resize the web view window to the full size of the browser window |       // Resize the Widget window to the full size of the browser window. | ||||||
|       RECT rc; |       RECT rc; | ||||||
|       GetClientRect(hwnd, &rc); |       GetClientRect(hwnd, &rc); | ||||||
|       MoveWindow(browser->GetContentView(), 0, 0, rc.right, rc.bottom, |       browser->window_widget_->SetSize(gfx::Size(rc.right, rc.bottom)); | ||||||
|           TRUE); |  | ||||||
|     } |     } | ||||||
|     return 0; |     return 0; | ||||||
|  |  | ||||||
| @@ -518,6 +692,20 @@ LRESULT CALLBACK CefBrowserHostImpl::WndProc(HWND hwnd, UINT message, | |||||||
|   return DefWindowProc(hwnd, message, wParam, lParam); |   return DefWindowProc(hwnd, message, wParam, lParam); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | ui::PlatformCursor CefBrowserHostImpl::GetPlatformCursor( | ||||||
|  |     blink::WebCursorInfo::Type type) { | ||||||
|  |   HMODULE module_handle = NULL; | ||||||
|  |   const wchar_t* cursor_id = ToCursorID(type); | ||||||
|  |   if (!IsSystemCursorID(cursor_id)) { | ||||||
|  |     module_handle = ::GetModuleHandle( | ||||||
|  |         CefContentBrowserClient::Get()->GetResourceDllName()); | ||||||
|  |     if (!module_handle) | ||||||
|  |       module_handle = ::GetModuleHandle(NULL); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   return LoadCursor(module_handle, cursor_id); | ||||||
|  | } | ||||||
|  |  | ||||||
| bool CefBrowserHostImpl::PlatformCreateWindow() { | bool CefBrowserHostImpl::PlatformCreateWindow() { | ||||||
|   std::wstring windowName(CefString(&window_info_.window_name)); |   std::wstring windowName(CefString(&window_info_.window_name)); | ||||||
|  |  | ||||||
| @@ -547,20 +735,18 @@ bool CefBrowserHostImpl::PlatformCreateWindow() { | |||||||
|   // Add a reference that will be released in the WM_DESTROY handler. |   // Add a reference that will be released in the WM_DESTROY handler. | ||||||
|   AddRef(); |   AddRef(); | ||||||
|  |  | ||||||
|   // Parent the TabContents to the browser window. |  | ||||||
|   SetParent(web_contents_->GetView()->GetNativeView(), window_info_.window); |  | ||||||
|  |  | ||||||
|   // Size the web view window to the browser window. |  | ||||||
|   RECT cr; |   RECT cr; | ||||||
|   GetClientRect(window_info_.window, &cr); |   GetClientRect(window_info_.window, &cr); | ||||||
|  |  | ||||||
|   // Respect the WS_VISIBLE window style when setting the window's position. |   DCHECK(!window_widget_); | ||||||
|   UINT flags = SWP_NOZORDER | SWP_SHOWWINDOW; |  | ||||||
|   if (!(window_info_.style & WS_VISIBLE)) |  | ||||||
|     flags |= SWP_NOACTIVATE; |  | ||||||
|  |  | ||||||
|   SetWindowPos(GetContentView(), NULL, cr.left, cr.top, cr.right, |   CefWindowDelegateView* delegate_view = new CefWindowDelegateView(); | ||||||
|                 cr.bottom, flags); |   delegate_view->Init(window_info_.window, | ||||||
|  |                       web_contents(), | ||||||
|  |                       gfx::Rect(0, 0, cr.right, cr.bottom)); | ||||||
|  |  | ||||||
|  |   window_widget_ = delegate_view->GetWidget(); | ||||||
|  |   window_widget_->Show(); | ||||||
|  |  | ||||||
|   return true; |   return true; | ||||||
| } | } | ||||||
| @@ -632,8 +818,27 @@ void CefBrowserHostImpl::PlatformHandleKeyboardEvent( | |||||||
|     const content::NativeWebKeyboardEvent& event) { |     const content::NativeWebKeyboardEvent& event) { | ||||||
|   // Any unhandled keyboard/character messages are sent to DefWindowProc so that |   // Any unhandled keyboard/character messages are sent to DefWindowProc so that | ||||||
|   // shortcut keys work correctly. |   // shortcut keys work correctly. | ||||||
|   DefWindowProc(event.os_event.hwnd, event.os_event.message, |   HWND hwnd = PlatformGetWindowHandle(); | ||||||
|                 event.os_event.wParam, event.os_event.lParam); |   if (!hwnd) | ||||||
|  |     return; | ||||||
|  |  | ||||||
|  |   UINT message = 0; | ||||||
|  |   switch (event.type) { | ||||||
|  |     case blink::WebInputEvent::RawKeyDown: | ||||||
|  |       message = WM_KEYDOWN; | ||||||
|  |       break; | ||||||
|  |     case blink::WebInputEvent::KeyUp: | ||||||
|  |       message = WM_KEYUP; | ||||||
|  |       break; | ||||||
|  |     case blink::WebInputEvent::Char: | ||||||
|  |       message = WM_CHAR; | ||||||
|  |       break; | ||||||
|  |     default: | ||||||
|  |       NOTREACHED(); | ||||||
|  |       return; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   DefWindowProc(hwnd, message, event.windowsKeyCode, event.nativeKeyCode); | ||||||
| } | } | ||||||
|  |  | ||||||
| void CefBrowserHostImpl::PlatformRunFileChooser( | void CefBrowserHostImpl::PlatformRunFileChooser( | ||||||
|   | |||||||
| @@ -30,6 +30,13 @@ | |||||||
| #include "chrome/browser/printing/print_dialog_gtk.h" | #include "chrome/browser/printing/print_dialog_gtk.h" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #if defined(USE_AURA) | ||||||
|  | #include "ui/aura/env.h" | ||||||
|  | #include "ui/gfx/screen.h" | ||||||
|  | #include "ui/views/test/desktop_test_views_delegate.h" | ||||||
|  | #include "ui/views/widget/desktop_aura/desktop_screen.h" | ||||||
|  | #endif  // defined(USE_AURA) | ||||||
|  |  | ||||||
| CefBrowserMainParts::CefBrowserMainParts( | CefBrowserMainParts::CefBrowserMainParts( | ||||||
|     const content::MainFunctionParams& parameters) |     const content::MainFunctionParams& parameters) | ||||||
|     : BrowserMainParts(), |     : BrowserMainParts(), | ||||||
| @@ -47,6 +54,15 @@ void CefBrowserMainParts::PreMainMessageLoopStart() { | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void CefBrowserMainParts::ToolkitInitialized() { | ||||||
|  | #if defined(USE_AURA) | ||||||
|  |   aura::Env::CreateInstance(); | ||||||
|  |  | ||||||
|  |   DCHECK(!views::ViewsDelegate::views_delegate); | ||||||
|  |   new views::DesktopTestViewsDelegate; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
| void CefBrowserMainParts::PostMainMessageLoopStart() { | void CefBrowserMainParts::PostMainMessageLoopStart() { | ||||||
|   // Don't use the default WebUI controller factory because is conflicts with |   // Don't use the default WebUI controller factory because is conflicts with | ||||||
|   // CEF's internal handling of "chrome://tracing". |   // CEF's internal handling of "chrome://tracing". | ||||||
| @@ -67,6 +83,11 @@ int CefBrowserMainParts::PreCreateThreads() { | |||||||
|   // before the IO thread is started. |   // before the IO thread is started. | ||||||
|   content::GpuDataManager::GetInstance(); |   content::GpuDataManager::GetInstance(); | ||||||
|  |  | ||||||
|  | #if defined(USE_AURA) | ||||||
|  |   gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, | ||||||
|  |                                  views::CreateDesktopScreen()); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   // Initialize user preferences. |   // Initialize user preferences. | ||||||
|   pref_store_ = new CefBrowserPrefStore(); |   pref_store_ = new CefBrowserPrefStore(); | ||||||
|   pref_store_->SetInitializationCompleted(); |   pref_store_->SetInitializationCompleted(); | ||||||
| @@ -138,6 +159,11 @@ void CefBrowserMainParts::PostDestroyThreads() { | |||||||
|     proxy_v8_isolate_->Dispose(); |     proxy_v8_isolate_->Dispose(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | #if defined(USE_AURA) | ||||||
|  |   aura::Env::DeleteInstance(); | ||||||
|  |   delete views::ViewsDelegate::views_delegate; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   PlatformCleanup(); |   PlatformCleanup(); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -41,6 +41,7 @@ class CefBrowserMainParts : public content::BrowserMainParts { | |||||||
|  |  | ||||||
|   virtual void PreMainMessageLoopStart() OVERRIDE; |   virtual void PreMainMessageLoopStart() OVERRIDE; | ||||||
|   virtual void PostMainMessageLoopStart() OVERRIDE; |   virtual void PostMainMessageLoopStart() OVERRIDE; | ||||||
|  |   virtual void ToolkitInitialized() OVERRIDE; | ||||||
|   virtual int PreCreateThreads() OVERRIDE; |   virtual int PreCreateThreads() OVERRIDE; | ||||||
|   virtual void PreMainMessageLoopRun() OVERRIDE; |   virtual void PreMainMessageLoopRun() OVERRIDE; | ||||||
|   virtual void PostMainMessageLoopRun() OVERRIDE; |   virtual void PostMainMessageLoopRun() OVERRIDE; | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ | |||||||
|  |  | ||||||
| #include "base/message_loop/message_loop.h" | #include "base/message_loop/message_loop.h" | ||||||
| #include "content/public/browser/web_contents_view.h" | #include "content/public/browser/web_contents_view.h" | ||||||
|  | #include "ui/aura/window.h" | ||||||
| #include "ui/gfx/point.h" | #include "ui/gfx/point.h" | ||||||
| #include "ui/views/controls/menu/menu_2.h" | #include "ui/views/controls/menu/menu_2.h" | ||||||
|  |  | ||||||
| @@ -42,11 +43,10 @@ bool CefMenuCreatorRunnerWin::RunContextMenu(CefMenuCreator* manager) { | |||||||
|  |  | ||||||
|     screen_point = gfx::Point(screenX, screenY); |     screen_point = gfx::Point(screenX, screenY); | ||||||
|   } else { |   } else { | ||||||
|     POINT temp = {manager->params().x, manager->params().y}; |     aura::Window* window = manager->browser()->GetContentView(); | ||||||
|     HWND hwnd = |     const gfx::Rect& bounds_in_screen = window->GetBoundsInScreen(); | ||||||
|         manager->browser()->GetWebContents()->GetView()->GetNativeView(); |     screen_point = gfx::Point(bounds_in_screen.x() + manager->params().x, | ||||||
|     ClientToScreen(hwnd, &temp); |                               bounds_in_screen.y() + manager->params().y); | ||||||
|     screen_point = temp; |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // Show the menu. Blocks until the menu is dismissed. |   // Show the menu. Blocks until the menu is dismissed. | ||||||
|   | |||||||
| @@ -6,13 +6,13 @@ | |||||||
| #include "libcef/browser/backing_store_osr.h" | #include "libcef/browser/backing_store_osr.h" | ||||||
| #include "libcef/browser/browser_host_impl.h" | #include "libcef/browser/browser_host_impl.h" | ||||||
| #include "libcef/browser/render_widget_host_view_osr.h" | #include "libcef/browser/render_widget_host_view_osr.h" | ||||||
| #include "libcef/common/content_client.h" |  | ||||||
|  |  | ||||||
| #include "base/message_loop/message_loop.h" | #include "base/message_loop/message_loop.h" | ||||||
| #include "content/browser/renderer_host/render_widget_host_impl.h" | #include "content/browser/renderer_host/render_widget_host_impl.h" | ||||||
| #include "content/public/browser/content_browser_client.h" | #include "content/public/browser/content_browser_client.h" | ||||||
| #include "content/public/browser/render_view_host.h" | #include "content/public/browser/render_view_host.h" | ||||||
| #include "third_party/WebKit/public/platform/WebScreenInfo.h" | #include "third_party/WebKit/public/platform/WebScreenInfo.h" | ||||||
|  | #include "ui/gfx/size_conversions.h" | ||||||
| #include "webkit/common/cursors/webcursor.h" | #include "webkit/common/cursors/webcursor.h" | ||||||
|  |  | ||||||
| namespace { | namespace { | ||||||
| @@ -66,6 +66,12 @@ CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() { | |||||||
|  |  | ||||||
|  |  | ||||||
| // RenderWidgetHostView implementation. | // RenderWidgetHostView implementation. | ||||||
|  |  | ||||||
|  | gfx::Size CefRenderWidgetHostViewOSR::GetPhysicalBackingSize() const { | ||||||
|  |   return gfx::ToCeiledSize(gfx::ScaleSize(GetViewBounds().size(), | ||||||
|  |                                           GetDeviceScaleFactor())); | ||||||
|  | } | ||||||
|  |  | ||||||
| void CefRenderWidgetHostViewOSR::InitAsChild(gfx::NativeView parent_view) { | void CefRenderWidgetHostViewOSR::InitAsChild(gfx::NativeView parent_view) { | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -178,17 +184,23 @@ void CefRenderWidgetHostViewOSR::UpdateCursor(const WebCursor& cursor) { | |||||||
|   TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::UpdateCursor"); |   TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::UpdateCursor"); | ||||||
|   if (!browser_impl_.get()) |   if (!browser_impl_.get()) | ||||||
|     return; |     return; | ||||||
| #if defined(OS_WIN) | #if defined(USE_AURA) | ||||||
|   HMODULE hModule = ::GetModuleHandle( |  | ||||||
|       CefContentClient::Get()->browser()->GetResourceDllName()); |  | ||||||
|   if (!hModule) |  | ||||||
|     hModule = ::GetModuleHandle(NULL); |  | ||||||
|   WebCursor web_cursor = cursor; |   WebCursor web_cursor = cursor; | ||||||
|   HCURSOR hCursor = web_cursor.GetCursor((HINSTANCE)hModule); |  | ||||||
|  |   ui::PlatformCursor platform_cursor; | ||||||
|  |   if (web_cursor.IsCustom()) { | ||||||
|  |     // |web_cursor| owns the resulting |platform_cursor|. | ||||||
|  |     platform_cursor = web_cursor.GetPlatformCursor(); | ||||||
|  |   } else { | ||||||
|  |     WebCursor::CursorInfo cursor_info; | ||||||
|  |     cursor.GetCursorInfo(&cursor_info); | ||||||
|  |     platform_cursor = browser_impl_->GetPlatformCursor(cursor_info.type); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   browser_impl_->GetClient()->GetRenderHandler()->OnCursorChange( |   browser_impl_->GetClient()->GetRenderHandler()->OnCursorChange( | ||||||
|       browser_impl_->GetBrowser(), hCursor); |       browser_impl_->GetBrowser(), platform_cursor); | ||||||
| #elif defined(OS_MACOSX) || defined(TOOLKIT_GTK) | #elif defined(OS_MACOSX) || defined(TOOLKIT_GTK) | ||||||
|   // cursor is const, and GetNativeCursor is not |   // |web_cursor| owns the resulting |native_cursor|. | ||||||
|   WebCursor web_cursor = cursor; |   WebCursor web_cursor = cursor; | ||||||
|   CefCursorHandle native_cursor = web_cursor.GetNativeCursor(); |   CefCursorHandle native_cursor = web_cursor.GetNativeCursor(); | ||||||
|   browser_impl_->GetClient()->GetRenderHandler()->OnCursorChange( |   browser_impl_->GetClient()->GetRenderHandler()->OnCursorChange( | ||||||
| @@ -250,6 +262,12 @@ void CefRenderWidgetHostViewOSR::WillWmDestroy() { | |||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #if defined(OS_WIN) && defined(USE_AURA) | ||||||
|  | void CefRenderWidgetHostViewOSR::SetParentNativeViewAccessible( | ||||||
|  |     gfx::NativeViewAccessible accessible_parent) { | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
| void CefRenderWidgetHostViewOSR::GetScreenInfo(blink::WebScreenInfo* results) { | void CefRenderWidgetHostViewOSR::GetScreenInfo(blink::WebScreenInfo* results) { | ||||||
|   if (!browser_impl_.get()) |   if (!browser_impl_.get()) | ||||||
|     return; |     return; | ||||||
| @@ -641,7 +659,7 @@ void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() { | |||||||
|   // in the rwhv_aura (current_cursor_.SetScaleFactor) |   // in the rwhv_aura (current_cursor_.SetScaleFactor) | ||||||
| } | } | ||||||
|  |  | ||||||
| float CefRenderWidgetHostViewOSR::GetDeviceScaleFactor() { | float CefRenderWidgetHostViewOSR::GetDeviceScaleFactor() const { | ||||||
|   if (!browser_impl_.get()) |   if (!browser_impl_.get()) | ||||||
|     return kDefaultScaleFactor; |     return kDefaultScaleFactor; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -75,6 +75,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase { | |||||||
|  |  | ||||||
|  public: |  public: | ||||||
|   // RenderWidgetHostView methods. |   // RenderWidgetHostView methods. | ||||||
|  |   virtual gfx::Size GetPhysicalBackingSize() const OVERRIDE; | ||||||
|   virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |   virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | ||||||
|   virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; |   virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; | ||||||
|   virtual void SetSize(const gfx::Size& size) OVERRIDE; |   virtual void SetSize(const gfx::Size& size) OVERRIDE; | ||||||
| @@ -136,6 +137,10 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase { | |||||||
|       int error_code) OVERRIDE; |       int error_code) OVERRIDE; | ||||||
| #if defined(OS_WIN) && !defined(USE_AURA) | #if defined(OS_WIN) && !defined(USE_AURA) | ||||||
|   virtual void WillWmDestroy() OVERRIDE; |   virtual void WillWmDestroy() OVERRIDE; | ||||||
|  | #endif | ||||||
|  | #if defined(OS_WIN) && defined(USE_AURA) | ||||||
|  |   virtual void SetParentNativeViewAccessible( | ||||||
|  |       gfx::NativeViewAccessible accessible_parent) OVERRIDE; | ||||||
| #endif | #endif | ||||||
|   virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE; |   virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE; | ||||||
|   virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE; |   virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE; | ||||||
| @@ -202,7 +207,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase { | |||||||
|   bool InstallTransparency(); |   bool InstallTransparency(); | ||||||
|  |  | ||||||
|   void OnScreenInfoChanged(); |   void OnScreenInfoChanged(); | ||||||
|   float GetDeviceScaleFactor(); |   float GetDeviceScaleFactor() const; | ||||||
|  |  | ||||||
|   void CancelWidget(); |   void CancelWidget(); | ||||||
|   void NotifyShowWidget(); |   void NotifyShowWidget(); | ||||||
|   | |||||||
| @@ -14,6 +14,11 @@ patches = [ | |||||||
|   { |   { | ||||||
|     # Fix Xcode 4 build on OS X Lion. |     # Fix Xcode 4 build on OS X Lion. | ||||||
|     # http://codereview.chromium.org/8086022/ |     # http://codereview.chromium.org/8086022/ | ||||||
|  |     # | ||||||
|  |     # Set use_default_render_theme=0 to use native-styled scrollbars with aura. | ||||||
|  |     # Needs to be set here because setting the value in cef.gypi isn't picked up | ||||||
|  |     # by third_party/WebKit/Source/build/features.gypi. | ||||||
|  |     # https://code.google.com/p/chromiumembedded/issues/detail?id=180 | ||||||
|     'name': 'build', |     'name': 'build', | ||||||
|     'path': '../build/', |     'path': '../build/', | ||||||
|   }, |   }, | ||||||
| @@ -58,6 +63,18 @@ patches = [ | |||||||
|     'name': 'webplugin_win', |     'name': 'webplugin_win', | ||||||
|     'path': '../content/child/npapi/', |     'path': '../content/child/npapi/', | ||||||
|   }, |   }, | ||||||
|  |   { | ||||||
|  |     # Allow specification of a parent window handle for Widget creation. | ||||||
|  |     # https://code.google.com/p/chromiumembedded/issues/detail?id=180 | ||||||
|  |     'name': 'views_widget_180', | ||||||
|  |     'path': '../ui/views/widget/', | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     # Use native-styled scrollbars with aura on Windows. | ||||||
|  |     # https://code.google.com/p/chromiumembedded/issues/detail?id=180 | ||||||
|  |     'name': 'native_theme_180', | ||||||
|  |     'path': '../ui/native_theme/', | ||||||
|  |   }, | ||||||
|   { |   { | ||||||
|     # Disable scollbar bounce and overlay on OS X. |     # Disable scollbar bounce and overlay on OS X. | ||||||
|     # http://code.google.com/p/chromiumembedded/issues/detail?id=364 |     # http://code.google.com/p/chromiumembedded/issues/detail?id=364 | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| Index: common.gypi | Index: common.gypi | ||||||
| =================================================================== | =================================================================== | ||||||
| --- common.gypi	(revision 102269) | --- common.gypi	(revision 237081) | ||||||
| +++ common.gypi	(working copy) | +++ common.gypi	(working copy) | ||||||
| @@ -9,6 +9,9 @@ | @@ -9,6 +9,9 @@ | ||||||
|    # Variables expected to be overriden on the GYP command line (-D) or by |    # Variables expected to be overriden on the GYP command line (-D) or by | ||||||
| @@ -12,9 +12,18 @@ Index: common.gypi | |||||||
|      # Putting a variables dict inside another variables dict looks kind of |      # Putting a variables dict inside another variables dict looks kind of | ||||||
|      # weird.  This is done so that 'host_arch', 'chromeos', etc are defined as |      # weird.  This is done so that 'host_arch', 'chromeos', etc are defined as | ||||||
|      # variables within the outer variables dict here.  This is necessary |      # variables within the outer variables dict here.  This is necessary | ||||||
|  | @@ -186,7 +189,7 @@ | ||||||
|  |              'enable_app_list%': 0, | ||||||
|  |            }], | ||||||
|  |   | ||||||
|  | -          ['use_aura==1 or (OS!="win" and OS!="mac" and OS!="ios" and OS!="android")', { | ||||||
|  | +          ['OS!="win" and OS!="mac" and OS!="ios" and OS!="android"', { | ||||||
|  |              'use_default_render_theme%': 1, | ||||||
|  |            }, { | ||||||
|  |              'use_default_render_theme%': 0, | ||||||
| Index: mac/strip_save_dsym | Index: mac/strip_save_dsym | ||||||
| =================================================================== | =================================================================== | ||||||
| --- mac/strip_save_dsym	(revision 102269) | --- mac/strip_save_dsym	(revision 237081) | ||||||
| +++ mac/strip_save_dsym	(working copy) | +++ mac/strip_save_dsym	(working copy) | ||||||
| @@ -48,7 +48,7 @@ | @@ -48,7 +48,7 @@ | ||||||
|                   "bundle"] |                   "bundle"] | ||||||
|   | |||||||
							
								
								
									
										34
									
								
								patch/patches/native_theme_180.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								patch/patches/native_theme_180.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | |||||||
|  | Index: native_theme_aura.cc | ||||||
|  | =================================================================== | ||||||
|  | --- native_theme_aura.cc	(revision 237081) | ||||||
|  | +++ native_theme_aura.cc	(working copy) | ||||||
|  | @@ -17,10 +17,12 @@ | ||||||
|  |   | ||||||
|  |  namespace ui { | ||||||
|  |   | ||||||
|  | +#if !defined(OS_WIN) | ||||||
|  |  // static | ||||||
|  |  NativeTheme* NativeTheme::instance() { | ||||||
|  |    return NativeThemeAura::instance(); | ||||||
|  |  } | ||||||
|  | +#endif | ||||||
|  |   | ||||||
|  |  // static | ||||||
|  |  NativeThemeAura* NativeThemeAura::instance() { | ||||||
|  | Index: native_theme_win.cc | ||||||
|  | =================================================================== | ||||||
|  | --- native_theme_win.cc	(revision 237081) | ||||||
|  | +++ native_theme_win.cc	(working copy) | ||||||
|  | @@ -211,12 +211,10 @@ | ||||||
|  |  // TODO(sky): seems like we should default to NativeThemeWin, but that currently | ||||||
|  |  // breaks a couple of tests (FocusTraversalTest.NormalTraversal in | ||||||
|  |  // views_unittests). | ||||||
|  | -#if !defined(USE_AURA) | ||||||
|  |  // static | ||||||
|  |  NativeTheme* NativeTheme::instance() { | ||||||
|  |    return NativeThemeWin::instance(); | ||||||
|  |  } | ||||||
|  | -#endif | ||||||
|  |   | ||||||
|  |  // static | ||||||
|  |  NativeThemeWin* NativeThemeWin::instance() { | ||||||
							
								
								
									
										40
									
								
								patch/patches/views_widget_180.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								patch/patches/views_widget_180.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | |||||||
|  | Index: desktop_aura/desktop_root_window_host_win.cc | ||||||
|  | =================================================================== | ||||||
|  | --- desktop_aura/desktop_root_window_host_win.cc	(revision 237081) | ||||||
|  | +++ desktop_aura/desktop_root_window_host_win.cc	(working copy) | ||||||
|  | @@ -131,7 +131,9 @@ | ||||||
|  |                          native_widget_delegate_); | ||||||
|  |   | ||||||
|  |    HWND parent_hwnd = NULL; | ||||||
|  | -  if (params.parent && params.parent->GetDispatcher()) { | ||||||
|  | +  if (params.parent_widget) { | ||||||
|  | +    parent_hwnd = params.parent_widget; | ||||||
|  | +  } else if (params.parent && params.parent->GetDispatcher()) { | ||||||
|  |      parent_hwnd = | ||||||
|  |          params.parent->GetDispatcher()->host()->GetAcceleratedWidget(); | ||||||
|  |    } | ||||||
|  | Index: desktop_aura/desktop_screen_win.cc | ||||||
|  | =================================================================== | ||||||
|  | --- desktop_aura/desktop_screen_win.cc	(revision 237081) | ||||||
|  | +++ desktop_aura/desktop_screen_win.cc	(working copy) | ||||||
|  | @@ -54,6 +54,8 @@ | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  HWND DesktopScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const { | ||||||
|  | +  if (!window) | ||||||
|  | +    return NULL; | ||||||
|  |    aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); | ||||||
|  |    return dispatcher ? dispatcher->host()->GetAcceleratedWidget() : NULL; | ||||||
|  |  } | ||||||
|  | Index: widget.h | ||||||
|  | =================================================================== | ||||||
|  | --- widget.h	(revision 237081) | ||||||
|  | +++ widget.h	(working copy) | ||||||
|  | @@ -201,6 +201,7 @@ | ||||||
|  |      // Should the widget be double buffered? Default is false. | ||||||
|  |      bool double_buffer; | ||||||
|  |      gfx::NativeView parent; | ||||||
|  | +    gfx::AcceleratedWidget parent_widget; | ||||||
|  |      // Specifies the initial bounds of the Widget. Default is empty, which means | ||||||
|  |      // the NativeWidget may specify a default size. If the parent is specified, | ||||||
|  |      // |bounds| is in the parent's coordinate system. If the parent is not | ||||||
| @@ -26,6 +26,10 @@ import gyp | |||||||
| # Add paths so that pymod_do_main(...) can import files. | # Add paths so that pymod_do_main(...) can import files. | ||||||
| sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit')) | sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit')) | ||||||
| sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build')) | sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build')) | ||||||
|  | sys.path.insert(1, os.path.join(chrome_src, 'native_client', 'build')) | ||||||
|  | sys.path.insert(1, os.path.join(chrome_src, 'native_client_sdk', 'src', | ||||||
|  |     'build_tools')) | ||||||
|  | sys.path.insert(1, os.path.join(chrome_src, 'remoting', 'tools', 'build')) | ||||||
| sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'WebKit', | sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'WebKit', | ||||||
|     'Source', 'build', 'scripts')) |     'Source', 'build', 'scripts')) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user