diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-19 14:43:12 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-19 14:43:12 +0000 |
commit | 2fc6672f21decd142da98665de2a0330b2e0ac57 (patch) | |
tree | 52246ce158462b88cd4cc8cad667eb28a039e2b3 | |
parent | e8491289e4313d396ea9e1522209c1305d60a227 (diff) | |
download | chromium_src-2fc6672f21decd142da98665de2a0330b2e0ac57.zip chromium_src-2fc6672f21decd142da98665de2a0330b2e0ac57.tar.gz chromium_src-2fc6672f21decd142da98665de2a0330b2e0ac57.tar.bz2 |
Rename WidgetWin/Gtk -> NativeWidgetWin/Gtk.
BUG=72040
TEST=none
TBR=sky
Review URL: http://codereview.chromium.org/7039050
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85910 0039d316-1c4b-4281-b951-d872f2087c98
102 files changed, 727 insertions, 825 deletions
diff --git a/chrome/browser/accessibility/browser_accessibility_state.h b/chrome/browser/accessibility/browser_accessibility_state.h index 65d6b42..710f18a 100644 --- a/chrome/browser/accessibility/browser_accessibility_state.h +++ b/chrome/browser/accessibility/browser_accessibility_state.h @@ -20,7 +20,7 @@ template <typename T> struct DefaultSingletonTraits; // (1) On windows many screen reader detection mechinisms will give false // positives like relying on the SPI_GETSCREENREADER system parameter. In Chrome // we attempt to dynamically detect a MSAA client screen reader by calling -// NotifiyWinEvent in WidgetWin with a custom ID and wait to see if the ID +// NotifiyWinEvent in NativeWidgetWin with a custom ID and wait to see if the ID // is requested by a subsequent call to WM_GETOBJECT. // (2) On mac we detect dynamically if VoiceOver is running. We rely upon the // undocumented accessibility attribute @"AXEnhancedUserInterface" which is set diff --git a/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc b/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc index d3d29de3..8bf304e 100644 --- a/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc +++ b/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc @@ -21,7 +21,6 @@ #include "ui/base/l10n/l10n_util.h" #include "views/accessibility/native_view_accessibility_win.h" #include "views/widget/root_view.h" -#include "views/widget/widget_win.h" #include "views/window/window.h" namespace { diff --git a/chrome/browser/aeropeek_manager.cc b/chrome/browser/aeropeek_manager.cc index 55ba475..460e22e 100644 --- a/chrome/browser/aeropeek_manager.cc +++ b/chrome/browser/aeropeek_manager.cc @@ -37,7 +37,7 @@ #include "ui/base/win/window_impl.h" #include "ui/gfx/gdi_util.h" #include "ui/gfx/icon_util.h" -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" namespace { @@ -1017,7 +1017,7 @@ bool AeroPeekManager::Enabled() { // flooding users with tab thumbnails. const CommandLine* command_line = CommandLine::ForCurrentProcess(); return base::win::GetVersion() >= base::win::VERSION_WIN7 && - views::WidgetWin::IsAeroGlassEnabled() && + views::NativeWidgetWin::IsAeroGlassEnabled() && !command_line->HasSwitch(switches::kApp) && command_line->HasSwitch(switches::kEnableAeroPeekTabs); } diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc index 0a11a49..495a874 100644 --- a/chrome/browser/automation/automation_provider_win.cc +++ b/chrome/browser/automation/automation_provider_win.cc @@ -25,7 +25,6 @@ #include "ui/base/keycodes/keyboard_codes.h" #include "views/focus/accelerator_handler.h" #include "views/widget/root_view.h" -#include "views/widget/widget_win.h" #include "views/window/window.h" // This task just adds another task to the event queue. This is useful if diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 8d3bc37..6148e0c 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -191,7 +191,7 @@ #include "chrome/browser/ui/views/chrome_views_delegate.h" #include "views/focus/accelerator_handler.h" #if defined(TOOLKIT_USES_GTK) -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" #endif #endif @@ -1004,7 +1004,7 @@ void InitializeToolkit(const MainFunctionParams& parameters) { #if defined(TOOLKIT_USES_GTK) // TODO(beng): Move to WidgetImpl and implement on Windows too! if (parameters.command_line_.HasSwitch(switches::kDebugViewsPaint)) - views::WidgetGtk::EnableDebugPaint(); + views::NativeWidgetGtk::EnableDebugPaint(); #endif #endif diff --git a/chrome/browser/chromeos/login/helper.cc b/chrome/browser/chromeos/login/helper.cc index 7170401..442004b 100644 --- a/chrome/browser/chromeos/login/helper.cc +++ b/chrome/browser/chromeos/login/helper.cc @@ -23,7 +23,6 @@ #include "views/painter.h" #include "views/screen.h" #include "views/widget/widget.h" -#include "views/widget/widget_gtk.h" namespace chromeos { diff --git a/chrome/browser/chromeos/login/message_bubble.cc b/chrome/browser/chromeos/login/message_bubble.cc index 9b65786..428815b 100644 --- a/chrome/browser/chromeos/login/message_bubble.cc +++ b/chrome/browser/chromeos/login/message_bubble.cc @@ -149,7 +149,7 @@ void MessageBubble::IsActiveChanged() { void MessageBubble::SetMouseCapture() { if (grab_enabled_) - WidgetGtk::SetMouseCapture(); + NativeWidgetGtk::SetMouseCapture(); } void MessageBubble::Close() { @@ -159,7 +159,7 @@ void MessageBubble::Close() { gboolean MessageBubble::OnButtonPress(GtkWidget* widget, GdkEventButton* event) { - WidgetGtk::OnButtonPress(widget, event); + NativeWidgetGtk::OnButtonPress(widget, event); // Never propagate event to parent. return true; } diff --git a/chrome/browser/chromeos/login/message_bubble.h b/chrome/browser/chromeos/login/message_bubble.h index 55a0c08..3be9f64 100644 --- a/chrome/browser/chromeos/login/message_bubble.h +++ b/chrome/browser/chromeos/login/message_bubble.h @@ -12,7 +12,7 @@ #include "views/controls/button/button.h" #include "views/controls/link_listener.h" #include "views/view.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" class SkBitmap; @@ -45,7 +45,7 @@ class MessageBubble : public Bubble, MessageBubbleDelegate* delegate); // Create and show bubble which does not grab pointer. This creates - // a TYPE_CHILD WidgetGtk and |position_relative_to| must be in parent's + // a TYPE_CHILD NativeWidgetGtk and |position_relative_to| must be in parent's // coordinates. static MessageBubble* ShowNoGrab(views::Widget* parent, const gfx::Rect& position_relative_to, @@ -55,7 +55,7 @@ class MessageBubble : public Bubble, const std::wstring& help, MessageBubbleDelegate* delegate); - // Overridden from WidgetGtk. + // Overridden from NativeWidgetGtk. virtual void Close() OVERRIDE; virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event); @@ -68,7 +68,7 @@ class MessageBubble : public Bubble, // Overridden from views::LinkListener: virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; - // Overridden from WidgetGtk. + // Overridden from NativeWidgetGtk. virtual void IsActiveChanged(); virtual void SetMouseCapture(); diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc index c4f0836..27648df 100644 --- a/chrome/browser/chromeos/login/screen_locker.cc +++ b/chrome/browser/chromeos/login/screen_locker.cc @@ -54,7 +54,7 @@ #include "ui/base/x/x11_util.h" #include "views/screen.h" #include "views/widget/root_view.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" namespace { @@ -196,10 +196,10 @@ static base::LazyInstance<ScreenLockObserver> g_screen_lock_observer( // A ScreenLock window that covers entire screen to keep the keyboard // focus/events inside the grab widget. -class LockWindow : public views::WidgetGtk { +class LockWindow : public views::NativeWidgetGtk { public: LockWindow() - : views::WidgetGtk(new views::Widget), + : views::NativeWidgetGtk(new views::Widget), toplevel_focus_widget_(NULL) { EnableDoubleBuffer(true); } @@ -220,7 +220,7 @@ class LockWindow : public views::WidgetGtk { virtual void OnDestroy(GtkWidget* object) OVERRIDE { VLOG(1) << "OnDestroy: LockWindow destroyed"; - views::WidgetGtk::OnDestroy(object); + views::NativeWidgetGtk::OnDestroy(object); } virtual void ClearNativeFocus() OVERRIDE { @@ -288,10 +288,10 @@ class GrabWidgetRootView }; // A child widget that grabs both keyboard and pointer input. -class GrabWidget : public views::WidgetGtk { +class GrabWidget : public views::NativeWidgetGtk { public: explicit GrabWidget(chromeos::ScreenLocker* screen_locker) - : views::WidgetGtk(new views::Widget), + : views::NativeWidgetGtk(new views::Widget), screen_locker_(screen_locker), ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), grab_failure_count_(0), @@ -302,7 +302,7 @@ class GrabWidget : public views::WidgetGtk { } virtual void Show() OVERRIDE { - views::WidgetGtk::Show(); + views::NativeWidgetGtk::Show(); signout_link_ = screen_locker_->GetViewByID(VIEW_ID_SCREEN_LOCKER_SIGNOUT_LINK); shutdown_ = screen_locker_->GetViewByID(VIEW_ID_SCREEN_LOCKER_SHUTDOWN); @@ -328,7 +328,7 @@ class GrabWidget : public views::WidgetGtk { views::KeyEvent key_event(reinterpret_cast<GdkEvent*>(event)); // This is a hack to workaround the issue crosbug.com/10655 due to // the limitation that a focus manager cannot handle views in - // TYPE_CHILD WidgetGtk correctly. + // TYPE_CHILD NativeWidgetGtk correctly. if (signout_link_ && event->type == GDK_KEY_PRESS && (event->keyval == GDK_Tab || @@ -345,12 +345,12 @@ class GrabWidget : public views::WidgetGtk { return true; } } - return views::WidgetGtk::OnEventKey(widget, event); + return views::NativeWidgetGtk::OnEventKey(widget, event); } virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event) OVERRIDE { - WidgetGtk::OnButtonPress(widget, event); + NativeWidgetGtk::OnButtonPress(widget, event); // Never propagate event to parent. return true; } @@ -812,7 +812,7 @@ void ScreenLocker::Init() { g_object_unref(window_group); lock_window->set_toplevel_focus_widget( - static_cast<views::WidgetGtk*>(lock_widget_->native_widget())-> + static_cast<views::NativeWidgetGtk*>(lock_widget_->native_widget())-> window_contents()); // Create the SystemKeyEventListener so it can listen for system keyboard diff --git a/chrome/browser/chromeos/login/screen_locker_tester.cc b/chrome/browser/chromeos/login/screen_locker_tester.cc index 209f7db..81b41b5 100644 --- a/chrome/browser/chromeos/login/screen_locker_tester.cc +++ b/chrome/browser/chromeos/login/screen_locker_tester.cc @@ -16,7 +16,6 @@ #include "views/controls/textfield/textfield.h" #include "views/events/event.h" #include "views/widget/root_view.h" -#include "views/widget/widget_gtk.h" namespace chromeos { diff --git a/chrome/browser/chromeos/login/user_controller_gtk.cc b/chrome/browser/chromeos/login/user_controller_gtk.cc index 2edef3e..17b6a90 100644 --- a/chrome/browser/chromeos/login/user_controller_gtk.cc +++ b/chrome/browser/chromeos/login/user_controller_gtk.cc @@ -4,21 +4,21 @@ #include "chrome/browser/chromeos/login/user_controller.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" -using views::WidgetGtk; +using views::NativeWidgetGtk; namespace chromeos { namespace { -class ControlsWidget : public WidgetGtk { +class ControlsWidget : public NativeWidgetGtk { public: - ControlsWidget() : WidgetGtk(new views::Widget) { + ControlsWidget() : NativeWidgetGtk(new views::Widget) { } private: - // WidgetGtk overrides: + // NativeWidgetGtk overrides: virtual void OnMap(GtkWidget* widget) OVERRIDE { // For some reason, Controls window never gets first expose event, // which makes WM believe that the login screen is not ready. @@ -35,10 +35,10 @@ class ControlsWidget : public WidgetGtk { // Widget that notifies window manager about clicking on itself. // Doesn't send anything if user is selected. -class ClickNotifyingWidget : public WidgetGtk { +class ClickNotifyingWidget : public NativeWidgetGtk { public: explicit ClickNotifyingWidget(UserController* controller) - : WidgetGtk(new views::Widget), + : NativeWidgetGtk(new views::Widget), controller_(controller) { } @@ -47,7 +47,7 @@ class ClickNotifyingWidget : public WidgetGtk { if (!controller_->IsUserSelected()) controller_->SelectUserRelative(0); - return WidgetGtk::OnButtonPress(widget, event); + return NativeWidgetGtk::OnButtonPress(widget, event); } UserController* controller_; diff --git a/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc b/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc index 3e3e18e..bd573dd 100644 --- a/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc +++ b/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc @@ -37,9 +37,9 @@ void WizardInProcessBrowserTest::CleanUpOnMainThread() { MessageLoopForUI::current()->DeleteSoon(FROM_HERE, host_); // Observers and what not are notified after the views are deleted, which - // happens after a delay (because they are contained in a WidgetGtk which - // delays deleting itself). Run the message loop until we know the wizard - // has been deleted. + // happens after a delay (because they are contained in a NativeWidgetGtk + // which delays deleting itself). Run the message loop until we know the + // wizard has been deleted. ui_test_utils::WaitForNotification( NotificationType::WIZARD_CONTENT_VIEW_DESTROYED); } diff --git a/chrome/browser/chromeos/notifications/notification_panel.cc b/chrome/browser/chromeos/notifications/notification_panel.cc index 9902529..b2e9c2b 100644 --- a/chrome/browser/chromeos/notifications/notification_panel.cc +++ b/chrome/browser/chromeos/notifications/notification_panel.cc @@ -21,7 +21,7 @@ #include "views/controls/native/native_view_host.h" #include "views/controls/scroll_view.h" #include "views/widget/root_view.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" #define SET_STATE(state) SetState(state, __PRETTY_FUNCTION__) @@ -486,7 +486,7 @@ void NotificationPanel::Hide() { MessageLoop::current()->DeleteSoon(FROM_HERE, panel_controller_.release()); // We need to remove & detach the scroll view from hierarchy to // avoid GTK deleting child. - // TODO(oshima): handle this details in WidgetGtk. + // TODO(oshima): handle this details in NativeWidgetGtk. panel_widget_->GetRootView()->RemoveChildView(scroll_view_.get()); panel_widget_->Close(); panel_widget_ = NULL; diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 326d831..ea5bec3 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -66,7 +66,7 @@ #if defined(TOOLKIT_USES_GTK) #if defined(TOOLKIT_VIEWS) #include "ui/base/dragdrop/drag_drop_types.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" #elif defined(TOOLKIT_GTK) #include "chrome/browser/ui/gtk/custom_drag.h" #include "chrome/browser/ui/gtk/unity_service.h" @@ -609,7 +609,7 @@ void DragDownload(const DownloadItem* download, if (!root) return; - views::WidgetGtk* widget = static_cast<views::WidgetGtk*>( + views::NativeWidgetGtk* widget = static_cast<views::NativeWidgetGtk*>( views::NativeWidget::GetNativeWidgetForNativeView(root)); if (!widget) return; diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 622cc7f..8111d18 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -89,7 +89,7 @@ base::LazyInstance<ExternalTabContainer::PendingTabs> ExternalTabContainer::ExternalTabContainer( AutomationProvider* automation, AutomationResourceMessageFilter* filter) - : views::WidgetWin(new views::Widget), + : views::NativeWidgetWin(new views::Widget), automation_(automation), tab_contents_container_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(tab_contents_registrar_(this)), @@ -807,10 +807,10 @@ void ExternalTabContainer::OnStartDownload(DownloadItem* download, //////////////////////////////////////////////////////////////////////////////// -// ExternalTabContainer, views::WidgetWin overrides: +// ExternalTabContainer, views::NativeWidgetWin overrides: LRESULT ExternalTabContainer::OnCreate(LPCREATESTRUCT create_struct) { - LRESULT result = views::WidgetWin::OnCreate(create_struct); + LRESULT result = views::NativeWidgetWin::OnCreate(create_struct); if (result == 0) { // Grab a reference here which will be released in OnFinalMessage AddRef(); @@ -821,7 +821,7 @@ LRESULT ExternalTabContainer::OnCreate(LPCREATESTRUCT create_struct) { void ExternalTabContainer::OnDestroy() { prop_.reset(); Uninitialize(); - WidgetWin::OnDestroy(); + NativeWidgetWin::OnDestroy(); if (browser_.get()) { ::DestroyWindow(browser_->window()->GetNativeHandle()); } diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h index 6750081..163b1f1 100644 --- a/chrome/browser/external_tab_container_win.h +++ b/chrome/browser/external_tab_container_win.h @@ -24,7 +24,7 @@ #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "views/accelerator.h" -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" class AutomationProvider; class Browser; @@ -46,7 +46,7 @@ class ExternalTabContainer : public TabContentsDelegate, public TabContentsObserver, public DownloadTabHelperDelegate, public NotificationObserver, - public views::WidgetWin, + public views::NativeWidgetWin, public base::RefCounted<ExternalTabContainer>, public views::AcceleratorTarget, public InfoBarContainer::Delegate, @@ -191,7 +191,7 @@ class ExternalTabContainer : public TabContentsDelegate, // Returns NULL if we fail to find the cookie in the map. static scoped_refptr<ExternalTabContainer> RemovePendingTab(uintptr_t cookie); - // Overridden from views::WidgetWin: + // Overridden from views::NativeWidgetWin: virtual views::Window* GetContainingWindow() OVERRIDE; virtual const views::Window* GetContainingWindow() const OVERRIDE; @@ -221,7 +221,7 @@ class ExternalTabContainer : public TabContentsDelegate, protected: ~ExternalTabContainer(); - // Overridden from views::WidgetWin: + // Overridden from views::NativeWidgetWin: virtual LRESULT OnCreate(LPCREATESTRUCT create_struct); virtual void OnDestroy(); virtual void OnFinalMessage(HWND window); diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.cc b/chrome/browser/renderer_host/render_widget_host_view_views.cc index c1c08b3..45182ae 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_views.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_views.cc @@ -32,7 +32,7 @@ #include "views/ime/input_method.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" static const int kMaxWindowWidth = 4000; static const int kMaxWindowHeight = 4000; @@ -436,11 +436,11 @@ gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() { gfx::NativeView RenderWidgetHostViewViews::GetInnerNativeView() const { // TODO(sad): Ideally this function should be equivalent to GetNativeView, and - // WidgetGtk-specific function call should not be necessary. + // NativeWidgetGtk-specific function call should not be necessary. const views::Widget* widget = GetWidget(); const views::NativeWidget* native = widget ? widget->native_widget() : NULL; - return native ? - static_cast<const views::WidgetGtk*>(native)->window_contents() : NULL; + return native ? static_cast<const views::NativeWidgetGtk*>(native)-> + window_contents() : NULL; } std::string RenderWidgetHostViewViews::GetClassName() const { diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index 320880f..171748f 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -50,7 +50,7 @@ #include "views/focus/focus_manager.h" #include "views/focus/focus_util_win.h" // Included for views::kReflectedMessage - TODO(beng): move this to win_util.h! -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" #include "webkit/glue/webaccessibility.h" #include "webkit/glue/webcursor.h" #include "webkit/plugins/npapi/plugin_constants_win.h" diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index 361bf6e..196aacb 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc @@ -21,7 +21,7 @@ #include "ui/base/resource/resource_bundle.h" #if defined(OS_WIN) -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" #endif // Strings used in alignment properties. @@ -271,7 +271,7 @@ bool ThemeService::ShouldUseNativeFrame() const { if (HasCustomImage(IDR_THEME_FRAME)) return false; #if defined(OS_WIN) - return views::WidgetWin::IsAeroGlassEnabled(); + return views::NativeWidgetWin::IsAeroGlassEnabled(); #else return false; #endif diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc index 5ae9cc8..35a03bb 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc @@ -39,7 +39,7 @@ #include <objidl.h> #include "base/win/scoped_gdi_object.h" -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" #endif #if defined(TOOLKIT_USES_GTK) @@ -606,7 +606,7 @@ void AutocompletePopupContentsView::MakeContentsPath( void AutocompletePopupContentsView::UpdateBlurRegion() { #if defined(OS_WIN) // We only support background blurring on Vista with Aero-Glass enabled. - if (!views::WidgetWin::IsAeroGlassEnabled() || !GetWidget()) + if (!views::NativeWidgetWin::IsAeroGlassEnabled() || !GetWidget()) return; // Provide a blurred background effect within the contents region of the diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc index 912a5b9..e33ebe1 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc @@ -378,8 +378,8 @@ void BookmarkBubbleView::ShowEditor() { HWND parent = GetAncestor(GetWidget()->GetNativeView(), GA_ROOTOWNER); // We're about to show the bookmark editor. When the bookmark editor closes - // we want the browser to become active. WidgetWin::Hide() does a hide in - // a such way that activation isn't changed, which means when we close + // we want the browser to become active. NativeWidgetWin::Hide() does a hide + // in a such way that activation isn't changed, which means when we close // Windows gets confused as to who it should give active status to. We // explicitly hide the bookmark bubble window in such a way that activation // status changes. That way, when the editor closes, activation is properly @@ -387,7 +387,7 @@ void BookmarkBubbleView::ShowEditor() { ShowWindow(GetWidget()->GetNativeView(), SW_HIDE); #elif defined(TOOLKIT_USES_GTK) gfx::NativeWindow parent = GTK_WINDOW( - static_cast<views::WidgetGtk*>(GetWidget()->native_widget())-> + static_cast<views::NativeWidgetGtk*>(GetWidget()->native_widget())-> GetTransientParent()); #endif diff --git a/chrome/browser/ui/views/browser_bubble_gtk.cc b/chrome/browser/ui/views/browser_bubble_gtk.cc index 4339e05..37d7c9d 100644 --- a/chrome/browser/ui/views/browser_bubble_gtk.cc +++ b/chrome/browser/ui/views/browser_bubble_gtk.cc @@ -9,7 +9,7 @@ #include "chrome/browser/ui/views/bubble/border_contents.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "views/widget/root_view.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/wm_ipc.h" @@ -20,10 +20,10 @@ using std::vector; namespace { -class BubbleWidget : public views::WidgetGtk { +class BubbleWidget : public views::NativeWidgetGtk { public: BubbleWidget(BrowserBubble* bubble, const gfx::Insets& content_margins) - : views::WidgetGtk(new views::Widget), + : views::NativeWidgetGtk(new views::Widget), bubble_(bubble), border_contents_(new BorderContents) { border_contents_->Init(); @@ -32,7 +32,7 @@ class BubbleWidget : public views::WidgetGtk { void ShowAndActivate(bool activate) { // TODO: honor activate. - views::WidgetGtk::Show(); + views::NativeWidgetGtk::Show(); } virtual void Close() { @@ -43,7 +43,7 @@ class BubbleWidget : public views::WidgetGtk { if (delegate) delegate->BubbleLostFocus(bubble_, false); } - views::WidgetGtk::Close(); + views::NativeWidgetGtk::Close(); bubble_ = NULL; } @@ -53,7 +53,7 @@ class BubbleWidget : public views::WidgetGtk { if (delegate) delegate->BubbleLostFocus(bubble_, false); } - views::WidgetGtk::Hide(); + views::NativeWidgetGtk::Hide(); } virtual void IsActiveChanged() { @@ -75,7 +75,7 @@ class BubbleWidget : public views::WidgetGtk { virtual gboolean OnFocusIn(GtkWidget* widget, GdkEventFocus* event) { if (bubble_ && bubble_->delegate()) bubble_->delegate()->BubbleGotFocus(bubble_); - return views::WidgetGtk::OnFocusIn(widget, event); + return views::NativeWidgetGtk::OnFocusIn(widget, event); } BorderContents* border_contents() { diff --git a/chrome/browser/ui/views/browser_bubble_win.cc b/chrome/browser/ui/views/browser_bubble_win.cc index ce4b66c..3696019 100644 --- a/chrome/browser/ui/views/browser_bubble_win.cc +++ b/chrome/browser/ui/views/browser_bubble_win.cc @@ -8,13 +8,13 @@ #include "chrome/browser/ui/views/bubble/border_widget_win.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "views/widget/root_view.h" -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" #include "views/window/window.h" -class BubbleWidget : public views::WidgetWin { +class BubbleWidget : public views::NativeWidgetWin { public: explicit BubbleWidget(BrowserBubble* bubble) - : views::WidgetWin(new views::Widget), + : views::NativeWidgetWin(new views::Widget), bubble_(bubble), border_widget_(new BorderWidgetWin) { set_window_style(WS_POPUP | WS_CLIPCHILDREN); @@ -27,7 +27,7 @@ class BubbleWidget : public views::WidgetWin { if (activate) ShowWindow(SW_SHOW); else - views::WidgetWin::Show(); + views::NativeWidgetWin::Show(); } void Close() { @@ -39,7 +39,7 @@ class BubbleWidget : public views::WidgetWin { delegate->BubbleLostFocus(bubble_, NULL); } border_widget_->Close(); - views::WidgetWin::Close(); + views::NativeWidgetWin::Close(); bubble_ = NULL; } @@ -49,12 +49,12 @@ class BubbleWidget : public views::WidgetWin { if (delegate) delegate->BubbleLostFocus(bubble_, NULL); } - views::WidgetWin::Hide(); + views::NativeWidgetWin::Hide(); border_widget_->Hide(); } void OnActivate(UINT action, BOOL minimized, HWND window) { - WidgetWin::OnActivate(action, minimized, window); + NativeWidgetWin::OnActivate(action, minimized, window); if (!bubble_) return; @@ -90,7 +90,7 @@ class BubbleWidget : public views::WidgetWin { } virtual void OnSetFocus(HWND focused_window) { - WidgetWin::OnSetFocus(focused_window); + NativeWidgetWin::OnSetFocus(focused_window); if (bubble_ && bubble_->delegate()) bubble_->delegate()->BubbleGotFocus(bubble_); } @@ -107,8 +107,8 @@ class BubbleWidget : public views::WidgetWin { }; void BrowserBubble::InitPopup(const gfx::Insets& content_margins) { - // popup_ is a Widget, but we need to do some WidgetWin stuff first, then - // we'll assign it into popup_. + // popup_ is a Widget, but we need to do some NativeWidgetWin stuff first, + // then we'll assign it into popup_. BubbleWidget* bubble_widget = new BubbleWidget(this); BorderWidgetWin* border_widget = bubble_widget->border_widget(); diff --git a/chrome/browser/ui/views/bubble/border_widget_win.h b/chrome/browser/ui/views/bubble/border_widget_win.h index a6f9256..cbdddcc 100644 --- a/chrome/browser/ui/views/bubble/border_widget_win.h +++ b/chrome/browser/ui/views/bubble/border_widget_win.h @@ -7,7 +7,7 @@ #pragma once #include "chrome/browser/ui/views/bubble/bubble_border.h" -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" class BorderContents; @@ -16,7 +16,7 @@ class BorderContents; // we can use >1-bit alpha shadow images on the borders, which look nicer than // the Windows CS_DROPSHADOW shadows. The info bubble window itself cannot be a // layered window because that prevents it from hosting native child controls. -class BorderWidgetWin : public views::WidgetWin { +class BorderWidgetWin : public views::NativeWidgetWin { public: BorderWidgetWin(); virtual ~BorderWidgetWin() { } @@ -41,7 +41,7 @@ class BorderWidgetWin : public views::WidgetWin { BorderContents* border_contents_; private: - // Overridden from WidgetWin: + // Overridden from NativeWidgetWin: virtual LRESULT OnMouseActivate(UINT message, WPARAM w_param, LPARAM l_param) OVERRIDE; diff --git a/chrome/browser/ui/views/bubble/bubble.cc b/chrome/browser/ui/views/bubble/bubble.cc index b19cbcb..b8fc390 100644 --- a/chrome/browser/ui/views/bubble/bubble.cc +++ b/chrome/browser/ui/views/bubble/bubble.cc @@ -122,9 +122,9 @@ void Bubble::AnimationProgressed(const ui::Animation* animation) { Bubble::Bubble() : #if defined(OS_WIN) - views::WidgetWin(new views::Widget), + views::NativeWidgetWin(new views::Widget), #elif defined(TOOLKIT_USES_GTK) - views::WidgetGtk(new views::Widget), + views::NativeWidgetGtk(new views::Widget), #endif #if defined(TOOLKIT_USES_GTK) border_contents_(NULL), @@ -147,7 +147,7 @@ Bubble::Bubble() #if defined(OS_CHROMEOS) Bubble::Bubble(views::Widget::InitParams::Type type, bool show_while_screen_is_locked) - : views::WidgetGtk(new views::Widget), + : views::NativeWidgetGtk(new views::Widget), border_contents_(NULL), delegate_(NULL), show_status_(kOpen), @@ -345,9 +345,9 @@ void Bubble::DoClose(bool closed_by_escape) { border_->Close(); #endif #if defined(OS_WIN) - WidgetWin::Close(); + NativeWidgetWin::Close(); #elif defined(TOOLKIT_USES_GTK) - WidgetGtk::Close(); + NativeWidgetGtk::Close(); #endif } diff --git a/chrome/browser/ui/views/bubble/bubble.h b/chrome/browser/ui/views/bubble/bubble.h index 72736e3..0c9e587 100644 --- a/chrome/browser/ui/views/bubble/bubble.h +++ b/chrome/browser/ui/views/bubble/bubble.h @@ -12,9 +12,9 @@ #include "views/view.h" #if defined(OS_WIN) -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" #elif defined(TOOLKIT_USES_GTK) -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" #endif // Bubble is used to display an arbitrary view above all other windows. @@ -71,9 +71,9 @@ class BubbleDelegate { // That way Bubble has no (or very few) ifdefs. class Bubble #if defined(OS_WIN) - : public views::WidgetWin, + : public views::NativeWidgetWin, #elif defined(TOOLKIT_USES_GTK) - : public views::WidgetGtk, + : public views::NativeWidgetGtk, #endif public views::AcceleratorTarget, public ui::AnimationDelegate { @@ -123,7 +123,7 @@ class Bubble fade_away_on_close_ = fade_away_on_close; } - // Overridden from WidgetWin: + // Overridden from NativeWidgetWin: virtual void Close(); // Overridden from ui::AnimationDelegate: @@ -152,10 +152,10 @@ class Bubble virtual BorderContents* CreateBorderContents(); #if defined(OS_WIN) - // Overridden from WidgetWin: + // Overridden from NativeWidgetWin: virtual void OnActivate(UINT action, BOOL minimized, HWND window); #elif defined(TOOLKIT_USES_GTK) - // Overridden from WidgetGtk: + // Overridden from NativeWidgetGtk: virtual void IsActiveChanged(); #endif diff --git a/chrome/browser/ui/views/collected_cookies_win.cc b/chrome/browser/ui/views/collected_cookies_win.cc index 390c257..9c9b79c 100644 --- a/chrome/browser/ui/views/collected_cookies_win.cc +++ b/chrome/browser/ui/views/collected_cookies_win.cc @@ -28,7 +28,6 @@ #include "views/layout/grid_layout.h" #include "views/layout/layout_constants.h" #include "views/widget/root_view.h" -#include "views/widget/widget_win.h" #include "views/window/window.h" namespace browser { @@ -480,9 +479,9 @@ void CollectedCookiesWin::AddContentException(views::TreeView* tree_view, tab_contents_->profile()->GetHostContentSettingsMap(), setting); infobar_->UpdateVisibility(true, setting, origin_node->GetTitle()); gfx::Rect bounds = GetWidget()->GetClientAreaScreenBounds(); - // WidgetWin::GetBounds returns the bounds relative to the parent window, - // while WidgetWin::SetBounds wants screen coordinates. Do the translation - // here until http://crbug.com/52851 is fixed. + // NativeWidgetWin::GetBounds returns the bounds relative to the parent + // window, while NativeWidgetWin::SetBounds wants screen coordinates. Do the + // translation here until http://crbug.com/52851 is fixed. POINT topleft = {bounds.x(), bounds.y()}; MapWindowPoints(HWND_DESKTOP, tab_contents_->GetNativeView(), &topleft, 1); gfx::Size size = GetRootView()->GetPreferredSize(); diff --git a/chrome/browser/ui/views/constrained_html_delegate_gtk.cc b/chrome/browser/ui/views/constrained_html_delegate_gtk.cc index c39a093..cc0588b 100644 --- a/chrome/browser/ui/views/constrained_html_delegate_gtk.cc +++ b/chrome/browser/ui/views/constrained_html_delegate_gtk.cc @@ -12,11 +12,11 @@ #include "chrome/browser/ui/webui/html_dialog_ui.h" #include "content/browser/tab_contents/tab_contents.h" #include "ui/gfx/rect.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" // ConstrainedHtmlDelegateGtk works with ConstrainedWindowGtk to present // a TabContents in a ContraintedHtmlUI. -class ConstrainedHtmlDelegateGtk : public views::WidgetGtk, +class ConstrainedHtmlDelegateGtk : public views::NativeWidgetGtk, public ConstrainedHtmlUIDelegate, public ConstrainedWindowDelegate, public HtmlDialogTabContentsDelegate { @@ -70,7 +70,7 @@ class ConstrainedHtmlDelegateGtk : public views::WidgetGtk, ConstrainedHtmlDelegateGtk::ConstrainedHtmlDelegateGtk( Profile* profile, HtmlDialogUIDelegate* delegate) - : views::WidgetGtk(new views::Widget), + : views::NativeWidgetGtk(new views::Widget), HtmlDialogTabContentsDelegate(profile), html_tab_contents_(profile, NULL, MSG_ROUTING_NONE, NULL, NULL), tab_container_(NULL), diff --git a/chrome/browser/ui/views/constrained_html_delegate_win.cc b/chrome/browser/ui/views/constrained_html_delegate_win.cc index 8d4e34c..0f4ab34 100644 --- a/chrome/browser/ui/views/constrained_html_delegate_win.cc +++ b/chrome/browser/ui/views/constrained_html_delegate_win.cc @@ -11,7 +11,6 @@ #include "content/browser/tab_contents/tab_contents.h" #include "ui/gfx/rect.h" #include "views/view.h" -#include "views/widget/widget_win.h" #include "views/window/window_delegate.h" class ConstrainedHtmlDelegateWin : public TabContentsContainer, diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc index 63e5c09..01d2be5 100644 --- a/chrome/browser/ui/views/constrained_window_views.cc +++ b/chrome/browser/ui/views/constrained_window_views.cc @@ -36,7 +36,7 @@ #include "views/window/window.h" #if defined(OS_WIN) -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" #include "views/window/window_win.h" #endif @@ -207,7 +207,7 @@ class ConstrainedWindowFrameView SkColor GetTitleColor() const { return container_->owner()->profile()->IsOffTheRecord() #if defined(OS_WIN) - || !views::WidgetWin::IsAeroGlassEnabled() + || !views::NativeWidgetWin::IsAeroGlassEnabled() #endif ? SK_ColorWHITE : SK_ColorBLACK; } @@ -546,7 +546,7 @@ gfx::Rect ConstrainedWindowFrameView::CalculateClientAreaBounds( } void ConstrainedWindowFrameView::InitWindowResources() { - resources_.reset(views::WidgetWin::IsAeroGlassEnabled() ? + resources_.reset(views::NativeWidgetWin::IsAeroGlassEnabled() ? static_cast<views::WindowResources*>(new VistaWindowResources) : new XPWindowResources); } diff --git a/chrome/browser/ui/views/dropdown_bar_host_win.cc b/chrome/browser/ui/views/dropdown_bar_host_win.cc index 74190fd..92d3ad1 100644 --- a/chrome/browser/ui/views/dropdown_bar_host_win.cc +++ b/chrome/browser/ui/views/dropdown_bar_host_win.cc @@ -11,7 +11,6 @@ #include "content/browser/tab_contents/tab_contents_view.h" #include "ui/base/keycodes/keyboard_code_conversion_win.h" #include "views/controls/scrollbar/native_scroll_bar.h" -#include "views/widget/widget_win.h" NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent( const TabContents* contents, diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc index 723b4d6..12f65fe 100644 --- a/chrome/browser/ui/views/extensions/extension_popup.cc +++ b/chrome/browser/ui/views/extensions/extension_popup.cc @@ -23,10 +23,6 @@ #include "views/widget/root_view.h" #include "views/window/window.h" -#if defined(TOOLKIT_USES_GTK) -#include "views/widget/widget_gtk.h" -#endif - #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/wm_ipc.h" #include "third_party/cros/chromeos_wm_ipc_enums.h" diff --git a/chrome/browser/ui/views/find_bar_host_gtk.cc b/chrome/browser/ui/views/find_bar_host_gtk.cc index 4a7cb04..87d3f44 100644 --- a/chrome/browser/ui/views/find_bar_host_gtk.cc +++ b/chrome/browser/ui/views/find_bar_host_gtk.cc @@ -9,7 +9,6 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" -#include "views/widget/widget_gtk.h" void FindBarHost::AudibleAlert() { // TODO(davemoore) implement. diff --git a/chrome/browser/ui/views/find_bar_host_win.cc b/chrome/browser/ui/views/find_bar_host_win.cc index f30702c..c542f37 100644 --- a/chrome/browser/ui/views/find_bar_host_win.cc +++ b/chrome/browser/ui/views/find_bar_host_win.cc @@ -11,7 +11,7 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "views/controls/scrollbar/native_scroll_bar.h" -#include "views/widget/widget_win.h" +#include "views/widget/widget.h" void FindBarHost::AudibleAlert() { MessageBeep(MB_OK); @@ -19,9 +19,7 @@ void FindBarHost::AudibleAlert() { void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { RECT frame_rect = {0}, webcontents_rect = {0}; - ::GetWindowRect( - static_cast<views::WidgetWin*>(host()->native_widget())->GetParent(), - &frame_rect); + ::GetWindowRect(::GetParent(host()->GetNativeView()), &frame_rect); ::GetWindowRect( find_bar_controller_-> tab_contents()->tab_contents()->view()->GetNativeView(), diff --git a/chrome/browser/ui/views/first_run_bubble.cc b/chrome/browser/ui/views/first_run_bubble.cc index 2e0a390..d1965de 100644 --- a/chrome/browser/ui/views/first_run_bubble.cc +++ b/chrome/browser/ui/views/first_run_bubble.cc @@ -24,7 +24,7 @@ #include "views/events/event.h" #include "views/focus/focus_manager.h" #include "views/layout/layout_constants.h" -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" #include "views/window/window.h" namespace { @@ -357,7 +357,7 @@ gfx::Size FirstRunOEMBubbleView::GetPreferredSize() { // now, we force Vista to show a correctly-sized box by taking account of // the difference in font size calculation. The coefficient should not be // stored in a variable because it's a hack and should go away. - if (views::WidgetWin::IsAeroGlassEnabled()) { + if (views::NativeWidgetWin::IsAeroGlassEnabled()) { size.set_width(static_cast<int>(size.width() * 0.85)); size.set_height(static_cast<int>(size.height() * 0.85)); } diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble.cc b/chrome/browser/ui/views/fullscreen_exit_bubble.cc index 1c18697..62143d0 100644 --- a/chrome/browser/ui/views/fullscreen_exit_bubble.cc +++ b/chrome/browser/ui/views/fullscreen_exit_bubble.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ui/views/fullscreen_exit_bubble.h" +#include "base/message_loop.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "grit/generated_resources.h" @@ -19,9 +20,6 @@ #if defined(OS_WIN) #include "ui/base/l10n/l10n_util_win.h" -#include "views/widget/widget_win.h" -#elif defined(TOOLKIT_USES_GTK) -#include "views/widget/widget_gtk.h" #endif // FullscreenExitView ---------------------------------------------------------- diff --git a/chrome/browser/ui/views/generic_info_view_unittest.cc b/chrome/browser/ui/views/generic_info_view_unittest.cc index 5fe6dc2..7274970 100644 --- a/chrome/browser/ui/views/generic_info_view_unittest.cc +++ b/chrome/browser/ui/views/generic_info_view_unittest.cc @@ -13,10 +13,6 @@ #include "views/widget/root_view.h" #include "views/window/window.h" -#if defined(OS_WIN) -#include "views/widget/widget_win.h" -#endif - // This class is only used on windows for now. #if defined(OS_WIN) diff --git a/chrome/browser/ui/views/handle_web_keyboard_event_gtk.cc b/chrome/browser/ui/views/handle_web_keyboard_event_gtk.cc index d6ec1fc1..57d4116 100644 --- a/chrome/browser/ui/views/handle_web_keyboard_event_gtk.cc +++ b/chrome/browser/ui/views/handle_web_keyboard_event_gtk.cc @@ -5,13 +5,13 @@ #include "chrome/browser/ui/views/handle_web_keyboard_event_gtk.h" #include "content/common/native_web_keyboard_event.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" void HandleWebKeyboardEvent(views::Widget* widget, const NativeWebKeyboardEvent& event) { if (widget && event.os_event && !event.skip_in_browser) { views::KeyEvent views_event(reinterpret_cast<GdkEvent*>(event.os_event)); - static_cast<views::WidgetGtk*>(widget->native_widget())-> + static_cast<views::NativeWidgetGtk*>(widget->native_widget())-> HandleKeyboardEvent(views_event); } } diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc index 4cf5569..bbef9e6 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.cc +++ b/chrome/browser/ui/views/notifications/balloon_view.cc @@ -36,12 +36,7 @@ #include "views/controls/native/native_view_host.h" #include "views/painter.h" #include "views/widget/root_view.h" -#if defined(OS_WIN) -#include "views/widget/widget_win.h" -#endif -#if defined(TOOLKIT_USES_GTK) -#include "views/widget/widget_gtk.h" -#endif +#include "views/widget/widget.h" using views::Widget; diff --git a/chrome/browser/ui/views/notifications/balloon_view.h b/chrome/browser/ui/views/notifications/balloon_view.h index 9a7753b..4c58326 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.h +++ b/chrome/browser/ui/views/notifications/balloon_view.h @@ -30,7 +30,6 @@ class ButtonListener; class ImageButton; class ImagePainter; class TextButton; -class WidgetWin; class Menu2; } // namespace views diff --git a/chrome/browser/ui/views/notifications/balloon_view_host.cc b/chrome/browser/ui/views/notifications/balloon_view_host.cc index 53f33b8..fc01900 100644 --- a/chrome/browser/ui/views/notifications/balloon_view_host.cc +++ b/chrome/browser/ui/views/notifications/balloon_view_host.cc @@ -18,12 +18,6 @@ #endif #endif #include "views/widget/widget.h" -#if defined(OS_WIN) -#include "views/widget/widget_win.h" -#endif -#if defined(TOOLKIT_USES_GTK) -#include "views/widget/widget_gtk.h" -#endif class BalloonViewHostView : public views::NativeViewHost { public: diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc index 7845b75..144728e 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.cc @@ -69,7 +69,7 @@ gfx::NativeView GetHiddenTabHostWindow() { widget->Init(params); } - return static_cast<views::WidgetGtk*>(widget->native_widget())-> + return static_cast<views::NativeWidgetGtk*>(widget->native_widget())-> window_contents(); } @@ -80,7 +80,7 @@ gfx::NativeView GetHiddenTabHostWindow() { NativeTabContentsViewGtk::NativeTabContentsViewGtk( internal::NativeTabContentsViewDelegate* delegate) - : views::WidgetGtk(delegate->AsNativeWidgetDelegate()), + : views::NativeWidgetGtk(delegate->AsNativeWidgetDelegate()), delegate_(delegate), ignore_next_char_event_(false), ALLOW_THIS_IN_INITIALIZER_LIST(drag_source_( @@ -101,7 +101,7 @@ void NativeTabContentsViewGtk::AttachConstrainedWindow( AddChild(constrained_window->widget()); gfx::Size requested_size; - views::WidgetGtk::GetRequestedSize(&requested_size); + views::NativeWidgetGtk::GetRequestedSize(&requested_size); PositionConstrainedWindows(requested_size); } @@ -146,7 +146,7 @@ RenderWidgetHostView* NativeTabContentsViewGtk::CreateRenderWidgetHostView( G_CALLBACK(OnMouseScroll), delegate_); // Let widget know that the tab contents has been painted. - views::WidgetGtk::RegisterChildExposeHandler(view->native_view()); + views::NativeWidgetGtk::RegisterChildExposeHandler(view->native_view()); // Renderer target DnD. if (delegate_->GetTabContents()->ShouldAcceptDragAndDrop()) @@ -197,14 +197,14 @@ views::NativeWidget* NativeTabContentsViewGtk::AsNativeWidget() { } //////////////////////////////////////////////////////////////////////////////// -// NativeTabContentsViewGtk, views::WidgetGtk overrides: +// NativeTabContentsViewGtk, views::NativeWidgetGtk overrides: // Called when the mouse moves within the widget. We notify SadTabView if it's // not NULL, else our delegate. gboolean NativeTabContentsViewGtk::OnMotionNotify(GtkWidget* widget, GdkEventMotion* event) { if (delegate_->IsShowingSadTab()) - return views::WidgetGtk::OnMotionNotify(widget, event); + return views::NativeWidgetGtk::OnMotionNotify(widget, event); delegate_->OnNativeTabContentsViewMouseMove(true); return FALSE; @@ -213,7 +213,7 @@ gboolean NativeTabContentsViewGtk::OnMotionNotify(GtkWidget* widget, gboolean NativeTabContentsViewGtk::OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event) { if (delegate_->IsShowingSadTab()) - return views::WidgetGtk::OnLeaveNotify(widget, event); + return views::NativeWidgetGtk::OnLeaveNotify(widget, event); delegate_->OnNativeTabContentsViewMouseMove(false); return FALSE; @@ -222,9 +222,9 @@ gboolean NativeTabContentsViewGtk::OnLeaveNotify(GtkWidget* widget, gboolean NativeTabContentsViewGtk::OnButtonPress(GtkWidget* widget, GdkEventButton* event) { if (delegate_->IsShowingSadTab()) - return views::WidgetGtk::OnButtonPress(widget, event); + return views::NativeWidgetGtk::OnButtonPress(widget, event); last_mouse_down_ = *event; - return views::WidgetGtk::OnButtonPress(widget, event); + return views::NativeWidgetGtk::OnButtonPress(widget, event); } void NativeTabContentsViewGtk::OnSizeAllocate(GtkWidget* widget, @@ -234,12 +234,12 @@ void NativeTabContentsViewGtk::OnSizeAllocate(GtkWidget* widget, if (size != size_) PositionConstrainedWindows(size); size_ = size; - views::WidgetGtk::OnSizeAllocate(widget, allocation); + views::NativeWidgetGtk::OnSizeAllocate(widget, allocation); } void NativeTabContentsViewGtk::OnShow(GtkWidget* widget) { delegate_->OnNativeTabContentsViewShown(); - views::WidgetGtk::OnShow(widget); + views::NativeWidgetGtk::OnShow(widget); } void NativeTabContentsViewGtk::OnHide(GtkWidget* widget) { @@ -248,7 +248,7 @@ void NativeTabContentsViewGtk::OnHide(GtkWidget* widget) { // delegate after it's already deleted. if (delegate_) delegate_->OnNativeTabContentsViewHidden(); - views::WidgetGtk::OnHide(widget); + views::NativeWidgetGtk::OnHide(widget); } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h index a2eefe5..384a2ea 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h @@ -7,14 +7,14 @@ #pragma once #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" class ConstrainedWindowGtk; class TabContents; class TabContentsDragSource; class WebDragDestGtk; -class NativeTabContentsViewGtk : public views::WidgetGtk, +class NativeTabContentsViewGtk : public views::NativeWidgetGtk, public NativeTabContentsView { public: explicit NativeTabContentsViewGtk( @@ -44,7 +44,7 @@ class NativeTabContentsViewGtk : public views::WidgetGtk, virtual void SetDragCursor(WebKit::WebDragOperation operation) OVERRIDE; virtual views::NativeWidget* AsNativeWidget() OVERRIDE; - // Overridden from views::WidgetGtk: + // Overridden from views::NativeWidgetGtk: virtual gboolean OnMotionNotify(GtkWidget* widget, GdkEventMotion* event) OVERRIDE; virtual gboolean OnLeaveNotify(GtkWidget* widget, @@ -73,94 +73,7 @@ class NativeTabContentsViewGtk : public views::WidgetGtk, // GTK. scoped_ptr<WebDragDestGtk> drag_dest_; - // Current size. See comment in WidgetGtk as to why this is cached. - gfx::Size size_; - - // Each individual UI for constrained dialogs currently displayed. The - // objects in this vector are owned by the TabContents, not the view. - std::vector<ConstrainedWindowGtk*> constrained_windows_; - - DISALLOW_COPY_AND_ASSIGN(NativeTabContentsViewGtk); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_VIEW_GTK_H_ - -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_VIEW_GTK_H_ -#define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_NATIVE_TAB_CONTENTS_VIEW_GTK_H_ -#pragma once - -#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view.h" -#include "views/widget/widget_gtk.h" - -class ConstrainedWindowGtk; -class TabContents; -class TabContentsDragSource; -class WebDragDestGtk; - -class NativeTabContentsViewGtk : public views::WidgetGtk, - public NativeTabContentsView { - public: - explicit NativeTabContentsViewGtk( - internal::NativeTabContentsViewDelegate* delegate); - virtual ~NativeTabContentsViewGtk(); - - // Unlike Windows, ConstrainedWindows need to collaborate with the - // TabContentsViewGtk to position the dialogs. - void AttachConstrainedWindow(ConstrainedWindowGtk* constrained_window); - void RemoveConstrainedWindow(ConstrainedWindowGtk* constrained_window); - - - private: - // Overridden from NativeTabContentsView: - virtual void InitNativeTabContentsView() OVERRIDE; - virtual void Unparent() OVERRIDE; - virtual RenderWidgetHostView* CreateRenderWidgetHostView( - RenderWidgetHost* render_widget_host) OVERRIDE; - virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; - virtual void SetPageTitle(const std::wstring& title) OVERRIDE; - virtual void StartDragging(const WebDropData& drop_data, - WebKit::WebDragOperationsMask ops, - const SkBitmap& image, - const gfx::Point& image_offset) OVERRIDE; - virtual void CancelDrag() OVERRIDE; - virtual bool IsDoingDrag() const OVERRIDE; - virtual void SetDragCursor(WebKit::WebDragOperation operation) OVERRIDE; - virtual views::NativeWidget* AsNativeWidget() OVERRIDE; - - // Overridden from views::WidgetGtk: - virtual gboolean OnMotionNotify(GtkWidget* widget, - GdkEventMotion* event) OVERRIDE; - virtual gboolean OnLeaveNotify(GtkWidget* widget, - GdkEventCrossing* event) OVERRIDE; - virtual gboolean OnButtonPress(GtkWidget* widget, - GdkEventButton* event) OVERRIDE; - virtual void OnSizeAllocate(GtkWidget* widget, - GtkAllocation* allocation) OVERRIDE; - virtual void OnShow(GtkWidget* widget) OVERRIDE; - virtual void OnHide(GtkWidget* widget) OVERRIDE; - - void PositionConstrainedWindows(const gfx::Size& view_size); - - internal::NativeTabContentsViewDelegate* delegate_; - - // Whether to ignore the next CHAR keyboard event. - bool ignore_next_char_event_; - - // Handles drags from this TabContentsView. - scoped_ptr<TabContentsDragSource> drag_source_; - - // The event for the last mouse down we handled. We need this for drags. - GdkEventButton last_mouse_down_; - - // The helper object that handles drag destination related interactions with - // GTK. - scoped_ptr<WebDragDestGtk> drag_dest_; - - // Current size. See comment in WidgetGtk as to why this is cached. + // Current size. See comment in NativeWidgetGtk as to why this is cached. gfx::Size size_; // Each individual UI for constrained dialogs currently displayed. The diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.cc index 9474fec..f9c6e62 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.cc +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.cc @@ -52,7 +52,7 @@ HWND GetHiddenTabHostWindow() { NativeTabContentsViewWin::NativeTabContentsViewWin( internal::NativeTabContentsViewDelegate* delegate) - : views::WidgetWin(delegate->AsNativeWidgetDelegate()), + : views::NativeWidgetWin(delegate->AsNativeWidgetDelegate()), delegate_(delegate) { } @@ -136,7 +136,7 @@ views::NativeWidget* NativeTabContentsViewWin::AsNativeWidget() { } //////////////////////////////////////////////////////////////////////////////// -// NativeTabContentsViewWin, views::WidgetWin overrides: +// NativeTabContentsViewWin, views::NativeWidgetWin overrides: void NativeTabContentsViewWin::OnDestroy() { if (drop_target_.get()) { @@ -144,7 +144,7 @@ void NativeTabContentsViewWin::OnDestroy() { drop_target_ = NULL; } - WidgetWin::OnDestroy(); + NativeWidgetWin::OnDestroy(); } void NativeTabContentsViewWin::OnHScroll(int scroll_type, @@ -157,7 +157,7 @@ LRESULT NativeTabContentsViewWin::OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param) { if (delegate_->IsShowingSadTab()) - return WidgetWin::OnMouseRange(msg, w_param, l_param); + return NativeWidgetWin::OnMouseRange(msg, w_param, l_param); switch (msg) { case WM_LBUTTONDOWN: @@ -226,7 +226,7 @@ void NativeTabContentsViewWin::OnWindowPosChanged(WINDOWPOS* window_pos) { gfx::Size(window_pos->cx, window_pos->cy)); } } - WidgetWin::OnWindowPosChanged(window_pos); + NativeWidgetWin::OnWindowPosChanged(window_pos); } void NativeTabContentsViewWin::OnSize(UINT param, const CSize& size) { diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.h b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.h index 6b1f195..611775d 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.h +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.h @@ -7,13 +7,13 @@ #pragma once #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view.h" -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" class WebDropTarget; class TabContents; class TabContentsDragWin; -class NativeTabContentsViewWin : public views::WidgetWin, +class NativeTabContentsViewWin : public views::NativeWidgetWin, public NativeTabContentsView { public: explicit NativeTabContentsViewWin( @@ -43,7 +43,7 @@ class NativeTabContentsViewWin : public views::WidgetWin, virtual void SetDragCursor(WebKit::WebDragOperation operation) OVERRIDE; virtual views::NativeWidget* AsNativeWidget() OVERRIDE; - // Overridden from views::WidgetWin: + // Overridden from views::NativeWidgetWin: virtual void OnDestroy() OVERRIDE; virtual void OnHScroll(int scroll_type, short position, diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h b/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h index 6e4b986..a28489c 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h +++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h @@ -118,7 +118,7 @@ class TabContentsViewTouch : public TabContentsView, public views::View { // The event for the last mouse down we handled. We need this for drags. GdkEventButton last_mouse_down_; - // Current size. See comment in WidgetGtk as to why this is cached. + // Current size. See comment in NativeWidgetGtk as to why this is cached. gfx::Size size_; // Each individual UI for constrained dialogs currently displayed. The diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.cc b/chrome/browser/ui/views/tabs/base_tab_strip.cc index ad3df63..c5dc7db 100644 --- a/chrome/browser/ui/views/tabs/base_tab_strip.cc +++ b/chrome/browser/ui/views/tabs/base_tab_strip.cc @@ -13,7 +13,8 @@ #include "views/window/window.h" #if defined(OS_WIN) -#include "views/widget/widget_win.h" +// GET_X_LPARAM, et al. +#include <windowsx.h> #endif namespace { diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc index 0045a8b..9f9cf5e 100644 --- a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc @@ -39,10 +39,6 @@ #include "views/widget/widget.h" #include "views/window/window.h" -#if defined(OS_WIN) -#include "views/widget/widget_win.h" -#endif - #if defined(TOOLKIT_USES_GTK) #include <gdk/gdk.h> // NOLINT #include <gdk/gdkkeysyms.h> // NOLINT diff --git a/chrome/browser/ui/views/tabs/dragged_tab_view.cc b/chrome/browser/ui/views/tabs/dragged_tab_view.cc index ce763ba..4689239 100644 --- a/chrome/browser/ui/views/tabs/dragged_tab_view.cc +++ b/chrome/browser/ui/views/tabs/dragged_tab_view.cc @@ -11,9 +11,9 @@ #include "views/widget/widget.h" #if defined(OS_WIN) -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" #elif defined(TOOLKIT_USES_GTK) -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" #endif static const int kTransparentAlpha = 200; @@ -48,7 +48,7 @@ DraggedTabView::DraggedTabView(const std::vector<views::View*>& renderers, container_->Init(params); container_->SetContentsView(this); #if defined(OS_WIN) - static_cast<views::WidgetWin*>(container_->native_widget())-> + static_cast<views::NativeWidgetWin*>(container_->native_widget())-> set_can_update_layered_window(false); BOOL drag; diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index 6c014cc..db7f5f4 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -32,9 +32,6 @@ #if defined(OS_WIN) #include "views/widget/monitor_win.h" -#include "views/widget/widget_win.h" -#elif defined(TOOLKIT_USES_GTK) -#include "views/widget/widget_gtk.h" #endif #undef min diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h index f818415..0ccf2fd 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.h +++ b/chrome/browser/ui/views/tabs/tab_strip.h @@ -19,11 +19,6 @@ class Tab; namespace views { class ImageView; -#if defined(TOOLKIT_USES_GTK) -class WidgetGtk; -#elif defined(OS_WIN) -class WidgetWin; -#endif } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index adc3786b..a249272 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -640,8 +640,9 @@ bool ToolbarView::ShouldShowIncompatibilityWarning() { int ToolbarView::PopupTopSpacing() const { // TODO(beng): For some reason GetWindow() returns NULL here in some // unidentified circumstances on ChromeOS. This means GetWidget() - // succeeded but we were (probably) unable to locate a WidgetGtk* - // on it using NativeWidget::GetNativeWidgetForNativeView. + // succeeded but we were (probably) unable to locate a + // NativeWidgetGtk* on it using + // NativeWidget::GetNativeWidgetForNativeView. // I am throwing in a NULL check for now to stop the hurt, but // it's possible the crash may just show up somewhere else. const views::Window* window = GetWindow(); diff --git a/chrome/test/ui_test_utils_win.cc b/chrome/test/ui_test_utils_win.cc index c752f95..3329c4b 100644 --- a/chrome/test/ui_test_utils_win.cc +++ b/chrome/test/ui_test_utils_win.cc @@ -40,13 +40,13 @@ void ClickOnView(const Browser* browser, ViewID vid) { } void HideNativeWindow(gfx::NativeWindow window) { - // TODO(jcampan): retrieve the WidgetWin and show/hide on it instead of + // TODO(jcampan): retrieve the NativeWidgetWin and show/hide on it instead of // using Windows API. ::ShowWindow(window, SW_HIDE); } void ShowAndFocusNativeWindow(gfx::NativeWindow window) { - // TODO(jcampan): retrieve the WidgetWin and show/hide on it instead of + // TODO(jcampan): retrieve the NativeWidgetWin and show/hide on it instead of // using Windows API. ::ShowWindow(window, SW_SHOW); } diff --git a/ui/base/win/window_impl.h b/ui/base/win/window_impl.h index 5a59819..94d6678 100644 --- a/ui/base/win/window_impl.h +++ b/ui/base/win/window_impl.h @@ -88,7 +88,7 @@ class WindowImpl : public MessageMapInterface { // If necessary, this registers the window class. std::wstring GetWindowClassName(); - // All classes registered by WidgetWin start with this name. + // All classes registered by WindowImpl start with this name. static const wchar_t* const kBaseClassName; // Window Styles used when creating the window. diff --git a/views/accessibility/native_view_accessibility_win.cc b/views/accessibility/native_view_accessibility_win.cc index 2bd8d30..029a0dc 100644 --- a/views/accessibility/native_view_accessibility_win.cc +++ b/views/accessibility/native_view_accessibility_win.cc @@ -7,8 +7,8 @@ #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/view_prop.h" #include "views/controls/button/native_button.h" +#include "views/widget/native_widget_win.h" #include "views/widget/widget.h" -#include "views/widget/widget_win.h" using ui::AccessibilityTypes; @@ -43,8 +43,8 @@ IAccessible* NativeViewAccessibilityWin::GetAccessibleForView( // Next, see if the view is a widget container. if (view->child_widget()) { - views::WidgetWin* native_widget = - reinterpret_cast<views::WidgetWin*>(view->child_widget()); + views::NativeWidgetWin* native_widget = + reinterpret_cast<views::NativeWidgetWin*>(view->child_widget()); if (GetNativeIAccessibleInterface( native_widget->GetNativeView(), &accessible) == S_OK) { return accessible; @@ -257,9 +257,10 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accChild(VARIANT var_child, child_view = view_->GetViewByID(child_id); } } else { - // Negative values are used for events fired using the view's WidgetWin - views::WidgetWin* widget = - static_cast<views::WidgetWin*>(view_->GetWidget()->native_widget()); + // Negative values are used for events fired using the view's + // NativeWidgetWin. + views::NativeWidgetWin* widget = static_cast<views::NativeWidgetWin*>( + view_->GetWidget()->native_widget()); child_view = widget->GetAccessibilityViewEventAt(child_id); } diff --git a/views/controls/menu/menu_host_gtk.cc b/views/controls/menu/menu_host_gtk.cc index 553bca3..962d701 100644 --- a/views/controls/menu/menu_host_gtk.cc +++ b/views/controls/menu/menu_host_gtk.cc @@ -23,7 +23,7 @@ namespace views { // MenuHostGtk, public: MenuHostGtk::MenuHostGtk(internal::NativeMenuHostDelegate* delegate) - : WidgetGtk(delegate->AsNativeWidgetDelegate()), + : NativeWidgetGtk(delegate->AsNativeWidgetDelegate()), did_input_grab_(false), delegate_(delegate) { } @@ -80,10 +80,10 @@ NativeWidget* MenuHostGtk::AsNativeWidget() { } //////////////////////////////////////////////////////////////////////////////// -// MenuHostGtk, WidgetGtk overrides: +// MenuHostGtk, NativeWidgetGtk overrides: void MenuHostGtk::InitNativeWidget(const Widget::InitParams& params) { - WidgetGtk::InitNativeWidget(params); + NativeWidgetGtk::InitNativeWidget(params); // Make sure we get destroyed when the parent is destroyed. gtk_window_set_destroy_with_parent(GTK_WINDOW(GetNativeView()), TRUE); gtk_window_set_type_hint(GTK_WINDOW(GetNativeView()), @@ -91,7 +91,7 @@ void MenuHostGtk::InitNativeWidget(const Widget::InitParams& params) { } void MenuHostGtk::ReleaseMouseCapture() { - WidgetGtk::ReleaseMouseCapture(); + NativeWidgetGtk::ReleaseMouseCapture(); if (did_input_grab_) { did_input_grab_ = false; gdk_pointer_ungrab(GDK_CURRENT_TIME); @@ -105,7 +105,7 @@ void MenuHostGtk::ReleaseMouseCapture() { void MenuHostGtk::OnDestroy(GtkWidget* object) { delegate_->OnNativeMenuHostDestroy(); - WidgetGtk::OnDestroy(object); + NativeWidgetGtk::OnDestroy(object); } void MenuHostGtk::HandleXGrabBroke() { @@ -114,7 +114,7 @@ void MenuHostGtk::HandleXGrabBroke() { did_input_grab_ = false; delegate_->OnNativeMenuHostCancelCapture(); } - WidgetGtk::HandleXGrabBroke(); + NativeWidgetGtk::HandleXGrabBroke(); } void MenuHostGtk::HandleGtkGrabBroke() { @@ -123,7 +123,7 @@ void MenuHostGtk::HandleGtkGrabBroke() { ReleaseMouseCapture(); delegate_->OnNativeMenuHostCancelCapture(); } - WidgetGtk::HandleGtkGrabBroke(); + NativeWidgetGtk::HandleGtkGrabBroke(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/views/controls/menu/menu_host_gtk.h b/views/controls/menu/menu_host_gtk.h index ac1e588..e49064e 100644 --- a/views/controls/menu/menu_host_gtk.h +++ b/views/controls/menu/menu_host_gtk.h @@ -8,7 +8,7 @@ #pragma once #include "views/controls/menu/native_menu_host.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" namespace views { namespace internal { @@ -16,7 +16,7 @@ class NativeMenuHostDelegate; } // NativeMenuHost implementation for Gtk. -class MenuHostGtk : public WidgetGtk, +class MenuHostGtk : public NativeWidgetGtk, public NativeMenuHost { public: explicit MenuHostGtk(internal::NativeMenuHostDelegate* delegate); @@ -27,7 +27,7 @@ class MenuHostGtk : public WidgetGtk, virtual void StartCapturing() OVERRIDE; virtual NativeWidget* AsNativeWidget() OVERRIDE; - // Overridden from WidgetGtk: + // Overridden from NativeWidgetGtk: virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; virtual void ReleaseMouseCapture() OVERRIDE; virtual void OnDestroy(GtkWidget* object) OVERRIDE; diff --git a/views/controls/menu/menu_host_win.cc b/views/controls/menu/menu_host_win.cc index cba5595..7e01134 100644 --- a/views/controls/menu/menu_host_win.cc +++ b/views/controls/menu/menu_host_win.cc @@ -12,7 +12,7 @@ namespace views { // MenuHostWin, public: MenuHostWin::MenuHostWin(internal::NativeMenuHostDelegate* delegate) - : WidgetWin(delegate->AsNativeWidgetDelegate()), + : NativeWidgetWin(delegate->AsNativeWidgetDelegate()), delegate_(delegate) { } @@ -31,16 +31,16 @@ NativeWidget* MenuHostWin::AsNativeWidget() { } //////////////////////////////////////////////////////////////////////////////// -// MenuHostWin, WidgetWin overrides: +// MenuHostWin, NativeWidgetWin overrides: void MenuHostWin::OnDestroy() { delegate_->OnNativeMenuHostDestroy(); - WidgetWin::OnDestroy(); + NativeWidgetWin::OnDestroy(); } void MenuHostWin::OnCancelMode() { delegate_->OnNativeMenuHostCancelCapture(); - WidgetWin::OnCancelMode(); + NativeWidgetWin::OnCancelMode(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/views/controls/menu/menu_host_win.h b/views/controls/menu/menu_host_win.h index 7dfc8e8..9c9f8f8 100644 --- a/views/controls/menu/menu_host_win.h +++ b/views/controls/menu/menu_host_win.h @@ -7,7 +7,7 @@ #pragma once #include "views/controls/menu/native_menu_host.h" -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" namespace views { namespace internal { @@ -15,7 +15,7 @@ class NativeMenuHostDelegate; } // MenuHost implementation for windows. -class MenuHostWin : public WidgetWin, +class MenuHostWin : public NativeWidgetWin, public NativeMenuHost { public: explicit MenuHostWin(internal::NativeMenuHostDelegate* delegate); @@ -26,7 +26,7 @@ class MenuHostWin : public WidgetWin, virtual void StartCapturing() OVERRIDE; virtual NativeWidget* AsNativeWidget() OVERRIDE; - // Overridden from WidgetWin: + // Overridden from NativeWidgetWin: virtual void OnDestroy() OVERRIDE; virtual void OnCancelMode() OVERRIDE; diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc index b04d3bc9..b9db871 100644 --- a/views/controls/menu/native_menu_gtk.cc +++ b/views/controls/menu/native_menu_gtk.cc @@ -22,7 +22,7 @@ #include "views/controls/menu/menu_2.h" #include "views/controls/menu/nested_dispatcher_gtk.h" #include "views/views_delegate.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" namespace { @@ -108,8 +108,8 @@ void NativeMenuGtk::RunMenuAt(const gfx::Point& point, int alignment) { // the menu after the menu painted itself. GtkWidget* popup_window = gtk_widget_get_ancestor(menu_, GTK_TYPE_WINDOW); CHECK(popup_window); - WidgetGtk::UpdateFreezeUpdatesProperty(GTK_WINDOW(popup_window), - true /* add */); + NativeWidgetGtk::UpdateFreezeUpdatesProperty(GTK_WINDOW(popup_window), + true /* add */); expose_handler_id_ = g_signal_connect_after(G_OBJECT(menu_), "expose_event", G_CALLBACK(&OnExposeThunk), this); @@ -346,8 +346,8 @@ gboolean NativeMenuGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event) { GtkWidget* popup_window = gtk_widget_get_ancestor(menu_, GTK_TYPE_WINDOW); CHECK(popup_window); DCHECK(expose_handler_id_); - WidgetGtk::UpdateFreezeUpdatesProperty(GTK_WINDOW(popup_window), - false /* remove */); + NativeWidgetGtk::UpdateFreezeUpdatesProperty(GTK_WINDOW(popup_window), + false /* remove */); if (expose_handler_id_) { g_signal_handler_disconnect(menu_, expose_handler_id_); expose_handler_id_ = 0; diff --git a/views/controls/native/native_view_host.cc b/views/controls/native/native_view_host.cc index 6a00743..42321e5 100644 --- a/views/controls/native/native_view_host.cc +++ b/views/controls/native/native_view_host.cc @@ -129,8 +129,8 @@ void NativeViewHost::Layout() { void NativeViewHost::OnPaint(gfx::Canvas* canvas) { // Paint background if there is one. NativeViewHost needs to paint // a background when it is hosted in a TabbedPane. For Gtk implementation, - // NativeTabbedPaneGtk uses a WidgetGtk as page container and because - // WidgetGtk hook "expose" with its root view's paint, we need to + // NativeTabbedPaneGtk uses a NativeWidgetGtk as page container and because + // NativeWidgetGtk hook "expose" with its root view's paint, we need to // fill the content. Otherwise, the tab page's background is not properly // cleared. For Windows case, it appears okay to not paint background because // we don't have a container window in-between. However if you want to use diff --git a/views/controls/native/native_view_host_gtk.cc b/views/controls/native/native_view_host_gtk.cc index 2bc0e50..fedbc416 100644 --- a/views/controls/native/native_view_host_gtk.cc +++ b/views/controls/native/native_view_host_gtk.cc @@ -11,7 +11,7 @@ #include "views/controls/native/native_view_host.h" #include "views/focus/focus_manager.h" #include "views/widget/gtk_views_fixed.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" namespace views { @@ -112,7 +112,7 @@ void NativeViewHostGtk::NativeViewAttached() { gtk_container_add(GTK_CONTAINER(fixed_), host_->native_view()); // Let the widget know that the native component has been painted. - views::WidgetGtk::RegisterChildExposeHandler(host_->native_view()); + views::NativeWidgetGtk::RegisterChildExposeHandler(host_->native_view()); if (!destroy_signal_id_) { destroy_signal_id_ = g_signal_connect(host_->native_view(), @@ -214,7 +214,7 @@ void NativeViewHostGtk::UninstallClip() { } void NativeViewHostGtk::ShowWidget(int x, int y, int w, int h) { - // x and y are the desired position of host_ in WidgetGtk coordinates. + // x and y are the desired position of host_ in NativeWidgetGtk coordinates. int fixed_x = x; int fixed_y = y; int fixed_w = w; @@ -286,7 +286,7 @@ void NativeViewHostGtk::CreateFixed(bool needs_window) { // Defeat refcounting. We need to own the fixed. gtk_widget_ref(fixed_); - WidgetGtk* widget_gtk = GetHostWidget(); + NativeWidgetGtk* widget_gtk = GetHostWidget(); if (widget_gtk) widget_gtk->AddChild(fixed_); @@ -322,14 +322,14 @@ void NativeViewHostGtk::DestroyFixed() { fixed_ = NULL; } -WidgetGtk* NativeViewHostGtk::GetHostWidget() const { - return static_cast<WidgetGtk*>(host_->GetWidget()->native_widget()); +NativeWidgetGtk* NativeViewHostGtk::GetHostWidget() const { + return static_cast<NativeWidgetGtk*>(host_->GetWidget()->native_widget()); } GtkWidget* NativeViewHostGtk::GetFocusedDescendant() { if (!fixed_) return NULL; - WidgetGtk* host = GetHostWidget(); + NativeWidgetGtk* host = GetHostWidget(); if (!host) return NULL; GtkWidget* top_level = gtk_widget_get_toplevel(host->GetNativeView()); diff --git a/views/controls/native/native_view_host_gtk.h b/views/controls/native/native_view_host_gtk.h index 17ccd7e..eb98349 100644 --- a/views/controls/native/native_view_host_gtk.h +++ b/views/controls/native/native_view_host_gtk.h @@ -16,7 +16,7 @@ namespace views { class View; -class WidgetGtk; +class NativeWidgetGtk; // Note that the NativeViewHostGtk assumes ownership of the GtkWidget attached // to it for the duration of its attachment. This is so the NativeViewHostGtk @@ -50,7 +50,7 @@ class NativeViewHostGtk : public NativeViewHostWrapper { // Destroys the GtkFixed that performs clipping on our hosted GtkWidget. void DestroyFixed(); - WidgetGtk* GetHostWidget() const; + NativeWidgetGtk* GetHostWidget() const; // Returns the descendant of fixed_ that has focus, or NULL if focus is not // on a descendant of fixed_. diff --git a/views/controls/native_control_win.cc b/views/controls/native_control_win.cc index 76bc5aa..cd1ac0b 100644 --- a/views/controls/native_control_win.cc +++ b/views/controls/native_control_win.cc @@ -134,8 +134,8 @@ void NativeControlWin::ShowContextMenu(const gfx::Point& location) { } void NativeControlWin::NativeControlCreated(HWND native_control) { - // Associate this object with the control's HWND so that WidgetWin can find - // this object when it receives messages from it. + // Associate this object with the control's HWND so that NativeWidgetWin can + // find this object when it receives messages from it. props_.push_back(new ViewProp(native_control, kNativeControlWinKey, this)); props_.push_back(ChildWindowMessageProcessor::Register(native_control, this)); diff --git a/views/controls/native_control_win.h b/views/controls/native_control_win.h index 8b446b5..5d7e949 100644 --- a/views/controls/native_control_win.h +++ b/views/controls/native_control_win.h @@ -44,7 +44,7 @@ class NativeControlWin : public ChildWindowMessageProcessor, virtual void VisibilityChanged(View* starting_from, bool is_visible); virtual void OnFocus(); - // Called by the containing WidgetWin when a WM_CONTEXTMENU message is + // Called by the containing NativeWidgetWin when a WM_CONTEXTMENU message is // received from the HWND created by an object derived from NativeControlWin. virtual void ShowContextMenu(const gfx::Point& location); @@ -75,9 +75,9 @@ class NativeControlWin : public ChildWindowMessageProcessor, private: typedef ScopedVector<ui::ViewProp> ViewProps; - // Called by the containing WidgetWin when a message of type WM_CTLCOLORBTN or - // WM_CTLCOLORSTATIC is sent from the HWND created by an object dreived from - // NativeControlWin. + // Called by the containing NativeWidgetWin when a message of type + // WM_CTLCOLORBTN or WM_CTLCOLORSTATIC is sent from the HWND created by an + // object derived from NativeControlWin. LRESULT GetControlColor(UINT message, HDC dc, HWND sender); // Our subclass window procedure for the attached control. diff --git a/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc b/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc index 2fbdbe9..c35e862 100644 --- a/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc +++ b/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc @@ -16,8 +16,9 @@ #include "views/controls/tabbed_pane/tabbed_pane.h" #include "views/controls/tabbed_pane/tabbed_pane_listener.h" #include "views/layout/fill_layout.h" +#include "views/widget/native_widget.h" #include "views/widget/root_view.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/widget.h" namespace views { diff --git a/views/controls/tabbed_pane/native_tabbed_pane_gtk.h b/views/controls/tabbed_pane/native_tabbed_pane_gtk.h index bbe412d..60d76cc 100644 --- a/views/controls/tabbed_pane/native_tabbed_pane_gtk.h +++ b/views/controls/tabbed_pane/native_tabbed_pane_gtk.h @@ -13,8 +13,6 @@ namespace views { -class WidgetGtk; - class NativeTabbedPaneGtk : public NativeControlGtk, public NativeTabbedPaneWrapper { public: diff --git a/views/controls/textfield/native_textfield_gtk.cc b/views/controls/textfield/native_textfield_gtk.cc index 30444bb..2fe5c60 100644 --- a/views/controls/textfield/native_textfield_gtk.cc +++ b/views/controls/textfield/native_textfield_gtk.cc @@ -18,7 +18,7 @@ #include "views/controls/textfield/native_textfield_views.h" #include "views/controls/textfield/textfield.h" #include "views/controls/textfield/textfield_controller.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" namespace views { @@ -393,7 +393,8 @@ void NativeTextfieldGtk::OnActivate(GtkWidget* native_widget) { if (controller) handled = controller->HandleKeyEvent(textfield_, views_key_event); - WidgetGtk* widget = static_cast<WidgetGtk*>(GetWidget()->native_widget()); + NativeWidgetGtk* widget = + static_cast<NativeWidgetGtk*>(GetWidget()->native_widget()); if (!handled && widget) handled = widget->HandleKeyboardEvent(views_key_event); diff --git a/views/events/event_x.cc b/views/events/event_x.cc index a495d77..08c683e 100644 --- a/views/events/event_x.cc +++ b/views/events/event_x.cc @@ -14,7 +14,6 @@ #include "base/utf_string_conversions.h" #include "ui/base/keycodes/keyboard_code_conversion_x.h" #include "views/widget/root_view.h" -#include "views/widget/widget_gtk.h" #if defined(HAVE_XINPUT2) #include "views/touchui/touch_factory.h" diff --git a/views/examples/example_base.cc b/views/examples/example_base.cc index af1271c..318d183 100644 --- a/views/examples/example_base.cc +++ b/views/examples/example_base.cc @@ -20,9 +20,9 @@ namespace { using views::View; -// Some of GTK based view classes require WidgetGTK in the view +// Some of GTK based view classes require NativeWidgetGtk in the view // parent chain. This class is used to defer the creation of such -// views until a WidgetGTK is added to the view hierarchy. +// views until a NativeWidgetGtk is added to the view hierarchy. class ContainerView : public View { public: explicit ContainerView(examples::ExampleBase* base) diff --git a/views/focus/accelerator_handler_gtk.cc b/views/focus/accelerator_handler_gtk.cc index 6c50f8b..e795d06 100644 --- a/views/focus/accelerator_handler_gtk.cc +++ b/views/focus/accelerator_handler_gtk.cc @@ -8,7 +8,6 @@ #include "views/accelerator.h" #include "views/focus/focus_manager.h" -#include "views/widget/widget_gtk.h" namespace views { @@ -16,7 +15,7 @@ AcceleratorHandler::AcceleratorHandler() {} bool AcceleratorHandler::Dispatch(GdkEvent* event) { // The logic for handling keyboard accelerators has been moved into - // WidgetGtk::OnEventKey handler (views/widget/widget_gtk.cc). + // NativeWidgetGtk::OnEventKey handler (views/widget/widget_gtk.cc). gtk_main_do_event(event); return true; } diff --git a/views/focus/accelerator_handler_touch.cc b/views/focus/accelerator_handler_touch.cc index 032b29d..1117cf9 100644 --- a/views/focus/accelerator_handler_touch.cc +++ b/views/focus/accelerator_handler_touch.cc @@ -18,7 +18,6 @@ #include "views/ime/input_method.h" #include "views/touchui/touch_factory.h" #include "views/widget/root_view.h" -#include "views/widget/widget_gtk.h" namespace views { @@ -35,7 +34,7 @@ Widget* FindWidgetForGdkWindow(GdkWindow* gdk_window) { NativeWidget* widget = NativeWidget::GetNativeWidgetForNativeView(gtk_widget); if (!widget) { - DLOG(WARNING) << "no WidgetGtk found for that GtkWidget"; + DLOG(WARNING) << "no NativeWidgetGtk found for that GtkWidget"; return NULL; } return widget->GetWidget(); diff --git a/views/focus/focus_manager.cc b/views/focus/focus_manager.cc index e26cfd2..da65e45 100644 --- a/views/focus/focus_manager.cc +++ b/views/focus/focus_manager.cc @@ -99,7 +99,7 @@ bool FocusManager::OnKeyEvent(const KeyEvent& event) { #if defined(OS_WIN) // If the focused view wants to process the key event as is, let it be. // On Linux we always dispatch key events to the focused view first, so - // we should not do this check here. See also WidgetGtk::OnKeyEvent(). + // we should not do this check here. See also NativeWidgetGtk::OnKeyEvent(). if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event)) return true; #endif @@ -215,7 +215,7 @@ View* FocusManager::GetNextFocusableView(View* original_starting_view, if (!focus_traversable) { if (!reverse) { // If the starting view has a focus traversable, use it. - // This is the case with WidgetWins for example. + // This is the case with NativeWidgetWins for example. focus_traversable = original_starting_view->GetFocusTraversable(); // Otherwise default to the root view. diff --git a/views/focus/focus_manager_gtk.cc b/views/focus/focus_manager_gtk.cc index 29af1ef..98438c4 100644 --- a/views/focus/focus_manager_gtk.cc +++ b/views/focus/focus_manager_gtk.cc @@ -7,13 +7,13 @@ #include "views/focus/focus_manager.h" #include "base/logging.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" #include "views/window/window_gtk.h" namespace views { void FocusManager::ClearNativeFocus() { - static_cast<WidgetGtk*>(widget_->native_widget())->ClearNativeFocus(); + static_cast<NativeWidgetGtk*>(widget_->native_widget())->ClearNativeFocus(); } void FocusManager::FocusNativeView(gfx::NativeView native_view) { diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc index 6f34241..c215c72 100644 --- a/views/focus/focus_manager_unittest.cc +++ b/views/focus/focus_manager_unittest.cc @@ -32,12 +32,8 @@ #include "views/window/window.h" #include "views/window/window_delegate.h" -#if defined(OS_WIN) -#include "views/widget/widget_win.h" -#include "views/window/window_win.h" -#elif defined(OS_LINUX) +#if defined(OS_LINUX) #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" -#include "views/window/window_gtk.h" #endif namespace { @@ -1500,7 +1496,7 @@ class MessageTrackingView : public View { #if defined(OS_WIN) // This test is now Windows only. Linux Views port does not handle accelerator // keys in AcceleratorHandler anymore. The logic has been moved into -// WidgetGtk::OnKeyEvent(). +// NativeWidgetGtk::OnKeyEvent(). // Tests that the keyup messages are eaten for accelerators. TEST_F(FocusManagerTest, IgnoreKeyupForAccelerators) { FocusManager* focus_manager = GetFocusManager(); diff --git a/views/focus/focus_manager_win.cc b/views/focus/focus_manager_win.cc index d6f1e02..79d0b59 100644 --- a/views/focus/focus_manager_win.cc +++ b/views/focus/focus_manager_win.cc @@ -5,7 +5,8 @@ #include "views/focus/focus_manager.h" #include "views/view.h" -#include "views/widget/widget_win.h" +#include "views/widget/native_widget.h" +#include "views/widget/widget.h" namespace views { diff --git a/views/view.cc b/views/view.cc index 9fdd27e..b92db93 100644 --- a/views/view.cc +++ b/views/view.cc @@ -1677,9 +1677,10 @@ void View::RegisterPendingAccelerators() { // focus manager (see bug #1291225). This should never be the case, just // making sure we don't crash. - // TODO(jcampan): This fails for a view under WidgetGtk with TYPE_CHILD. - // (see http://crbug.com/21335) reenable NOTREACHED assertion and - // verify accelerators works as expected. + // TODO(jcampan): This fails for a view under NativeWidgetGtk with + // TYPE_CHILD. (see http://crbug.com/21335) reenable + // NOTREACHED assertion and verify accelerators works as + // expected. #if defined(OS_WIN) NOTREACHED(); #endif diff --git a/views/view_unittest.cc b/views/view_unittest.cc index f98f5b9..f251708 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -25,17 +25,14 @@ #include "views/test/views_test_base.h" #include "views/view.h" #include "views/views_delegate.h" +#include "views/widget/native_widget.h" #include "views/widget/root_view.h" #include "views/window/dialog_delegate.h" #include "views/window/window.h" #if defined(OS_WIN) -#include "views/widget/widget_win.h" #include "views/controls/button/native_button_win.h" #include "views/test/test_views_delegate.h" -#elif defined(OS_LINUX) -#include "views/widget/widget_gtk.h" -#include "views/window/window_gtk.h" #endif #if defined(TOUCH_UI) #include "views/touchui/gesture_manager.h" @@ -536,7 +533,7 @@ TEST_F(ViewTest, DISABLED_Painting) { RDW_UPDATENOW | RDW_INVALIDATE | RDW_ALLCHILDREN); bool empty_paint = paint_window.empty_paint(); - WidgetWin window; + NativeWidgetWin window; window.set_delete_on_destroy(false); window.set_window_style(WS_OVERLAPPEDWINDOW); window.Init(NULL, gfx::Rect(50, 50, 650, 650), NULL); diff --git a/views/view_win.cc b/views/view_win.cc index 62a9240..b083dbc 100644 --- a/views/view_win.cc +++ b/views/view_win.cc @@ -18,7 +18,6 @@ #include "views/views_delegate.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" -#include "views/widget/widget_win.h" namespace views { diff --git a/views/views.gyp b/views/views.gyp index 6a8e1c7..f0bb326 100644 --- a/views/views.gyp +++ b/views/views.gyp @@ -360,14 +360,14 @@ 'widget/monitor_win.h', 'widget/native_widget.h', 'widget/native_widget_delegate.h', + 'widget/native_widget_gtk.cc', + 'widget/native_widget_gtk.h', + 'widget/native_widget_win.cc', + 'widget/native_widget_win.h', 'widget/widget.cc', 'widget/widget.h', 'widget/widget_delegate.cc', 'widget/widget_delegate.h', - 'widget/widget_gtk.cc', - 'widget/widget_gtk.h', - 'widget/widget_win.cc', - 'widget/widget_win.h', 'window/client_view.cc', 'window/client_view.h', 'window/custom_frame_view.cc', @@ -417,11 +417,11 @@ 'controls/tree/tree_view.cc', 'events/event_win.cc', 'resize_corner.cc', + 'widget/aero_tooltip_manager.cc', 'widget/child_window_message_processor.cc', 'widget/child_window_message_processor.h', - 'widget/aero_tooltip_manager.cc', + 'widget/native_widget_win.cc', 'widget/root_view_drop_target.cc', - 'widget/widget_win.cc', 'window/hit_test.cc', 'window/native_frame_view.cc', ], @@ -513,7 +513,7 @@ 'widget/native_widget_test_utils_gtk.cc', 'widget/native_widget_test_utils_win.cc', 'widget/native_widget_unittest.cc', - 'widget/widget_win_unittest.cc', + 'widget/native_widget_win_unittest.cc', 'window/window_win_unittest.cc', '<(SHARED_INTERMEDIATE_DIR)/app/app_resources/app_resources.rc', diff --git a/views/widget/child_window_message_processor.h b/views/widget/child_window_message_processor.h index ab18997..a11b187 100644 --- a/views/widget/child_window_message_processor.h +++ b/views/widget/child_window_message_processor.h @@ -17,7 +17,7 @@ namespace views { // Windows sends a handful of messages to the parent window rather than the // window itself. For example, selection changes of a rich edit (EN_SELCHANGE) // are sent to the parent, not the window. Typically such message are best -// dealt with by the window rather than the parent. WidgetWin allows for +// dealt with by the window rather than the parent. NativeWidgetWin allows for // registering a ChildWindowMessageProcessor to handle such messages. class ChildWindowMessageProcessor { public: diff --git a/views/widget/default_theme_provider.cc b/views/widget/default_theme_provider.cc index 7d2dfec..86c3b7b 100644 --- a/views/widget/default_theme_provider.cc +++ b/views/widget/default_theme_provider.cc @@ -7,7 +7,7 @@ #include "ui/base/resource/resource_bundle.h" #if defined(OS_WIN) -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" #endif namespace views { @@ -33,7 +33,7 @@ bool DefaultThemeProvider::GetDisplayProperty(int id, int* result) const { bool DefaultThemeProvider::ShouldUseNativeFrame() const { #if defined(OS_WIN) - return WidgetWin::IsAeroGlassEnabled(); + return NativeWidgetWin::IsAeroGlassEnabled(); #else return false; #endif diff --git a/views/widget/drop_target_gtk.cc b/views/widget/drop_target_gtk.cc index c135d91..4fecfcb 100644 --- a/views/widget/drop_target_gtk.cc +++ b/views/widget/drop_target_gtk.cc @@ -17,7 +17,7 @@ #include "ui/base/dragdrop/os_exchange_data_provider_gtk.h" #include "ui/gfx/point.h" #include "views/widget/root_view.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" using ui::OSExchangeData; @@ -166,7 +166,7 @@ gboolean DropTargetGtk::OnDragDrop(GdkDragContext* context, OnDragMotion(context, x, y, time); if (!pending_view_) { // User isn't over a view, no drop can occur. - static_cast<WidgetGtk*>( + static_cast<NativeWidgetGtk*>( helper_.root_view()->GetWidget()->native_widget())->ResetDropTarget(); // WARNING: we've been deleted. return FALSE; @@ -246,8 +246,8 @@ void DropTargetGtk::FinishDrop(GdkDragContext* context, gtk_drag_finish(context, gdk_action != 0, (gdk_action & GDK_ACTION_MOVE), time); - static_cast<WidgetGtk*>(helper_.root_view()->GetWidget()->native_widget())-> - ResetDropTarget(); + static_cast<NativeWidgetGtk*>(helper_.root_view()->GetWidget()-> + native_widget())->ResetDropTarget(); // WARNING: we've been deleted. } @@ -265,8 +265,8 @@ void DropTargetGtk::RequestFormats(GdkDragContext* context, int formats, const std::set<GdkAtom>& custom_formats, guint time) { - GtkWidget* widget = static_cast<WidgetGtk*>(helper_.root_view()->GetWidget()-> - native_widget())->window_contents(); + GtkWidget* widget = static_cast<NativeWidgetGtk*>(helper_.root_view()-> + GetWidget()->native_widget())->window_contents(); const std::set<GdkAtom>& known_formats = data_provider().known_custom_formats(); diff --git a/views/widget/drop_target_gtk.h b/views/widget/drop_target_gtk.h index eea1df7..75fd1c0 100644 --- a/views/widget/drop_target_gtk.h +++ b/views/widget/drop_target_gtk.h @@ -33,7 +33,7 @@ class View; // the target is notified. Similarly if the drop completes and the data has // not yet been fetched, it is fetched and the target then notified. // -// When a drop finishes this class calls back to the containing WidgetGtk +// When a drop finishes this class calls back to the containing NativeWidgetGtk // which results in deleting the DropTargetGtk. class DropTargetGtk { public: @@ -47,7 +47,8 @@ class DropTargetGtk { // we don't target a view that was removed during dnd. void ResetTargetViewIfEquals(View* view); - // Drop methods from Gtk. These are forwarded from the containing WidgetGtk. + // Drop methods from Gtk. These are forwarded from the containing + // NativeWidgetGtk. void OnDragDataReceived(GdkDragContext* context, gint x, gint y, diff --git a/views/widget/drop_target_win.h b/views/widget/drop_target_win.h index 05ece15..1498841 100644 --- a/views/widget/drop_target_win.h +++ b/views/widget/drop_target_win.h @@ -14,7 +14,7 @@ namespace views { class RootView; class View; -// DropTargetWin takes care of managing drag and drop for WidgetWin. It +// DropTargetWin takes care of managing drag and drop for NativeWidgetWin. It // converts Windows OLE drop messages into Views drop messages. // // DropTargetWin uses DropHelper to manage the appropriate view to target diff --git a/views/widget/widget_gtk.cc b/views/widget/native_widget_gtk.cc index 0e693d8..1dc4f0f 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/native_widget_gtk.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" #include <gdk/gdk.h> #include <gdk/gdkx.h> @@ -186,7 +186,7 @@ void RemoveExposeHandlerIfExists(GtkWidget* widget) { // have no way to tell the difference between a normal drag leave and a drop. // To work around that we listen for DROP_START, then ignore the subsequent // drag-leave that GTK generates. -class WidgetGtk::DropObserver : public MessageLoopForUI::Observer { +class NativeWidgetGtk::DropObserver : public MessageLoopForUI::Observer { public: DropObserver() {} @@ -196,7 +196,7 @@ class WidgetGtk::DropObserver : public MessageLoopForUI::Observer { virtual void WillProcessEvent(GdkEvent* event) { if (event->type == GDK_DROP_START) { - WidgetGtk* widget = GetWidgetGtkForEvent(event); + NativeWidgetGtk* widget = GetNativeWidgetGtkForEvent(event); if (widget) widget->ignore_drag_leave_ = true; } @@ -206,12 +206,12 @@ class WidgetGtk::DropObserver : public MessageLoopForUI::Observer { } private: - WidgetGtk* GetWidgetGtkForEvent(GdkEvent* event) { + NativeWidgetGtk* GetNativeWidgetGtkForEvent(GdkEvent* event) { GtkWidget* gtk_widget = gtk_get_event_widget(event); if (!gtk_widget) return NULL; - return static_cast<WidgetGtk*>( + return static_cast<NativeWidgetGtk*>( NativeWidget::GetNativeWidgetForNativeView(gtk_widget)); } @@ -278,13 +278,13 @@ static GtkWidget* CreateDragIconWidget(GdkPixbuf* drag_image) { } // static -GtkWidget* WidgetGtk::null_parent_ = NULL; -bool WidgetGtk::debug_paint_enabled_ = false; +GtkWidget* NativeWidgetGtk::null_parent_ = NULL; +bool NativeWidgetGtk::debug_paint_enabled_ = false; //////////////////////////////////////////////////////////////////////////////// -// WidgetGtk, public: +// NativeWidgetGtk, public: -WidgetGtk::WidgetGtk(internal::NativeWidgetDelegate* delegate) +NativeWidgetGtk::NativeWidgetGtk(internal::NativeWidgetDelegate* delegate) : is_window_(false), delegate_(delegate), widget_(NULL), @@ -321,7 +321,7 @@ WidgetGtk::WidgetGtk(internal::NativeWidgetDelegate* delegate) } } -WidgetGtk::~WidgetGtk() { +NativeWidgetGtk::~NativeWidgetGtk() { // We need to delete the input method before calling DestroyRootView(), // because it'll set focus_manager_ to NULL. input_method_.reset(); @@ -333,12 +333,12 @@ WidgetGtk::~WidgetGtk() { ActiveWindowWatcherX::RemoveObserver(this); } -GtkWindow* WidgetGtk::GetTransientParent() const { +GtkWindow* NativeWidgetGtk::GetTransientParent() const { return (!child_ && widget_) ? gtk_window_get_transient_for(GTK_WINDOW(widget_)) : NULL; } -bool WidgetGtk::MakeTransparent() { +bool NativeWidgetGtk::MakeTransparent() { // Transparency can only be enabled only if we haven't realized the widget. DCHECK(!widget_); @@ -359,7 +359,7 @@ bool WidgetGtk::MakeTransparent() { return true; } -void WidgetGtk::EnableDoubleBuffer(bool enabled) { +void NativeWidgetGtk::EnableDoubleBuffer(bool enabled) { is_double_buffered_ = enabled; if (window_contents_) { if (is_double_buffered_) @@ -369,11 +369,11 @@ void WidgetGtk::EnableDoubleBuffer(bool enabled) { } } -void WidgetGtk::AddChild(GtkWidget* child) { +void NativeWidgetGtk::AddChild(GtkWidget* child) { gtk_container_add(GTK_CONTAINER(window_contents_), child); } -void WidgetGtk::RemoveChild(GtkWidget* child) { +void NativeWidgetGtk::RemoveChild(GtkWidget* child) { // We can be called after the contents widget has been destroyed, e.g. any // NativeViewHost not removed from the view hierarchy before the window is // closed. @@ -383,16 +383,17 @@ void WidgetGtk::RemoveChild(GtkWidget* child) { } } -void WidgetGtk::ReparentChild(GtkWidget* child) { +void NativeWidgetGtk::ReparentChild(GtkWidget* child) { gtk_widget_reparent(child, window_contents_); } -void WidgetGtk::PositionChild(GtkWidget* child, int x, int y, int w, int h) { +void NativeWidgetGtk::PositionChild(GtkWidget* child, int x, int y, int w, + int h) { gtk_views_fixed_set_widget_size(child, w, h); gtk_fixed_move(GTK_FIXED(window_contents_), child, x, y); } -void WidgetGtk::DoDrag(const OSExchangeData& data, int operation) { +void NativeWidgetGtk::DoDrag(const OSExchangeData& data, int operation) { const OSExchangeDataProviderGtk& data_provider = static_cast<const OSExchangeDataProviderGtk&>(data.provider()); GtkTargetList* targets = data_provider.GetTargetList(); @@ -446,7 +447,7 @@ void WidgetGtk::DoDrag(const OSExchangeData& data, int operation) { } } -void WidgetGtk::IsActiveChanged() { +void NativeWidgetGtk::IsActiveChanged() { WidgetDelegate* d = GetWidget()->widget_delegate(); if (d) { bool a = IsActive(); @@ -454,7 +455,7 @@ void WidgetGtk::IsActiveChanged() { } } -void WidgetGtk::SetInitialFocus() { +void NativeWidgetGtk::SetInitialFocus() { if (!focus_on_creation_) return; @@ -464,12 +465,12 @@ void WidgetGtk::SetInitialFocus() { v->RequestFocus(); } -void WidgetGtk::ResetDropTarget() { +void NativeWidgetGtk::ResetDropTarget() { ignore_drag_leave_ = false; drop_target_.reset(NULL); } -void WidgetGtk::GetRequestedSize(gfx::Size* out) const { +void NativeWidgetGtk::GetRequestedSize(gfx::Size* out) const { int width, height; if (GTK_IS_VIEWS_FIXED(widget_) && gtk_views_fixed_get_widget_size(GetNativeView(), &width, &height)) { @@ -482,9 +483,9 @@ void WidgetGtk::GetRequestedSize(gfx::Size* out) const { } //////////////////////////////////////////////////////////////////////////////// -// WidgetGtk, ActiveWindowWatcherX::Observer implementation: +// NativeWidgetGtk, ActiveWindowWatcherX::Observer implementation: -void WidgetGtk::ActiveWindowChanged(GdkWindow* active_window) { +void NativeWidgetGtk::ActiveWindowChanged(GdkWindow* active_window) { if (!GetNativeView()) return; @@ -508,9 +509,9 @@ void WidgetGtk::ActiveWindowChanged(GdkWindow* active_window) { } //////////////////////////////////////////////////////////////////////////////// -// WidgetGtk, Widget implementation: +// NativeWidgetGtk, Widget implementation: -void WidgetGtk::ClearNativeFocus() { +void NativeWidgetGtk::ClearNativeFocus() { DCHECK(!child_); if (!GetNativeView()) { NOTREACHED(); @@ -519,7 +520,7 @@ void WidgetGtk::ClearNativeFocus() { gtk_window_set_focus(GTK_WINDOW(GetNativeView()), NULL); } -bool WidgetGtk::HandleKeyboardEvent(const KeyEvent& key) { +bool NativeWidgetGtk::HandleKeyboardEvent(const KeyEvent& key) { if (!GetWidget()->GetFocusManager()) return false; @@ -552,12 +553,13 @@ bool WidgetGtk::HandleKeyboardEvent(const KeyEvent& key) { } // static -void WidgetGtk::EnableDebugPaint() { +void NativeWidgetGtk::EnableDebugPaint() { debug_paint_enabled_ = true; } // static -void WidgetGtk::UpdateFreezeUpdatesProperty(GtkWindow* window, bool enable) { +void NativeWidgetGtk::UpdateFreezeUpdatesProperty(GtkWindow* window, + bool enable) { if (!GTK_WIDGET_REALIZED(GTK_WIDGET(window))) gtk_widget_realize(GTK_WIDGET(window)); GdkWindow* gdk_window = GTK_WIDGET(window)->window; @@ -583,7 +585,7 @@ void WidgetGtk::UpdateFreezeUpdatesProperty(GtkWindow* window, bool enable) { } // static -void WidgetGtk::RegisterChildExposeHandler(GtkWidget* child) { +void NativeWidgetGtk::RegisterChildExposeHandler(GtkWidget* child) { RemoveExposeHandlerIfExists(child); gulong id = g_signal_connect_after(child, "expose-event", G_CALLBACK(&ChildExposeHandler), NULL); @@ -592,16 +594,16 @@ void WidgetGtk::RegisterChildExposeHandler(GtkWidget* child) { } //////////////////////////////////////////////////////////////////////////////// -// WidgetGtk, NativeWidget implementation: +// NativeWidgetGtk, NativeWidget implementation: -void WidgetGtk::InitNativeWidget(const Widget::InitParams& params) { +void NativeWidgetGtk::InitNativeWidget(const Widget::InitParams& params) { SetInitParams(params); Widget::InitParams modified_params = params; gfx::NativeView parent = params.parent; if (params.parent_widget) { - WidgetGtk* parent_gtk = - static_cast<WidgetGtk*>(params.parent_widget->native_widget()); + NativeWidgetGtk* parent_gtk = + static_cast<NativeWidgetGtk*>(params.parent_widget->native_widget()); modified_params.parent = child_ ? parent_gtk->window_contents() : params.parent_widget->GetNativeView(); } @@ -735,75 +737,75 @@ void WidgetGtk::InitNativeWidget(const Widget::InitParams& params) { } } -Widget* WidgetGtk::GetWidget() { +Widget* NativeWidgetGtk::GetWidget() { return delegate_->AsWidget(); } -const Widget* WidgetGtk::GetWidget() const { +const Widget* NativeWidgetGtk::GetWidget() const { return delegate_->AsWidget(); } -gfx::NativeView WidgetGtk::GetNativeView() const { +gfx::NativeView NativeWidgetGtk::GetNativeView() const { return widget_; } -gfx::NativeWindow WidgetGtk::GetNativeWindow() const { +gfx::NativeWindow NativeWidgetGtk::GetNativeWindow() const { return child_ ? NULL : GTK_WINDOW(widget_); } -Window* WidgetGtk::GetContainingWindow() { +Window* NativeWidgetGtk::GetContainingWindow() { return GetWindowImpl(widget_); } -const Window* WidgetGtk::GetContainingWindow() const { +const Window* NativeWidgetGtk::GetContainingWindow() const { return GetWindowImpl(widget_); } -void WidgetGtk::ViewRemoved(View* view) { +void NativeWidgetGtk::ViewRemoved(View* view) { if (drop_target_.get()) drop_target_->ResetTargetViewIfEquals(view); } -void WidgetGtk::SetNativeWindowProperty(const char* name, void* value) { +void NativeWidgetGtk::SetNativeWindowProperty(const char* name, void* value) { g_object_set_data(G_OBJECT(widget_), name, value); } -void* WidgetGtk::GetNativeWindowProperty(const char* name) { +void* NativeWidgetGtk::GetNativeWindowProperty(const char* name) { return g_object_get_data(G_OBJECT(widget_), name); } -TooltipManager* WidgetGtk::GetTooltipManager() const { +TooltipManager* NativeWidgetGtk::GetTooltipManager() const { return tooltip_manager_.get(); } -bool WidgetGtk::IsScreenReaderActive() const { +bool NativeWidgetGtk::IsScreenReaderActive() const { return false; } -void WidgetGtk::SendNativeAccessibilityEvent( +void NativeWidgetGtk::SendNativeAccessibilityEvent( View* view, ui::AccessibilityTypes::Event event_type) { // In the future if we add native GTK accessibility support, the // notification should be sent here. } -void WidgetGtk::SetMouseCapture() { +void NativeWidgetGtk::SetMouseCapture() { DCHECK(!HasMouseCapture()); gtk_grab_add(window_contents_); } -void WidgetGtk::ReleaseMouseCapture() { +void NativeWidgetGtk::ReleaseMouseCapture() { if (HasMouseCapture()) gtk_grab_remove(window_contents_); } -bool WidgetGtk::HasMouseCapture() const { +bool NativeWidgetGtk::HasMouseCapture() const { // TODO(beng): Should be able to use gtk_widget_has_grab() here but the // trybots don't have Gtk 2.18. return GTK_WIDGET_HAS_GRAB(window_contents_); } -bool WidgetGtk::IsMouseButtonDown() const { +bool NativeWidgetGtk::IsMouseButtonDown() const { bool button_pressed = false; GdkEvent* event = gtk_get_current_event(); if (event) { @@ -815,11 +817,11 @@ bool WidgetGtk::IsMouseButtonDown() const { return button_pressed; } -InputMethod* WidgetGtk::GetInputMethodNative() { +InputMethod* NativeWidgetGtk::GetInputMethodNative() { return input_method_.get(); } -void WidgetGtk::ReplaceInputMethod(InputMethod* input_method) { +void NativeWidgetGtk::ReplaceInputMethod(InputMethod* input_method) { input_method_.reset(input_method); if (input_method) { input_method->set_delegate(this); @@ -827,12 +829,12 @@ void WidgetGtk::ReplaceInputMethod(InputMethod* input_method) { } } -gfx::Rect WidgetGtk::GetWindowScreenBounds() const { +gfx::Rect NativeWidgetGtk::GetWindowScreenBounds() const { // Client == Window bounds on Gtk. return GetClientAreaScreenBounds(); } -gfx::Rect WidgetGtk::GetClientAreaScreenBounds() const { +gfx::Rect NativeWidgetGtk::GetClientAreaScreenBounds() const { // Due to timing we can get a request for bounds after Close(). // TODO(beng): Figure out if this is bogus. if (!widget_) @@ -852,19 +854,19 @@ gfx::Rect WidgetGtk::GetClientAreaScreenBounds() const { return gfx::Rect(x, y, w, h); } -void WidgetGtk::SetBounds(const gfx::Rect& bounds) { +void NativeWidgetGtk::SetBounds(const gfx::Rect& bounds) { if (child_) { GtkWidget* parent = gtk_widget_get_parent(widget_); if (GTK_IS_VIEWS_FIXED(parent)) { - WidgetGtk* parent_widget = static_cast<WidgetGtk*>( + NativeWidgetGtk* parent_widget = static_cast<NativeWidgetGtk*>( NativeWidget::GetNativeWidgetForNativeView(parent)); parent_widget->PositionChild(widget_, bounds.x(), bounds.y(), bounds.width(), bounds.height()); } else { DCHECK(GTK_IS_FIXED(parent)) - << "Parent of WidgetGtk has to be Fixed or ViewsFixed"; - // Just request the size if the parent is not WidgetGtk but plain - // GtkFixed. WidgetGtk does not know the minimum size so we assume + << "Parent of NativeWidgetGtk has to be Fixed or ViewsFixed"; + // Just request the size if the parent is not NativeWidgetGtk but plain + // GtkFixed. NativeWidgetGtk does not know the minimum size so we assume // the caller of the SetBounds knows exactly how big it wants to be. gtk_widget_set_size_request(widget_, bounds.width(), bounds.height()); if (parent != null_parent_) @@ -890,14 +892,14 @@ void WidgetGtk::SetBounds(const gfx::Rect& bounds) { } } -void WidgetGtk::SetSize(const gfx::Size& size) { +void NativeWidgetGtk::SetSize(const gfx::Size& size) { if (child_) { GtkWidget* parent = gtk_widget_get_parent(widget_); if (GTK_IS_VIEWS_FIXED(parent)) { gtk_views_fixed_set_widget_size(widget_, size.width(), size.height()); } else { DCHECK(GTK_IS_FIXED(parent)) - << "Parent of WidgetGtk has to be Fixed or ViewsFixed"; + << "Parent of NativeWidgetGtk has to be Fixed or ViewsFixed"; gtk_widget_set_size_request(widget_, size.width(), size.height()); } } else { @@ -909,18 +911,18 @@ void WidgetGtk::SetSize(const gfx::Size& size) { } } -void WidgetGtk::MoveAbove(gfx::NativeView native_view) { +void NativeWidgetGtk::MoveAbove(gfx::NativeView native_view) { ui::StackPopupWindow(GetNativeView(), native_view); } -void WidgetGtk::SetShape(gfx::NativeRegion region) { +void NativeWidgetGtk::SetShape(gfx::NativeRegion region) { DCHECK(widget_); DCHECK(widget_->window); gdk_window_shape_combine_region(widget_->window, region, 0, 0); gdk_region_destroy(region); } -void WidgetGtk::Close() { +void NativeWidgetGtk::Close() { if (!widget_) return; // No need to do anything. @@ -930,18 +932,18 @@ void WidgetGtk::Close() { // And we delay the close just in case we're on the stack. MessageLoop::current()->PostTask(FROM_HERE, close_widget_factory_.NewRunnableMethod( - &WidgetGtk::CloseNow)); + &NativeWidgetGtk::CloseNow)); } } -void WidgetGtk::CloseNow() { +void NativeWidgetGtk::CloseNow() { if (widget_) { input_method_.reset(); gtk_widget_destroy(widget_); // Triggers OnDestroy(). } } -void WidgetGtk::Show() { +void NativeWidgetGtk::Show() { if (widget_) { gtk_widget_show(widget_); if (widget_->window) @@ -949,7 +951,7 @@ void WidgetGtk::Show() { } } -void WidgetGtk::Hide() { +void NativeWidgetGtk::Hide() { if (widget_) { gtk_widget_hide(widget_); if (widget_->window) @@ -957,7 +959,7 @@ void WidgetGtk::Hide() { } } -void WidgetGtk::SetOpacity(unsigned char opacity) { +void NativeWidgetGtk::SetOpacity(unsigned char opacity) { opacity_ = opacity; if (widget_) { // We can only set the opacity when the widget has been realized. @@ -966,39 +968,39 @@ void WidgetGtk::SetOpacity(unsigned char opacity) { } } -void WidgetGtk::SetAlwaysOnTop(bool on_top) { +void NativeWidgetGtk::SetAlwaysOnTop(bool on_top) { DCHECK(!child_); always_on_top_ = on_top; if (widget_) gtk_window_set_keep_above(GTK_WINDOW(widget_), on_top); } -bool WidgetGtk::IsVisible() const { +bool NativeWidgetGtk::IsVisible() const { return GTK_WIDGET_VISIBLE(widget_); } -bool WidgetGtk::IsActive() const { +bool NativeWidgetGtk::IsActive() const { DCHECK(!child_); return is_active_; } -bool WidgetGtk::IsAccessibleWidget() const { +bool NativeWidgetGtk::IsAccessibleWidget() const { return false; } -bool WidgetGtk::ContainsNativeView(gfx::NativeView native_view) const { - // TODO(port) See implementation in WidgetWin::ContainsNativeView. - NOTREACHED() << "WidgetGtk::ContainsNativeView is not implemented."; +bool NativeWidgetGtk::ContainsNativeView(gfx::NativeView native_view) const { + // TODO(port) See implementation in NativeWidgetWin::ContainsNativeView. + NOTREACHED() << "NativeWidgetGtk::ContainsNativeView is not implemented."; return false; } -void WidgetGtk::RunShellDrag(View* view, - const ui::OSExchangeData& data, - int operation) { +void NativeWidgetGtk::RunShellDrag(View* view, + const ui::OSExchangeData& data, + int operation) { DoDrag(data, operation); } -void WidgetGtk::SchedulePaintInRect(const gfx::Rect& rect) { +void NativeWidgetGtk::SchedulePaintInRect(const gfx::Rect& rect) { // No need to schedule paint if // 1) widget_ is NULL. This may happen because this instance may // be deleted after the gtk widget has been destroyed (See OnDestroy()). @@ -1011,7 +1013,7 @@ void WidgetGtk::SchedulePaintInRect(const gfx::Rect& rect) { } } -void WidgetGtk::SetCursor(gfx::NativeCursor cursor) { +void NativeWidgetGtk::SetCursor(gfx::NativeCursor cursor) { #if defined(TOUCH_UI) && defined(HAVE_XINPUT2) if (!TouchFactory::GetInstance()->is_cursor_visible() && !RootView::GetKeepMouseCursor()) @@ -1024,9 +1026,10 @@ void WidgetGtk::SetCursor(gfx::NativeCursor cursor) { } //////////////////////////////////////////////////////////////////////////////// -// WidgetGtk, protected: +// NativeWidgetGtk, protected: -void WidgetGtk::OnSizeRequest(GtkWidget* widget, GtkRequisition* requisition) { +void NativeWidgetGtk::OnSizeRequest(GtkWidget* widget, + GtkRequisition* requisition) { // Do only return the preferred size for child windows. GtkWindow interprets // the requisition as a minimum size for top level windows, returning a // preferred size for these would prevents us from setting smaller window @@ -1038,7 +1041,8 @@ void WidgetGtk::OnSizeRequest(GtkWidget* widget, GtkRequisition* requisition) { } } -void WidgetGtk::OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) { +void NativeWidgetGtk::OnSizeAllocate(GtkWidget* widget, + GtkAllocation* allocation) { // See comment next to size_ as to why we do this. Also note, it's tempting // to put this in the static method so subclasses don't need to worry about // it, but if a subclasses needs to set a shape then they need to always @@ -1050,7 +1054,7 @@ void WidgetGtk::OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) { delegate_->OnSizeChanged(size_); } -gboolean WidgetGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) { +gboolean NativeWidgetGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) { if (transparent_ && child_) { // Clear the background before drawing any view and native components. DrawTransparentBackground(widget, event); @@ -1097,11 +1101,11 @@ gboolean WidgetGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) { return false; // False indicates other widgets should get the event as well. } -void WidgetGtk::OnDragDataGet(GtkWidget* widget, - GdkDragContext* context, - GtkSelectionData* data, - guint info, - guint time) { +void NativeWidgetGtk::OnDragDataGet(GtkWidget* widget, + GdkDragContext* context, + GtkSelectionData* data, + guint info, + guint time) { if (!drag_data_) { NOTREACHED(); return; @@ -1109,29 +1113,29 @@ void WidgetGtk::OnDragDataGet(GtkWidget* widget, drag_data_->WriteFormatToSelection(info, data); } -void WidgetGtk::OnDragDataReceived(GtkWidget* widget, - GdkDragContext* context, - gint x, - gint y, - GtkSelectionData* data, - guint info, - guint time) { +void NativeWidgetGtk::OnDragDataReceived(GtkWidget* widget, + GdkDragContext* context, + gint x, + gint y, + GtkSelectionData* data, + guint info, + guint time) { if (drop_target_.get()) drop_target_->OnDragDataReceived(context, x, y, data, info, time); } -gboolean WidgetGtk::OnDragDrop(GtkWidget* widget, - GdkDragContext* context, - gint x, - gint y, - guint time) { +gboolean NativeWidgetGtk::OnDragDrop(GtkWidget* widget, + GdkDragContext* context, + gint x, + gint y, + guint time) { if (drop_target_.get()) { return drop_target_->OnDragDrop(context, x, y, time); } return FALSE; } -void WidgetGtk::OnDragEnd(GtkWidget* widget, GdkDragContext* context) { +void NativeWidgetGtk::OnDragEnd(GtkWidget* widget, GdkDragContext* context) { if (!drag_data_) { // This indicates we didn't start a drag operation, and should never // happen. @@ -1142,15 +1146,15 @@ void WidgetGtk::OnDragEnd(GtkWidget* widget, GdkDragContext* context) { MessageLoop::current()->Quit(); } -gboolean WidgetGtk::OnDragFailed(GtkWidget* widget, - GdkDragContext* context, - GtkDragResult result) { +gboolean NativeWidgetGtk::OnDragFailed(GtkWidget* widget, + GdkDragContext* context, + GtkDragResult result) { return FALSE; } -void WidgetGtk::OnDragLeave(GtkWidget* widget, - GdkDragContext* context, - guint time) { +void NativeWidgetGtk::OnDragLeave(GtkWidget* widget, + GdkDragContext* context, + guint time) { if (ignore_drag_leave_) { ignore_drag_leave_ = false; return; @@ -1161,17 +1165,18 @@ void WidgetGtk::OnDragLeave(GtkWidget* widget, } } -gboolean WidgetGtk::OnDragMotion(GtkWidget* widget, - GdkDragContext* context, - gint x, - gint y, - guint time) { +gboolean NativeWidgetGtk::OnDragMotion(GtkWidget* widget, + GdkDragContext* context, + gint x, + gint y, + guint time) { if (!drop_target_.get()) drop_target_.reset(new DropTargetGtk(GetWidget()->GetRootView(), context)); return drop_target_->OnDragMotion(context, x, y, time); } -gboolean WidgetGtk::OnEnterNotify(GtkWidget* widget, GdkEventCrossing* event) { +gboolean NativeWidgetGtk::OnEnterNotify(GtkWidget* widget, + GdkEventCrossing* event) { if (HasMouseCapture() && event->mode == GDK_CROSSING_GRAB) { // Doing a grab results an async enter event, regardless of where the mouse // is. We don't want to generate a mouse move in this case. @@ -1198,7 +1203,8 @@ gboolean WidgetGtk::OnEnterNotify(GtkWidget* widget, GdkEventCrossing* event) { return false; } -gboolean WidgetGtk::OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event) { +gboolean NativeWidgetGtk::OnLeaveNotify(GtkWidget* widget, + GdkEventCrossing* event) { GetWidget()->ResetLastMouseMoveFlag(); if (!HasMouseCapture() && !GetWidget()->is_mouse_button_pressed_) { @@ -1208,13 +1214,15 @@ gboolean WidgetGtk::OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event) { return false; } -gboolean WidgetGtk::OnMotionNotify(GtkWidget* widget, GdkEventMotion* event) { +gboolean NativeWidgetGtk::OnMotionNotify(GtkWidget* widget, + GdkEventMotion* event) { MouseEvent mouse_event(TransformEvent(event)); delegate_->OnMouseEvent(mouse_event); return true; } -gboolean WidgetGtk::OnButtonPress(GtkWidget* widget, GdkEventButton* event) { +gboolean NativeWidgetGtk::OnButtonPress(GtkWidget* widget, + GdkEventButton* event) { if (event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) { // The sequence for double clicks is press, release, press, 2press, release. // This means that at the time we get the second 'press' we don't know @@ -1232,7 +1240,8 @@ gboolean WidgetGtk::OnButtonPress(GtkWidget* widget, GdkEventButton* event) { return delegate_->OnMouseEvent(mouse_event) || !transparent_; } -gboolean WidgetGtk::OnButtonRelease(GtkWidget* widget, GdkEventButton* event) { +gboolean NativeWidgetGtk::OnButtonRelease(GtkWidget* widget, + GdkEventButton* event) { // GTK generates a mouse release at the end of dnd. We need to ignore it. if (!drag_data_) { MouseEvent mouse_event(TransformEvent(event)); @@ -1241,12 +1250,12 @@ gboolean WidgetGtk::OnButtonRelease(GtkWidget* widget, GdkEventButton* event) { return true; } -gboolean WidgetGtk::OnScroll(GtkWidget* widget, GdkEventScroll* event) { +gboolean NativeWidgetGtk::OnScroll(GtkWidget* widget, GdkEventScroll* event) { MouseEvent mouse_event(TransformEvent(event)); return delegate_->OnMouseEvent(mouse_event); } -gboolean WidgetGtk::OnFocusIn(GtkWidget* widget, GdkEventFocus* event) { +gboolean NativeWidgetGtk::OnFocusIn(GtkWidget* widget, GdkEventFocus* event) { if (has_focus_) return false; // This is the second focus-in event in a row, ignore it. has_focus_ = true; @@ -1268,7 +1277,7 @@ gboolean WidgetGtk::OnFocusIn(GtkWidget* widget, GdkEventFocus* event) { return false; } -gboolean WidgetGtk::OnFocusOut(GtkWidget* widget, GdkEventFocus* event) { +gboolean NativeWidgetGtk::OnFocusOut(GtkWidget* widget, GdkEventFocus* event) { if (!has_focus_) return false; // This is the second focus-out event in a row, ignore it. has_focus_ = false; @@ -1282,7 +1291,7 @@ gboolean WidgetGtk::OnFocusOut(GtkWidget* widget, GdkEventFocus* event) { return false; } -gboolean WidgetGtk::OnEventKey(GtkWidget* widget, GdkEventKey* event) { +gboolean NativeWidgetGtk::OnEventKey(GtkWidget* widget, GdkEventKey* event) { KeyEvent key(reinterpret_cast<NativeEvent>(event)); if (input_method_.get()) input_method_->DispatchKeyEvent(key); @@ -1293,49 +1302,49 @@ gboolean WidgetGtk::OnEventKey(GtkWidget* widget, GdkEventKey* event) { return true; } -gboolean WidgetGtk::OnQueryTooltip(GtkWidget* widget, - gint x, - gint y, - gboolean keyboard_mode, - GtkTooltip* tooltip) { +gboolean NativeWidgetGtk::OnQueryTooltip(GtkWidget* widget, + gint x, + gint y, + gboolean keyboard_mode, + GtkTooltip* tooltip) { return tooltip_manager_->ShowTooltip(x, y, keyboard_mode, tooltip); } -gboolean WidgetGtk::OnVisibilityNotify(GtkWidget* widget, - GdkEventVisibility* event) { +gboolean NativeWidgetGtk::OnVisibilityNotify(GtkWidget* widget, + GdkEventVisibility* event) { return false; } -gboolean WidgetGtk::OnGrabBrokeEvent(GtkWidget* widget, GdkEvent* event) { +gboolean NativeWidgetGtk::OnGrabBrokeEvent(GtkWidget* widget, GdkEvent* event) { HandleXGrabBroke(); return false; // To let other widgets get the event. } -void WidgetGtk::OnGrabNotify(GtkWidget* widget, gboolean was_grabbed) { +void NativeWidgetGtk::OnGrabNotify(GtkWidget* widget, gboolean was_grabbed) { if (!window_contents_) return; // Grab broke after window destroyed, don't try processing it. gtk_grab_remove(window_contents_); HandleGtkGrabBroke(); } -void WidgetGtk::OnDestroy(GtkWidget* object) { +void NativeWidgetGtk::OnDestroy(GtkWidget* object) { if (!child_) ActiveWindowWatcherX::RemoveObserver(this); // Note that this handler is hooked to GtkObject::destroy. - // NULL out pointers here since we might still be in an observerer list + // NULL out pointers here since we might still be in an observer list // until delstion happens. widget_ = window_contents_ = NULL; if (delete_on_destroy_) { - // Delays the deletion of this WidgetGtk as we want its children to have - // access to it when destroyed. + // Delays the deletion of this NativeWidgetGtk as we want its children to + // have access to it when destroyed. MessageLoop::current()->DeleteSoon(FROM_HERE, this); } } -void WidgetGtk::OnShow(GtkWidget* widget) { +void NativeWidgetGtk::OnShow(GtkWidget* widget) { } -void WidgetGtk::OnMap(GtkWidget* widget) { +void NativeWidgetGtk::OnMap(GtkWidget* widget) { #if defined(TOUCH_UI) // Force an expose event to trigger OnPaint for touch. This is // a workaround for a bug that X Expose event does not trigger @@ -1348,25 +1357,25 @@ void WidgetGtk::OnMap(GtkWidget* widget) { #endif } -void WidgetGtk::OnHide(GtkWidget* widget) { +void NativeWidgetGtk::OnHide(GtkWidget* widget) { } -void WidgetGtk::HandleXGrabBroke() { +void NativeWidgetGtk::HandleXGrabBroke() { } -void WidgetGtk::HandleGtkGrabBroke() { +void NativeWidgetGtk::HandleGtkGrabBroke() { delegate_->OnMouseCaptureLost(); } //////////////////////////////////////////////////////////////////////////////// -// WidgetGtk, private: +// NativeWidgetGtk, private: -gfx::AcceleratedWidget WidgetGtk::GetAcceleratedWidget() { +gfx::AcceleratedWidget NativeWidgetGtk::GetAcceleratedWidget() { DCHECK(window_contents_ && window_contents_->window); return GDK_WINDOW_XID(window_contents_->window); } -void WidgetGtk::DispatchKeyEventPostIME(const KeyEvent& key) { +void NativeWidgetGtk::DispatchKeyEventPostIME(const KeyEvent& key) { // Always reset |should_handle_menu_key_release_| unless we are handling a // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only // be activated when handling a VKEY_MENU key release event which is preceded @@ -1403,16 +1412,16 @@ void WidgetGtk::DispatchKeyEventPostIME(const KeyEvent& key) { gtk_bindings_activate_event(GTK_OBJECT(widget_), event); } -void WidgetGtk::SetInitParams(const Widget::InitParams& params) { +void NativeWidgetGtk::SetInitParams(const Widget::InitParams& params) { DCHECK(!GetNativeView()); delete_on_destroy_ = params.delete_on_destroy; child_ = params.child; // TODO(beng): The secondary checks here actually obviate the need for - // params.transient but that's only because WidgetGtk considers - // any top-level widget to be a transient widget. We will probably - // want to ammend this assumption at some point. + // params.transient but that's only because NativeWidgetGtk + // considers any top-level widget to be a transient widget. We + // will probably want to ammend this assumption at some point. if (params.transient || params.parent || params.parent_widget) transient_to_parent_ = true; if (params.transparent) @@ -1423,7 +1432,8 @@ void WidgetGtk::SetInitParams(const Widget::InitParams& params) { EnableDoubleBuffer(true); } -gboolean WidgetGtk::OnWindowPaint(GtkWidget* widget, GdkEventExpose* event) { +gboolean NativeWidgetGtk::OnWindowPaint(GtkWidget* widget, + GdkEventExpose* event) { // Clear the background to be totally transparent. We don't need to // paint the root view here as that is done by OnPaint. DCHECK(transparent_); @@ -1438,7 +1448,7 @@ gboolean WidgetGtk::OnWindowPaint(GtkWidget* widget, GdkEventExpose* event) { return false; } -void WidgetGtk::OnChildExpose(GtkWidget* child) { +void NativeWidgetGtk::OnChildExpose(GtkWidget* child) { DCHECK(!child_); if (!painted_) { painted_ = true; @@ -1448,23 +1458,23 @@ void WidgetGtk::OnChildExpose(GtkWidget* child) { } // static -gboolean WidgetGtk::ChildExposeHandler(GtkWidget* widget, - GdkEventExpose* event) { +gboolean NativeWidgetGtk::ChildExposeHandler(GtkWidget* widget, + GdkEventExpose* event) { GtkWidget* toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW); CHECK(toplevel); NativeWidget* native_widget = NativeWidget::GetNativeWidgetForNativeView(toplevel); CHECK(native_widget); - WidgetGtk* widget_gtk = static_cast<WidgetGtk*>(native_widget); + NativeWidgetGtk* widget_gtk = static_cast<NativeWidgetGtk*>(native_widget); widget_gtk->OnChildExpose(widget); return false; } // static -Window* WidgetGtk::GetWindowImpl(GtkWidget* widget) { +Window* NativeWidgetGtk::GetWindowImpl(GtkWidget* widget) { GtkWidget* parent = widget; while (parent) { - WidgetGtk* widget_gtk = static_cast<WidgetGtk*>( + NativeWidgetGtk* widget_gtk = static_cast<NativeWidgetGtk*>( NativeWidget::GetNativeWidgetForNativeView(parent)); if (widget_gtk && widget_gtk->is_window_) return static_cast<WindowGtk*>(widget_gtk)->GetWindow(); @@ -1473,7 +1483,7 @@ Window* WidgetGtk::GetWindowImpl(GtkWidget* widget) { return NULL; } -void WidgetGtk::CreateGtkWidget(const Widget::InitParams& params) { +void NativeWidgetGtk::CreateGtkWidget(const Widget::InitParams& params) { // We turn off double buffering for two reasons: // 1. We draw to a canvas then composite to the screen, which means we're // doing our own double buffering already. @@ -1537,14 +1547,14 @@ void WidgetGtk::CreateGtkWidget(const Widget::InitParams& params) { GTK_WIDGET_UNSET_FLAGS(widget_, GTK_DOUBLE_BUFFERED); // Gtk determines the size for windows based on the requested size of the - // child. For WidgetGtk the child is a fixed. If the fixed ends up with a - // child widget it's possible the child widget will drive the requested size - // of the widget, which we don't want. We explicitly set a value of 1x1 here - // so that gtk doesn't attempt to resize the window if we end up with a - // situation where the requested size of a child of the fixed is greater - // than the size of the window. By setting the size in this manner we're - // also allowing users of WidgetGtk to change the requested size at any - // time. + // child. For NativeWidgetGtk the child is a fixed. If the fixed ends up + // with a child widget it's possible the child widget will drive the + // requested size of the widget, which we don't want. We explicitly set a + // value of 1x1 here so that gtk doesn't attempt to resize the window if we + // end up with a situation where the requested size of a child of the fixed + // is greater than the size of the window. By setting the size in this + // manner we're also allowing users of WidgetGtk to change the requested + // size at any time. gtk_widget_set_size_request(widget_, 1, 1); if (!params.bounds.size().IsEmpty()) { @@ -1567,7 +1577,7 @@ void WidgetGtk::CreateGtkWidget(const Widget::InitParams& params) { gtk_container_add(GTK_CONTAINER(widget_), window_contents_); gtk_widget_show(window_contents_); g_object_set_data(G_OBJECT(window_contents_), kNativeWidgetKey, - static_cast<WidgetGtk*>(this)); + static_cast<NativeWidgetGtk*>(this)); if (transparent_) ConfigureWidgetForTransparentBackground(NULL); @@ -1587,7 +1597,8 @@ void WidgetGtk::CreateGtkWidget(const Widget::InitParams& params) { SetNativeWindowProperty(kNativeWidgetKey, this); } -void WidgetGtk::ConfigureWidgetForTransparentBackground(GtkWidget* parent) { +void NativeWidgetGtk::ConfigureWidgetForTransparentBackground( + GtkWidget* parent) { DCHECK(widget_ && window_contents_); GdkColormap* rgba_colormap = @@ -1617,7 +1628,7 @@ void WidgetGtk::ConfigureWidgetForTransparentBackground(GtkWidget* parent) { gtk_widget_set_colormap(window_contents_, rgba_colormap); } -void WidgetGtk::ConfigureWidgetForIgnoreEvents() { +void NativeWidgetGtk::ConfigureWidgetForIgnoreEvents() { gtk_widget_realize(widget_); GdkWindow* gdk_window = widget_->window; Display* display = GDK_WINDOW_XDISPLAY(gdk_window); @@ -1637,8 +1648,8 @@ void WidgetGtk::ConfigureWidgetForIgnoreEvents() { 0); } -void WidgetGtk::DrawTransparentBackground(GtkWidget* widget, - GdkEventExpose* event) { +void NativeWidgetGtk::DrawTransparentBackground(GtkWidget* widget, + GdkEventExpose* event) { cairo_t* cr = gdk_cairo_create(widget->window); cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); gdk_cairo_region(cr, event->region); @@ -1709,7 +1720,7 @@ bool Widget::ConvertRect(const Widget* source, // static NativeWidget* NativeWidget::CreateNativeWidget( internal::NativeWidgetDelegate* delegate) { - return new WidgetGtk(delegate); + return new NativeWidgetGtk(delegate); } // static @@ -1717,7 +1728,7 @@ NativeWidget* NativeWidget::GetNativeWidgetForNativeView( gfx::NativeView native_view) { if (!native_view) return NULL; - return reinterpret_cast<WidgetGtk*>( + return reinterpret_cast<NativeWidgetGtk*>( g_object_get_data(G_OBJECT(native_view), kNativeWidgetKey)); } @@ -1726,7 +1737,7 @@ NativeWidget* NativeWidget::GetNativeWidgetForNativeWindow( gfx::NativeWindow native_window) { if (!native_window) return NULL; - return reinterpret_cast<WidgetGtk*>( + return reinterpret_cast<NativeWidgetGtk*>( g_object_get_data(G_OBJECT(native_window), kNativeWidgetKey)); } diff --git a/views/widget/widget_gtk.h b/views/widget/native_widget_gtk.h index 54acfa6..7d75e12 100644 --- a/views/widget/widget_gtk.h +++ b/views/widget/native_widget_gtk.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef VIEWS_WIDGET_WIDGET_GTK_H_ -#define VIEWS_WIDGET_WIDGET_GTK_H_ +#ifndef VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ +#define VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ #pragma once #include <gtk/gtk.h> @@ -41,12 +41,12 @@ class NativeWidgetDelegate; } // Widget implementation for GTK. -class WidgetGtk : public NativeWidget, - public ui::ActiveWindowWatcherX::Observer, - public internal::InputMethodDelegate { +class NativeWidgetGtk : public NativeWidget, + public ui::ActiveWindowWatcherX::Observer, + public internal::InputMethodDelegate { public: - explicit WidgetGtk(internal::NativeWidgetDelegate* delegate); - virtual ~WidgetGtk(); + explicit NativeWidgetGtk(internal::NativeWidgetDelegate* delegate); + virtual ~NativeWidgetGtk(); // Returns the transient parent. See make_transient_to_parent for details on // what the transient parent is. @@ -82,10 +82,10 @@ class WidgetGtk : public NativeWidget, // Positions a child GtkWidget at the specified location and bounds. void PositionChild(GtkWidget* child, int x, int y, int w, int h); - // Parent GtkWidget all children are added to. When this WidgetGtk corresponds - // to a top level window, this is the GtkFixed within the GtkWindow, not the - // GtkWindow itself. For child widgets, this is the same GtkFixed as - // |widget_|. + // Parent GtkWidget all children are added to. When this NativeWidgetGtk + // corresponds to a top level window, this is the GtkFixed within the + // GtkWindow, not the GtkWindow itself. For child widgets, this is the same + // GtkFixed as |widget_|. GtkWidget* window_contents() const { return window_contents_; } // Starts a drag on this widget. This blocks until the drag is done. @@ -134,7 +134,7 @@ class WidgetGtk : public NativeWidget, // Registers a expose handler that removes FREEZE_UPDATES property. // If you are adding a GtkWidget with its own GdkWindow that may - // fill the entire area of the WidgetGtk to the view hierachy, you + // fill the entire area of the NativeWidgetGtk to the view hierachy, you // need use this function to tell WM that when the widget is ready // to be shown. // Caller of this method do not need to disconnect this because the @@ -205,42 +205,47 @@ class WidgetGtk : public NativeWidget, } // Event handlers: - CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnButtonPress, GdkEventButton*); - CHROMEGTK_CALLBACK_1(WidgetGtk, void, OnSizeRequest, GtkRequisition*); - CHROMEGTK_CALLBACK_1(WidgetGtk, void, OnSizeAllocate, GtkAllocation*); - CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnPaint, GdkEventExpose*); - CHROMEGTK_CALLBACK_4(WidgetGtk, void, OnDragDataGet, + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnButtonPress, + GdkEventButton*); + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, void, OnSizeRequest, GtkRequisition*); + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, void, OnSizeAllocate, GtkAllocation*); + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnPaint, GdkEventExpose*); + CHROMEGTK_CALLBACK_4(NativeWidgetGtk, void, OnDragDataGet, GdkDragContext*, GtkSelectionData*, guint, guint); - CHROMEGTK_CALLBACK_6(WidgetGtk, void, OnDragDataReceived, + CHROMEGTK_CALLBACK_6(NativeWidgetGtk, void, OnDragDataReceived, GdkDragContext*, gint, gint, GtkSelectionData*, guint, guint); - CHROMEGTK_CALLBACK_4(WidgetGtk, gboolean, OnDragDrop, + CHROMEGTK_CALLBACK_4(NativeWidgetGtk, gboolean, OnDragDrop, GdkDragContext*, gint, gint, guint); - CHROMEGTK_CALLBACK_1(WidgetGtk, void, OnDragEnd, GdkDragContext*); - CHROMEGTK_CALLBACK_2(WidgetGtk, gboolean, OnDragFailed, + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, void, OnDragEnd, GdkDragContext*); + CHROMEGTK_CALLBACK_2(NativeWidgetGtk, gboolean, OnDragFailed, GdkDragContext*, GtkDragResult); - CHROMEGTK_CALLBACK_2(WidgetGtk, void, OnDragLeave, + CHROMEGTK_CALLBACK_2(NativeWidgetGtk, void, OnDragLeave, GdkDragContext*, guint); - CHROMEGTK_CALLBACK_4(WidgetGtk, gboolean, OnDragMotion, + CHROMEGTK_CALLBACK_4(NativeWidgetGtk, gboolean, OnDragMotion, GdkDragContext*, gint, gint, guint); - CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnEnterNotify, GdkEventCrossing*); - CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnLeaveNotify, GdkEventCrossing*); - CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnMotionNotify, GdkEventMotion*); - CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnButtonRelease, GdkEventButton*); - CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnFocusIn, GdkEventFocus*); - CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnFocusOut, GdkEventFocus*); - CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnEventKey, GdkEventKey*); - CHROMEGTK_CALLBACK_4(WidgetGtk, gboolean, OnQueryTooltip, + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnEnterNotify, + GdkEventCrossing*); + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnLeaveNotify, + GdkEventCrossing*); + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnMotionNotify, + GdkEventMotion*); + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnButtonRelease, + GdkEventButton*); + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnFocusIn, GdkEventFocus*); + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnFocusOut, GdkEventFocus*); + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnEventKey, GdkEventKey*); + CHROMEGTK_CALLBACK_4(NativeWidgetGtk, gboolean, OnQueryTooltip, gint, gint, gboolean, GtkTooltip*); - CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnScroll, GdkEventScroll*); - CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnVisibilityNotify, + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnScroll, GdkEventScroll*); + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnVisibilityNotify, GdkEventVisibility*); - CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnGrabBrokeEvent, GdkEvent*); - CHROMEGTK_CALLBACK_1(WidgetGtk, void, OnGrabNotify, gboolean); - CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnDestroy); - CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnShow); - CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnMap); - CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnHide); + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnGrabBrokeEvent, GdkEvent*); + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, void, OnGrabNotify, gboolean); + CHROMEGTK_CALLBACK_0(NativeWidgetGtk, void, OnDestroy); + CHROMEGTK_CALLBACK_0(NativeWidgetGtk, void, OnShow); + CHROMEGTK_CALLBACK_0(NativeWidgetGtk, void, OnMap); + CHROMEGTK_CALLBACK_0(NativeWidgetGtk, void, OnHide); // Invoked when gtk grab is stolen by other GtkWidget in the same // application. @@ -266,7 +271,8 @@ class WidgetGtk : public NativeWidget, void SetInitParams(const Widget::InitParams& params); // This is called only when the window is transparent. - CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnWindowPaint, GdkEventExpose*); + CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnWindowPaint, + GdkEventExpose*); // Callbacks for expose event on child widgets. See the description of // RegisterChildChildExposeHandler. @@ -318,7 +324,7 @@ class WidgetGtk : public NativeWidget, scoped_ptr<DropTargetGtk> drop_target_; // The following factory is used to delay destruction. - ScopedRunnableMethodFactory<WidgetGtk> close_widget_factory_; + ScopedRunnableMethodFactory<NativeWidgetGtk> close_widget_factory_; // See class documentation for Widget in widget.h for a note about ownership. bool delete_on_destroy_; @@ -397,9 +403,9 @@ class WidgetGtk : public NativeWidget, scoped_ptr<InputMethod> input_method_; - DISALLOW_COPY_AND_ASSIGN(WidgetGtk); + DISALLOW_COPY_AND_ASSIGN(NativeWidgetGtk); }; } // namespace views -#endif // VIEWS_WIDGET_WIDGET_GTK_H_ +#endif // VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ diff --git a/views/widget/native_widget_test_utils_win.cc b/views/widget/native_widget_test_utils_win.cc index fd89efe..5f70439 100644 --- a/views/widget/native_widget_test_utils_win.cc +++ b/views/widget/native_widget_test_utils_win.cc @@ -5,7 +5,8 @@ #include "views/widget/native_widget_test_utils.h" #include "views/view.h" -#include "views/widget/widget_win.h" +#include "views/widget/native_widget.h" +#include "views/widget/widget.h" namespace views { namespace internal { diff --git a/views/widget/native_widget_unittest.cc b/views/widget/native_widget_unittest.cc index 91c29a3..7370840 100644 --- a/views/widget/native_widget_unittest.cc +++ b/views/widget/native_widget_unittest.cc @@ -10,10 +10,6 @@ #include "views/widget/widget.h" #include "views/widget/native_widget_test_utils.h" -#if defined(TOOLKIT_USES_GTK) -#include "views/widget/widget_gtk.h" -#endif - namespace views { class ScopedTestWidget { diff --git a/views/widget/widget_win.cc b/views/widget/native_widget_win.cc index 3d3a2b7..4a0899d 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/native_widget_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" #include <dwmapi.h> @@ -127,12 +127,12 @@ const int kCustomObjectID = 1; } // namespace // static -bool WidgetWin::screen_reader_active_ = false; +bool NativeWidgetWin::screen_reader_active_ = false; //////////////////////////////////////////////////////////////////////////////// -// WidgetWin, public: +// NativeWidgetWin, public: -WidgetWin::WidgetWin(internal::NativeWidgetDelegate* delegate) +NativeWidgetWin::NativeWidgetWin(internal::NativeWidgetDelegate* delegate) : delegate_(delegate), close_widget_factory_(this), active_mouse_tracking_flags_(0), @@ -149,7 +149,7 @@ WidgetWin::WidgetWin(internal::NativeWidgetDelegate* delegate) is_input_method_win_(false) { } -WidgetWin::~WidgetWin() { +NativeWidgetWin::~NativeWidgetWin() { // We need to delete the input method before calling DestroyRootView(), // because it'll set focus_manager_ to NULL. input_method_.reset(); @@ -158,7 +158,7 @@ WidgetWin::~WidgetWin() { } // static -bool WidgetWin::IsAeroGlassEnabled() { +bool NativeWidgetWin::IsAeroGlassEnabled() { if (base::win::GetVersion() < base::win::VERSION_VISTA) return false; // If composition is not enabled, we behave like on XP. @@ -166,14 +166,14 @@ bool WidgetWin::IsAeroGlassEnabled() { return SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled; } -View* WidgetWin::GetAccessibilityViewEventAt(int id) { +View* NativeWidgetWin::GetAccessibilityViewEventAt(int id) { // Convert from MSAA child id. id = -(id + 1); DCHECK(id >= 0 && id < kMaxAccessibilityViewEvents); return accessibility_view_events_[id]; } -int WidgetWin::AddAccessibilityViewEvent(View* view) { +int NativeWidgetWin::AddAccessibilityViewEvent(View* view) { accessibility_view_events_index_ = (accessibility_view_events_index_ + 1) % kMaxAccessibilityViewEvents; accessibility_view_events_[accessibility_view_events_index_] = view; @@ -182,7 +182,7 @@ int WidgetWin::AddAccessibilityViewEvent(View* view) { return -(accessibility_view_events_index_ + 1); } -void WidgetWin::ClearAccessibilityViewEvent(View* view) { +void NativeWidgetWin::ClearAccessibilityViewEvent(View* view) { for (std::vector<View*>::iterator it = accessibility_view_events_.begin(); it != accessibility_view_events_.end(); ++it) { @@ -192,9 +192,9 @@ void WidgetWin::ClearAccessibilityViewEvent(View* view) { } //////////////////////////////////////////////////////////////////////////////// -// WidgetWin, NativeWidget implementation: +// NativeWidgetWin, NativeWidget implementation: -void WidgetWin::InitNativeWidget(const Widget::InitParams& params) { +void NativeWidgetWin::InitNativeWidget(const Widget::InitParams& params) { SetInitParams(params); // Create the window. @@ -203,38 +203,38 @@ void WidgetWin::InitNativeWidget(const Widget::InitParams& params) { WindowImpl::Init(parent, params.bounds); } -Widget* WidgetWin::GetWidget() { +Widget* NativeWidgetWin::GetWidget() { return delegate_->AsWidget(); } -const Widget* WidgetWin::GetWidget() const { +const Widget* NativeWidgetWin::GetWidget() const { return delegate_->AsWidget(); } -gfx::NativeView WidgetWin::GetNativeView() const { +gfx::NativeView NativeWidgetWin::GetNativeView() const { return WindowImpl::hwnd(); } -gfx::NativeWindow WidgetWin::GetNativeWindow() const { +gfx::NativeWindow NativeWidgetWin::GetNativeWindow() const { return WindowImpl::hwnd(); } -Window* WidgetWin::GetContainingWindow() { +Window* NativeWidgetWin::GetContainingWindow() { return GetWindowImpl(hwnd()); } -const Window* WidgetWin::GetContainingWindow() const { +const Window* NativeWidgetWin::GetContainingWindow() const { return GetWindowImpl(hwnd()); } -void WidgetWin::ViewRemoved(View* view) { +void NativeWidgetWin::ViewRemoved(View* view) { if (drop_target_.get()) drop_target_->ResetTargetViewIfEquals(view); ClearAccessibilityViewEvent(view); } -void WidgetWin::SetNativeWindowProperty(const char* name, void* value) { +void NativeWidgetWin::SetNativeWindowProperty(const char* name, void* value) { // Remove the existing property (if any). for (ViewProps::iterator i = props_.begin(); i != props_.end(); ++i) { if ((*i)->Key() == name) { @@ -247,19 +247,19 @@ void WidgetWin::SetNativeWindowProperty(const char* name, void* value) { props_.push_back(new ViewProp(hwnd(), name, value)); } -void* WidgetWin::GetNativeWindowProperty(const char* name) { +void* NativeWidgetWin::GetNativeWindowProperty(const char* name) { return ViewProp::GetValue(hwnd(), name); } -TooltipManager* WidgetWin::GetTooltipManager() const { +TooltipManager* NativeWidgetWin::GetTooltipManager() const { return tooltip_manager_.get(); } -bool WidgetWin::IsScreenReaderActive() const { +bool NativeWidgetWin::IsScreenReaderActive() const { return screen_reader_active_; } -void WidgetWin::SendNativeAccessibilityEvent( +void NativeWidgetWin::SendNativeAccessibilityEvent( View* view, ui::AccessibilityTypes::Event event_type) { // Now call the Windows-specific method to notify MSAA clients of this @@ -272,20 +272,20 @@ void WidgetWin::SendNativeAccessibilityEvent( GetNativeView(), OBJID_CLIENT, child_id); } -void WidgetWin::SetMouseCapture() { +void NativeWidgetWin::SetMouseCapture() { DCHECK(!HasMouseCapture()); SetCapture(hwnd()); } -void WidgetWin::ReleaseMouseCapture() { +void NativeWidgetWin::ReleaseMouseCapture() { ReleaseCapture(); } -bool WidgetWin::HasMouseCapture() const { +bool NativeWidgetWin::HasMouseCapture() const { return GetCapture() == hwnd(); } -bool WidgetWin::IsMouseButtonDown() const { +bool NativeWidgetWin::IsMouseButtonDown() const { return (GetKeyState(VK_LBUTTON) & 0x80) || (GetKeyState(VK_RBUTTON) & 0x80) || (GetKeyState(VK_MBUTTON) & 0x80) || @@ -293,11 +293,11 @@ bool WidgetWin::IsMouseButtonDown() const { (GetKeyState(VK_XBUTTON2) & 0x80); } -InputMethod* WidgetWin::GetInputMethodNative() { +InputMethod* NativeWidgetWin::GetInputMethodNative() { return input_method_.get(); } -void WidgetWin::ReplaceInputMethod(InputMethod* input_method) { +void NativeWidgetWin::ReplaceInputMethod(InputMethod* input_method) { input_method_.reset(input_method); if (input_method) { input_method->set_delegate(this); @@ -306,13 +306,13 @@ void WidgetWin::ReplaceInputMethod(InputMethod* input_method) { is_input_method_win_ = false; } -gfx::Rect WidgetWin::GetWindowScreenBounds() const { +gfx::Rect NativeWidgetWin::GetWindowScreenBounds() const { RECT r; GetWindowRect(&r); return gfx::Rect(r); } -gfx::Rect WidgetWin::GetClientAreaScreenBounds() const { +gfx::Rect NativeWidgetWin::GetClientAreaScreenBounds() const { RECT r; GetClientRect(&r); POINT point = { r.left, r.top }; @@ -320,7 +320,7 @@ gfx::Rect WidgetWin::GetClientAreaScreenBounds() const { return gfx::Rect(point.x, point.y, r.right - r.left, r.bottom - r.top); } -void WidgetWin::SetBounds(const gfx::Rect& bounds) { +void NativeWidgetWin::SetBounds(const gfx::Rect& bounds) { LONG style = GetWindowLong(GWL_STYLE); if (style & WS_MAXIMIZE) SetWindowLong(GWL_STYLE, style & ~WS_MAXIMIZE); @@ -328,21 +328,21 @@ void WidgetWin::SetBounds(const gfx::Rect& bounds) { SWP_NOACTIVATE | SWP_NOZORDER); } -void WidgetWin::SetSize(const gfx::Size& size) { +void NativeWidgetWin::SetSize(const gfx::Size& size) { SetWindowPos(NULL, 0, 0, size.width(), size.height(), SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); } -void WidgetWin::MoveAbove(gfx::NativeView native_view) { +void NativeWidgetWin::MoveAbove(gfx::NativeView native_view) { SetWindowPos(native_view, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); } -void WidgetWin::SetShape(gfx::NativeRegion region) { +void NativeWidgetWin::SetShape(gfx::NativeRegion region) { SetWindowRgn(region, TRUE); } -void WidgetWin::Close() { +void NativeWidgetWin::Close() { if (!IsWindow()) return; // No need to do anything. @@ -356,11 +356,11 @@ void WidgetWin::Close() { // dereference us when the callback returns). MessageLoop::current()->PostTask(FROM_HERE, close_widget_factory_.NewRunnableMethod( - &WidgetWin::CloseNow)); + &NativeWidgetWin::CloseNow)); } } -void WidgetWin::CloseNow() { +void NativeWidgetWin::CloseNow() { // Destroys the input method before closing the window so that it can be // detached from the widget correctly. input_method_.reset(); @@ -374,7 +374,7 @@ void WidgetWin::CloseNow() { DestroyWindow(hwnd()); } -void WidgetWin::Show() { +void NativeWidgetWin::Show() { if (!IsWindow()) return; @@ -382,7 +382,7 @@ void WidgetWin::Show() { SetInitialFocus(); } -void WidgetWin::Hide() { +void NativeWidgetWin::Hide() { if (IsWindow()) { // NOTE: Be careful not to activate any windows here (for example, calling // ShowWindow(SW_HIDE) will automatically activate another window). This @@ -394,43 +394,43 @@ void WidgetWin::Hide() { } } -void WidgetWin::SetOpacity(unsigned char opacity) { +void NativeWidgetWin::SetOpacity(unsigned char opacity) { layered_alpha_ = static_cast<BYTE>(opacity); } -void WidgetWin::SetAlwaysOnTop(bool on_top) { +void NativeWidgetWin::SetAlwaysOnTop(bool on_top) { if (on_top) set_window_ex_style(window_ex_style() | WS_EX_TOPMOST); else set_window_ex_style(window_ex_style() & ~WS_EX_TOPMOST); } -bool WidgetWin::IsVisible() const { +bool NativeWidgetWin::IsVisible() const { return !!::IsWindowVisible(hwnd()); } -bool WidgetWin::IsActive() const { +bool NativeWidgetWin::IsActive() const { return IsWindowActive(hwnd()); } -bool WidgetWin::IsAccessibleWidget() const { +bool NativeWidgetWin::IsAccessibleWidget() const { return screen_reader_active_; } -bool WidgetWin::ContainsNativeView(gfx::NativeView native_view) const { +bool NativeWidgetWin::ContainsNativeView(gfx::NativeView native_view) const { return hwnd() == native_view || ::IsChild(hwnd(), native_view); } -void WidgetWin::RunShellDrag(View* view, - const ui::OSExchangeData& data, - int operation) { +void NativeWidgetWin::RunShellDrag(View* view, + const ui::OSExchangeData& data, + int operation) { scoped_refptr<ui::DragSource> drag_source(new ui::DragSource); DWORD effects; DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), drag_source, ui::DragDropTypes::DragOperationToDropEffect(operation), &effects); } -void WidgetWin::SchedulePaintInRect(const gfx::Rect& rect) { +void NativeWidgetWin::SchedulePaintInRect(const gfx::Rect& rect) { if (use_layered_buffer_) { // We must update the back-buffer immediately, since Windows' handling of // invalid rects is somewhat mysterious. @@ -444,7 +444,7 @@ void WidgetWin::SchedulePaintInRect(const gfx::Rect& rect) { if (paint_layered_window_factory_.empty()) { MessageLoop::current()->PostTask(FROM_HERE, paint_layered_window_factory_.NewRunnableMethod( - &WidgetWin::RedrawLayeredWindowContents)); + &NativeWidgetWin::RedrawLayeredWindowContents)); } } else { // InvalidateRect() expects client coordinates. @@ -453,7 +453,7 @@ void WidgetWin::SchedulePaintInRect(const gfx::Rect& rect) { } } -void WidgetWin::SetCursor(gfx::NativeCursor cursor) { +void NativeWidgetWin::SetCursor(gfx::NativeCursor cursor) { if(cursor) { previous_cursor_ = ::SetCursor(cursor); } else if (previous_cursor_) { @@ -463,31 +463,32 @@ void WidgetWin::SetCursor(gfx::NativeCursor cursor) { } //////////////////////////////////////////////////////////////////////////////// -// WidgetWin, MessageLoop::Observer implementation: +// NativeWidgetWin, MessageLoop::Observer implementation: -void WidgetWin::WillProcessMessage(const MSG& msg) { +void NativeWidgetWin::WillProcessMessage(const MSG& msg) { } -void WidgetWin::DidProcessMessage(const MSG& msg) { +void NativeWidgetWin::DidProcessMessage(const MSG& msg) { RedrawInvalidRect(); } //////////////////////////////////////////////////////////////////////////////// -// WidgetWin, WindowImpl overrides: +// NativeWidgetWin, WindowImpl overrides: -HICON WidgetWin::GetDefaultWindowIcon() const { +HICON NativeWidgetWin::GetDefaultWindowIcon() const { if (ViewsDelegate::views_delegate) return ViewsDelegate::views_delegate->GetDefaultWindowIcon(); return NULL; } -LRESULT WidgetWin::OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) { +LRESULT NativeWidgetWin::OnWndProc(UINT message, WPARAM w_param, + LPARAM l_param) { HWND window = hwnd(); LRESULT result = 0; // First allow messages sent by child controls to be processed directly by // their associated views. If such a view is present, it will handle the - // message *instead of* this WidgetWin. + // message *instead of* this NativeWidgetWin. if (ProcessChildWindowMessage(message, w_param, l_param, &result)) return result; @@ -508,40 +509,44 @@ LRESULT WidgetWin::OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) { } //////////////////////////////////////////////////////////////////////////////// -// WidgetWin, protected: +// NativeWidgetWin, protected: // Message handlers ------------------------------------------------------------ -void WidgetWin::OnActivate(UINT action, BOOL minimized, HWND window) { +void NativeWidgetWin::OnActivate(UINT action, BOOL minimized, HWND window) { SetMsgHandled(FALSE); } -void WidgetWin::OnActivateApp(BOOL active, DWORD thread_id) { +void NativeWidgetWin::OnActivateApp(BOOL active, DWORD thread_id) { SetMsgHandled(FALSE); } -LRESULT WidgetWin::OnAppCommand(HWND window, short app_command, WORD device, - int keystate) { +LRESULT NativeWidgetWin::OnAppCommand(HWND window, + short app_command, + WORD device, + int keystate) { SetMsgHandled(FALSE); return 0; } -void WidgetWin::OnCancelMode() { +void NativeWidgetWin::OnCancelMode() { } -void WidgetWin::OnCaptureChanged(HWND hwnd) { +void NativeWidgetWin::OnCaptureChanged(HWND hwnd) { delegate_->OnMouseCaptureLost(); } -void WidgetWin::OnClose() { +void NativeWidgetWin::OnClose() { Close(); } -void WidgetWin::OnCommand(UINT notification_code, int command_id, HWND window) { +void NativeWidgetWin::OnCommand(UINT notification_code, + int command_id, + HWND window) { SetMsgHandled(FALSE); } -LRESULT WidgetWin::OnCreate(CREATESTRUCT* create_struct) { +LRESULT NativeWidgetWin::OnCreate(CREATESTRUCT* create_struct) { SetNativeWindowProperty(kNativeWidgetKey, this); CHECK_EQ(this, GetNativeWidgetForNativeView(hwnd())); @@ -598,7 +603,7 @@ LRESULT WidgetWin::OnCreate(CREATESTRUCT* create_struct) { return 0; } -void WidgetWin::OnDestroy() { +void NativeWidgetWin::OnDestroy() { if (drop_target_.get()) { RevokeDragDrop(hwnd()); drop_target_ = NULL; @@ -607,40 +612,42 @@ void WidgetWin::OnDestroy() { props_.reset(); } -void WidgetWin::OnDisplayChange(UINT bits_per_pixel, CSize screen_size) { +void NativeWidgetWin::OnDisplayChange(UINT bits_per_pixel, CSize screen_size) { if (GetWidget()->widget_delegate()) GetWidget()->widget_delegate()->OnDisplayChanged(); } -LRESULT WidgetWin::OnDwmCompositionChanged(UINT msg, - WPARAM w_param, - LPARAM l_param) { +LRESULT NativeWidgetWin::OnDwmCompositionChanged(UINT msg, + WPARAM w_param, + LPARAM l_param) { SetMsgHandled(FALSE); return 0; } -void WidgetWin::OnEndSession(BOOL ending, UINT logoff) { +void NativeWidgetWin::OnEndSession(BOOL ending, UINT logoff) { SetMsgHandled(FALSE); } -void WidgetWin::OnEnterSizeMove() { +void NativeWidgetWin::OnEnterSizeMove() { SetMsgHandled(FALSE); } -LRESULT WidgetWin::OnEraseBkgnd(HDC dc) { +LRESULT NativeWidgetWin::OnEraseBkgnd(HDC dc) { // This is needed for magical win32 flicker ju-ju. return 1; } -void WidgetWin::OnExitMenuLoop(BOOL is_track_popup_menu) { +void NativeWidgetWin::OnExitMenuLoop(BOOL is_track_popup_menu) { SetMsgHandled(FALSE); } -void WidgetWin::OnExitSizeMove() { +void NativeWidgetWin::OnExitSizeMove() { SetMsgHandled(FALSE); } -LRESULT WidgetWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) { +LRESULT NativeWidgetWin::OnGetObject(UINT uMsg, + WPARAM w_param, + LPARAM l_param) { LRESULT reference_result = static_cast<LRESULT>(0L); // Accessibility readers will send an OBJID_CLIENT message @@ -667,15 +674,19 @@ LRESULT WidgetWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) { return reference_result; } -void WidgetWin::OnGetMinMaxInfo(MINMAXINFO* minmax_info) { +void NativeWidgetWin::OnGetMinMaxInfo(MINMAXINFO* minmax_info) { SetMsgHandled(FALSE); } -void WidgetWin::OnHScroll(int scroll_type, short position, HWND scrollbar) { +void NativeWidgetWin::OnHScroll(int scroll_type, + short position, + HWND scrollbar) { SetMsgHandled(FALSE); } -LRESULT WidgetWin::OnImeMessages(UINT message, WPARAM w_param, LPARAM l_param) { +LRESULT NativeWidgetWin::OnImeMessages(UINT message, + WPARAM w_param, + LPARAM l_param) { if (!is_input_method_win_) { SetMsgHandled(FALSE); return 0; @@ -714,24 +725,27 @@ LRESULT WidgetWin::OnImeMessages(UINT message, WPARAM w_param, LPARAM l_param) { return result; } -void WidgetWin::OnInitMenu(HMENU menu) { +void NativeWidgetWin::OnInitMenu(HMENU menu) { SetMsgHandled(FALSE); } -void WidgetWin::OnInitMenuPopup(HMENU menu, - UINT position, - BOOL is_system_menu) { +void NativeWidgetWin::OnInitMenuPopup(HMENU menu, + UINT position, + BOOL is_system_menu) { SetMsgHandled(FALSE); } -void WidgetWin::OnInputLangChange(DWORD character_set, HKL input_language_id) { +void NativeWidgetWin::OnInputLangChange(DWORD character_set, + HKL input_language_id) { if (is_input_method_win_) { static_cast<InputMethodWin*>(input_method_.get())->OnInputLangChange( character_set, input_language_id); } } -LRESULT WidgetWin::OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param) { +LRESULT NativeWidgetWin::OnKeyEvent(UINT message, + WPARAM w_param, + LPARAM l_param) { MSG msg = { hwnd(), message, w_param, l_param }; KeyEvent key(msg); if (input_method_.get()) @@ -741,23 +755,25 @@ LRESULT WidgetWin::OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param) { return 0; } -void WidgetWin::OnKillFocus(HWND focused_window) { +void NativeWidgetWin::OnKillFocus(HWND focused_window) { delegate_->OnNativeBlur(focused_window); if (input_method_.get()) input_method_->OnBlur(); SetMsgHandled(FALSE); } -LRESULT WidgetWin::OnMouseActivate(UINT message, - WPARAM w_param, - LPARAM l_param) { +LRESULT NativeWidgetWin::OnMouseActivate(UINT message, + WPARAM w_param, + LPARAM l_param) { if (GetWindowLong(GWL_EXSTYLE) & WS_EX_NOACTIVATE) return MA_NOACTIVATE; SetMsgHandled(FALSE); return MA_ACTIVATE; } -LRESULT WidgetWin::OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param) { +LRESULT NativeWidgetWin::OnMouseRange(UINT message, + WPARAM w_param, + LPARAM l_param) { MSG msg = { hwnd(), message, w_param, l_param, 0, { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; MouseEvent event(msg); @@ -772,8 +788,9 @@ LRESULT WidgetWin::OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param) { TrackMouseEvents((message == WM_NCMOUSEMOVE) ? TME_NONCLIENT | TME_LEAVE : TME_LEAVE); } else if (event.type() == ui::ET_MOUSE_EXITED) { - // Reset our tracking flags so future mouse movement over this WidgetWin - // results in a new tracking session. Fall through for OnMouseEvent. + // Reset our tracking flags so future mouse movement over this + // NativeWidgetWin results in a new tracking session. Fall through for + // OnMouseEvent. active_mouse_tracking_flags_ = 0; } else if (event.type() == ui::ET_MOUSEWHEEL) { // Reroute the mouse wheel to the window under the pointer if applicable. @@ -785,51 +802,53 @@ LRESULT WidgetWin::OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param) { return 0; } -void WidgetWin::OnMove(const CPoint& point) { +void NativeWidgetWin::OnMove(const CPoint& point) { // TODO(beng): move to Widget. if (GetWidget()->widget_delegate()) GetWidget()->widget_delegate()->OnWidgetMove(); SetMsgHandled(FALSE); } -void WidgetWin::OnMoving(UINT param, const LPRECT new_bounds) { +void NativeWidgetWin::OnMoving(UINT param, const LPRECT new_bounds) { // TODO(beng): move to Widget. if (GetWidget()->widget_delegate()) GetWidget()->widget_delegate()->OnWidgetMove(); } -LRESULT WidgetWin::OnNCActivate(BOOL active) { +LRESULT NativeWidgetWin::OnNCActivate(BOOL active) { SetMsgHandled(FALSE); return 0; } -LRESULT WidgetWin::OnNCCalcSize(BOOL w_param, LPARAM l_param) { +LRESULT NativeWidgetWin::OnNCCalcSize(BOOL w_param, LPARAM l_param) { SetMsgHandled(FALSE); return 0; } -LRESULT WidgetWin::OnNCHitTest(const CPoint& pt) { +LRESULT NativeWidgetWin::OnNCHitTest(const CPoint& pt) { SetMsgHandled(FALSE); return 0; } -void WidgetWin::OnNCPaint(HRGN rgn) { +void NativeWidgetWin::OnNCPaint(HRGN rgn) { SetMsgHandled(FALSE); } -LRESULT WidgetWin::OnNCUAHDrawCaption(UINT msg, - WPARAM w_param, - LPARAM l_param) { +LRESULT NativeWidgetWin::OnNCUAHDrawCaption(UINT msg, + WPARAM w_param, + LPARAM l_param) { SetMsgHandled(FALSE); return 0; } -LRESULT WidgetWin::OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param) { +LRESULT NativeWidgetWin::OnNCUAHDrawFrame(UINT msg, + WPARAM w_param, + LPARAM l_param) { SetMsgHandled(FALSE); return 0; } -LRESULT WidgetWin::OnNotify(int w_param, NMHDR* l_param) { +LRESULT NativeWidgetWin::OnNotify(int w_param, NMHDR* l_param) { // We can be sent this message before the tooltip manager is created, if a // subclass overrides OnCreate and creates some kind of Windows control there // that sends WM_NOTIFY messages. @@ -843,7 +862,7 @@ LRESULT WidgetWin::OnNotify(int w_param, NMHDR* l_param) { return 0; } -void WidgetWin::OnPaint(HDC dc) { +void NativeWidgetWin::OnPaint(HDC dc) { RECT dirty_rect; // Try to paint accelerated first. if (GetUpdateRect(hwnd(), &dirty_rect, FALSE) && @@ -859,7 +878,7 @@ void WidgetWin::OnPaint(HDC dc) { } } -LRESULT WidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) { +LRESULT NativeWidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) { base::SystemMonitor* monitor = base::SystemMonitor::Get(); if (monitor) monitor->ProcessWmPowerBroadcastMessage(power_event); @@ -867,77 +886,81 @@ LRESULT WidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) { return 0; } -LRESULT WidgetWin::OnReflectedMessage(UINT msg, - WPARAM w_param, - LPARAM l_param) { +LRESULT NativeWidgetWin::OnReflectedMessage(UINT msg, + WPARAM w_param, + LPARAM l_param) { SetMsgHandled(FALSE); return 0; } -LRESULT WidgetWin::OnSetCursor(UINT message, WPARAM w_param, LPARAM l_param) { +LRESULT NativeWidgetWin::OnSetCursor(UINT message, + WPARAM w_param, + LPARAM l_param) { SetMsgHandled(FALSE); return 0; } -void WidgetWin::OnSetFocus(HWND focused_window) { +void NativeWidgetWin::OnSetFocus(HWND focused_window) { delegate_->OnNativeFocus(focused_window); if (input_method_.get()) input_method_->OnFocus(); SetMsgHandled(FALSE); } -LRESULT WidgetWin::OnSetIcon(UINT size_type, HICON new_icon) { +LRESULT NativeWidgetWin::OnSetIcon(UINT size_type, HICON new_icon) { SetMsgHandled(FALSE); return 0; } -LRESULT WidgetWin::OnSetText(const wchar_t* text) { +LRESULT NativeWidgetWin::OnSetText(const wchar_t* text) { SetMsgHandled(FALSE); return 0; } -void WidgetWin::OnSettingChange(UINT flags, const wchar_t* section) { +void NativeWidgetWin::OnSettingChange(UINT flags, const wchar_t* section) { // TODO(beng): move to Widget. if (flags == SPI_SETWORKAREA && GetWidget()->widget_delegate()) GetWidget()->widget_delegate()->OnWorkAreaChanged(); SetMsgHandled(FALSE); } -void WidgetWin::OnSize(UINT param, const CSize& size) { +void NativeWidgetWin::OnSize(UINT param, const CSize& size) { SetMsgHandled(FALSE); } -void WidgetWin::OnSysCommand(UINT notification_code, CPoint click) { +void NativeWidgetWin::OnSysCommand(UINT notification_code, CPoint click) { } -void WidgetWin::OnThemeChanged() { +void NativeWidgetWin::OnThemeChanged() { // Notify NativeThemeWin. gfx::NativeThemeWin::instance()->CloseHandles(); } -void WidgetWin::OnVScroll(int scroll_type, short position, HWND scrollbar) { +void NativeWidgetWin::OnVScroll(int scroll_type, + short position, + HWND scrollbar) { SetMsgHandled(FALSE); } -void WidgetWin::OnWindowPosChanging(WINDOWPOS* window_pos) { +void NativeWidgetWin::OnWindowPosChanging(WINDOWPOS* window_pos) { SetMsgHandled(FALSE); } -void WidgetWin::OnWindowPosChanged(WINDOWPOS* window_pos) { +void NativeWidgetWin::OnWindowPosChanged(WINDOWPOS* window_pos) { if (DidClientAreaSizeChange(window_pos)) ClientAreaSizeChanged(); SetMsgHandled(FALSE); } -void WidgetWin::OnFinalMessage(HWND window) { +void NativeWidgetWin::OnFinalMessage(HWND window) { if (delete_on_destroy_) delete this; } //////////////////////////////////////////////////////////////////////////////// -// WidgetWin, protected: +// NativeWidgetWin, protected: -void WidgetWin::TrackMouseEvents(DWORD mouse_tracking_flags) { +void NativeWidgetWin::TrackMouseEvents(DWORD mouse_tracking_flags) { // Begin tracking mouse events for this HWND so that we get WM_MOUSELEAVE // when the user moves the mouse outside this HWND's bounds. if (active_mouse_tracking_flags_ == 0 || mouse_tracking_flags & TME_CANCEL) { @@ -961,11 +984,11 @@ void WidgetWin::TrackMouseEvents(DWORD mouse_tracking_flags) { } } -void WidgetWin::OnScreenReaderDetected() { +void NativeWidgetWin::OnScreenReaderDetected() { screen_reader_active_ = true; } -void WidgetWin::SetInitialFocus() { +void NativeWidgetWin::SetInitialFocus() { // TODO(beng): move to Widget. View* v = GetWidget()->widget_delegate() ? GetWidget()->widget_delegate()->GetInitiallyFocusedView() : NULL; @@ -974,16 +997,16 @@ void WidgetWin::SetInitialFocus() { } //////////////////////////////////////////////////////////////////////////////// -// WidgetWin, private: +// NativeWidgetWin, private: // static -Window* WidgetWin::GetWindowImpl(HWND hwnd) { +Window* NativeWidgetWin::GetWindowImpl(HWND hwnd) { // NOTE: we can't use GetAncestor here as constrained windows are a Window, // but not a top level window. HWND parent = hwnd; while (parent) { - WidgetWin* widget = - reinterpret_cast<WidgetWin*>(ui::GetWindowUserData(parent)); + NativeWidgetWin* widget = + reinterpret_cast<NativeWidgetWin*>(ui::GetWindowUserData(parent)); if (widget && widget->is_window_) return static_cast<WindowWin*>(widget)->GetWindow(); parent = ::GetParent(parent); @@ -992,8 +1015,8 @@ Window* WidgetWin::GetWindowImpl(HWND hwnd) { } // static -void WidgetWin::PostProcessActivateMessage(WidgetWin* widget, - int activation_state) { +void NativeWidgetWin::PostProcessActivateMessage(NativeWidgetWin* widget, + int activation_state) { if (!widget->delegate_->HasFocusManager()) { NOTREACHED(); return; @@ -1022,7 +1045,7 @@ void WidgetWin::PostProcessActivateMessage(WidgetWin* widget, } } -void WidgetWin::SetInitParams(const Widget::InitParams& params) { +void NativeWidgetWin::SetInitParams(const Widget::InitParams& params) { // Set non-style attributes. delete_on_destroy_ = params.delete_on_destroy; @@ -1069,7 +1092,7 @@ void WidgetWin::SetInitParams(const Widget::InitParams& params) { set_window_ex_style(window_ex_style() | ex_style); } -void WidgetWin::RedrawInvalidRect() { +void NativeWidgetWin::RedrawInvalidRect() { if (!use_layered_buffer_) { RECT r = { 0, 0, 0, 0 }; if (GetUpdateRect(hwnd(), &r, FALSE) && !IsRectEmpty(&r)) { @@ -1079,7 +1102,7 @@ void WidgetWin::RedrawInvalidRect() { } } -void WidgetWin::RedrawLayeredWindowContents() { +void NativeWidgetWin::RedrawLayeredWindowContents() { if (invalid_rect_.IsEmpty()) return; @@ -1105,7 +1128,7 @@ void WidgetWin::RedrawLayeredWindowContents() { layered_window_contents_->endPlatformPaint(); } -void WidgetWin::ClientAreaSizeChanged() { +void NativeWidgetWin::ClientAreaSizeChanged() { RECT r; Window* window = GetWidget()->GetContainingWindow(); if (IsZoomed() || (window && window->ShouldUseNativeFrame())) @@ -1121,12 +1144,12 @@ void WidgetWin::ClientAreaSizeChanged() { } } -gfx::AcceleratedWidget WidgetWin::GetAcceleratedWidget() { +gfx::AcceleratedWidget NativeWidgetWin::GetAcceleratedWidget() { // TODO(sky): return gfx::kNullAcceleratedWidget; } -void WidgetWin::DispatchKeyEventPostIME(const KeyEvent& key) { +void NativeWidgetWin::DispatchKeyEventPostIME(const KeyEvent& key) { SetMsgHandled(delegate_->OnKeyEvent(key)); } @@ -1184,13 +1207,13 @@ bool Widget::ConvertRect(const Widget* source, // static NativeWidget* NativeWidget::CreateNativeWidget( internal::NativeWidgetDelegate* delegate) { - return new WidgetWin(delegate); + return new NativeWidgetWin(delegate); } // static NativeWidget* NativeWidget::GetNativeWidgetForNativeView( gfx::NativeView native_view) { - return reinterpret_cast<WidgetWin*>( + return reinterpret_cast<NativeWidgetWin*>( ViewProp::GetValue(native_view, kNativeWidgetKey)); } diff --git a/views/widget/widget_win.h b/views/widget/native_widget_win.h index 79f3f49..72152fc 100644 --- a/views/widget/widget_win.h +++ b/views/widget/native_widget_win.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef VIEWS_WIDGET_WIDGET_WIN_H_ -#define VIEWS_WIDGET_WIDGET_WIN_H_ +#ifndef VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ +#define VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ #pragma once #include <atlbase.h> @@ -65,7 +65,7 @@ const int WM_NCUAHDRAWFRAME = 0xAF; /////////////////////////////////////////////////////////////////////////////// // -// WidgetWin +// NativeWidgetWin // A Widget for a views hierarchy used to represent anything that can be // contained within an HWND, e.g. a control, a window, etc. Specializations // suitable for specific tasks, e.g. top level window, are derived from this. @@ -76,13 +76,13 @@ const int WM_NCUAHDRAWFRAME = 0xAF; // then responsible for cleaning up after it. // /////////////////////////////////////////////////////////////////////////////// -class WidgetWin : public ui::WindowImpl, - public NativeWidget, - public MessageLoopForUI::Observer, - public internal::InputMethodDelegate { +class NativeWidgetWin : public ui::WindowImpl, + public NativeWidget, + public MessageLoopForUI::Observer, + public internal::InputMethodDelegate { public: - explicit WidgetWin(internal::NativeWidgetDelegate* delegate); - virtual ~WidgetWin(); + explicit NativeWidgetWin(internal::NativeWidgetDelegate* delegate); + virtual ~NativeWidgetWin(); // Returns true if we are on Windows Vista or greater and composition is // enabled. @@ -103,7 +103,7 @@ class WidgetWin : public ui::WindowImpl, // child id which is generated by: -(index of view in vector + 1) which // guarantees a negative child id. This distinguishes the view from // positive MSAA child id's which are direct leaf children of views that have - // associated hWnd's (e.g. WidgetWin). + // associated hWnd's (e.g. NativeWidgetWin). int AddAccessibilityViewEvent(View* view); // Clear a view that has recently been removed on a hierarchy change. @@ -222,7 +222,7 @@ class WidgetWin : public ui::WindowImpl, // Message Handlers ---------------------------------------------------------- - BEGIN_MSG_MAP_EX(WidgetWin) + BEGIN_MSG_MAP_EX(NativeWidgetWin) // Range handlers must go first! MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange) MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE, WM_NCXBUTTONDBLCLK, OnMouseRange) @@ -408,7 +408,7 @@ class WidgetWin : public ui::WindowImpl, // Called after the WM_ACTIVATE message has been processed by the default // windows procedure. - static void PostProcessActivateMessage(WidgetWin* widget, + static void PostProcessActivateMessage(NativeWidgetWin* widget, int activation_state); void SetInitParams(const Widget::InitParams& params); @@ -434,9 +434,9 @@ class WidgetWin : public ui::WindowImpl, // See class documentation for Widget in widget.h for a note about ownership. internal::NativeWidgetDelegate* delegate_; - // The following factory is used for calls to close the WidgetWin + // The following factory is used for calls to close the NativeWidgetWin // instance. - ScopedRunnableMethodFactory<WidgetWin> close_widget_factory_; + ScopedRunnableMethodFactory<NativeWidgetWin> close_widget_factory_; // The flags currently being used with TrackMouseEvent to track mouse // messages. 0 if there is no active tracking. The value of this member is @@ -472,7 +472,7 @@ class WidgetWin : public ui::WindowImpl, gfx::Rect invalid_rect_; // A factory that allows us to schedule a redraw for layered windows. - ScopedRunnableMethodFactory<WidgetWin> paint_layered_window_factory_; + ScopedRunnableMethodFactory<NativeWidgetWin> paint_layered_window_factory_; // See class documentation for Widget in widget.h for a note about ownership. bool delete_on_destroy_; @@ -513,9 +513,9 @@ class WidgetWin : public ui::WindowImpl, // Indicates if the |input_method_| is an InputMethodWin instance. bool is_input_method_win_; - DISALLOW_COPY_AND_ASSIGN(WidgetWin); + DISALLOW_COPY_AND_ASSIGN(NativeWidgetWin); }; } // namespace views -#endif // VIEWS_WIDGET_WIDGET_WIN_H_ +#endif // VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ diff --git a/views/widget/widget_win_unittest.cc b/views/widget/native_widget_win_unittest.cc index c9a33e8..cc59e75 100644 --- a/views/widget/widget_win_unittest.cc +++ b/views/widget/native_widget_win_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" @@ -12,13 +12,13 @@ namespace views { namespace { -class WidgetWinTest : public testing::Test { +class NativeWidgetWinTest : public testing::Test { public: - WidgetWinTest() { + NativeWidgetWinTest() { OleInitialize(NULL); } - ~WidgetWinTest() { + ~NativeWidgetWinTest() { OleUninitialize(); } @@ -30,7 +30,7 @@ class WidgetWinTest : public testing::Test { // Create a simple widget win. The caller is responsible for taking ownership // of the returned value. - WidgetWin* CreateWidgetWin(); + NativeWidgetWin* CreateNativeWidgetWin(); void RunPendingMessages() { message_loop_.RunAllPending(); @@ -39,20 +39,20 @@ class WidgetWinTest : public testing::Test { private: MessageLoopForUI message_loop_; - DISALLOW_COPY_AND_ASSIGN(WidgetWinTest); + DISALLOW_COPY_AND_ASSIGN(NativeWidgetWinTest); }; -WidgetWin* WidgetWinTest::CreateWidgetWin() { +NativeWidgetWin* NativeWidgetWinTest::CreateNativeWidgetWin() { scoped_ptr<Widget> widget(new Widget); Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); params.delete_on_destroy = false; params.bounds = gfx::Rect(50, 50, 650, 650); widget->Init(params); - return static_cast<WidgetWin*>(widget.release()->native_widget()); + return static_cast<NativeWidgetWin*>(widget.release()->native_widget()); } -TEST_F(WidgetWinTest, ZoomWindow) { - scoped_ptr<WidgetWin> window(CreateWidgetWin()); +TEST_F(NativeWidgetWinTest, ZoomWindow) { + scoped_ptr<NativeWidgetWin> window(CreateNativeWidgetWin()); window->ShowWindow(SW_HIDE); EXPECT_FALSE(window->IsActive()); window->ShowWindow(SW_MAXIMIZE); @@ -60,13 +60,13 @@ TEST_F(WidgetWinTest, ZoomWindow) { window->CloseNow(); } -TEST_F(WidgetWinTest, SetBoundsForZoomedWindow) { - scoped_ptr<WidgetWin> window(CreateWidgetWin()); +TEST_F(NativeWidgetWinTest, SetBoundsForZoomedWindow) { + scoped_ptr<NativeWidgetWin> window(CreateNativeWidgetWin()); window->ShowWindow(SW_MAXIMIZE); EXPECT_TRUE(window->IsZoomed()); // Create another window, so that it will be active. - scoped_ptr<WidgetWin> window2(CreateWidgetWin()); + scoped_ptr<NativeWidgetWin> window2(CreateNativeWidgetWin()); window2->ShowWindow(SW_MAXIMIZE); EXPECT_TRUE(window2->IsActive()); EXPECT_FALSE(window->IsActive()); diff --git a/views/widget/tooltip_manager_gtk.cc b/views/widget/tooltip_manager_gtk.cc index 7c8c0dd..909dc57 100644 --- a/views/widget/tooltip_manager_gtk.cc +++ b/views/widget/tooltip_manager_gtk.cc @@ -9,8 +9,8 @@ #include "ui/gfx/font.h" #include "views/focus/focus_manager.h" #include "views/screen.h" +#include "views/widget/native_widget_gtk.h" #include "views/widget/root_view.h" -#include "views/widget/widget_gtk.h" // WARNING: this implementation is good for a start, but it doesn't give us // control of tooltip positioning both on mouse events and when showing from @@ -71,7 +71,7 @@ int TooltipManager::GetMaxWidth(int x, int y) { return monitor_bounds.width() == 0 ? 800 : (monitor_bounds.width() + 1) / 2; } -TooltipManagerGtk::TooltipManagerGtk(WidgetGtk* widget) +TooltipManagerGtk::TooltipManagerGtk(NativeWidgetGtk* widget) : widget_(widget), keyboard_view_(NULL), tooltip_window_(widget->window_contents()) { diff --git a/views/widget/tooltip_manager_gtk.h b/views/widget/tooltip_manager_gtk.h index 0eb4aba..7ced5f3 100644 --- a/views/widget/tooltip_manager_gtk.h +++ b/views/widget/tooltip_manager_gtk.h @@ -13,12 +13,12 @@ namespace views { -class WidgetGtk; +class NativeWidgetGtk; // TooltipManager implementation for Gtk. class TooltipManagerGtk : public TooltipManager { public: - explicit TooltipManagerGtk(WidgetGtk* widget); + explicit TooltipManagerGtk(NativeWidgetGtk* widget); virtual ~TooltipManagerGtk() {} // Shows the tooltip at the specified location. Returns true if the tooltip @@ -37,7 +37,7 @@ class TooltipManagerGtk : public TooltipManager { bool SendShowHelpSignal(); // Our owner. - WidgetGtk* widget_; + NativeWidgetGtk* widget_; // The view supplied to the last invocation of ShowKeyboardTooltip. View* keyboard_view_; diff --git a/views/widget/tooltip_manager_win.h b/views/widget/tooltip_manager_win.h index d6a9a35..881ce20 100644 --- a/views/widget/tooltip_manager_win.h +++ b/views/widget/tooltip_manager_win.h @@ -28,7 +28,7 @@ class Widget; // TooltipManager implementation for Windows. // -// This class is intended to be used by WidgetWin. To use this, you must +// This class is intended to be used by NativeWidgetWin. To use this, you must // do the following: // Add the following to your MSG_MAP: // @@ -55,7 +55,7 @@ class Widget; // // Lastly, you'll need to override GetTooltipManager. // -// See WidgetWin for an example of this in action. +// See NativeWidgetWin for an example of this in action. class TooltipManagerWin : public TooltipManager { public: // Creates a TooltipManager for the specified Widget and parent window. diff --git a/views/widget/widget.cc b/views/widget/widget.cc index e02f8f9d..6e1e693 100644 --- a/views/widget/widget.cc +++ b/views/widget/widget.cc @@ -476,12 +476,12 @@ void Widget::DestroyRootView() { root_view_.reset(); // Defer focus manager's destruction. This is for the case when the - // focus manager is referenced by a child WidgetGtk (e.g. TabbedPane in a - // dialog). When gtk_widget_destroy is called on the parent, the destroy + // focus manager is referenced by a child NativeWidgetGtk (e.g. TabbedPane in + // a dialog). When gtk_widget_destroy is called on the parent, the destroy // signal reaches parent first and then the child. Thus causing the parent - // WidgetGtk's dtor executed before the child's. If child's view hierarchy - // references this focus manager, it crashes. This will defer focus manager's - // destruction after child WidgetGtk's dtor. + // NativeWidgetGtk's dtor executed before the child's. If child's view + // hierarchy references this focus manager, it crashes. This will defer focus + // manager's destruction after child NativeWidgetGtk's dtor. FocusManager* focus_manager = focus_manager_.release(); if (focus_manager) MessageLoop::current()->DeleteSoon(FROM_HERE, focus_manager); diff --git a/views/widget/widget.h b/views/widget/widget.h index 13d7b5b..f7c12ae 100644 --- a/views/widget/widget.h +++ b/views/widget/widget.h @@ -328,15 +328,15 @@ class Widget : public internal::NativeWidgetDelegate, virtual View* GetFocusTraversableParentView() OVERRIDE; protected: - // TODO(beng): Remove WidgetGtk's dependence on the mouse state flags. - friend class WidgetGtk; + // TODO(beng): Remove NativeWidgetGtk's dependence on the mouse state flags. + friend class NativeWidgetGtk; // Creates the RootView to be used within this Widget. Subclasses may override // to create custom RootViews that do specialized event processing. // TODO(beng): Investigate whether or not this is needed. virtual RootView* CreateRootView(); - // Provided to allow the WidgetWin/Gtk implementations to destroy the RootView + // Provided to allow the NativeWidget implementations to destroy the RootView // _before_ the focus manager/tooltip manager. // TODO(beng): remove once we fold those objects onto this one. void DestroyRootView(); @@ -344,12 +344,12 @@ class Widget : public internal::NativeWidgetDelegate, // Used for testing. void ReplaceFocusManager(FocusManager* focus_manager); - // TODO(beng): Remove WidgetGtk's dependence on these: + // TODO(beng): Remove NativeWidgetGtk's dependence on these: // TODO(msw): Make this mouse state member private. // If true, the mouse is currently down. bool is_mouse_button_pressed_; - // TODO(beng): Remove WidgetGtk's dependence on these: + // TODO(beng): Remove NativeWidgetGtk's dependence on these: // TODO(msw): Make these mouse state members private. // The following are used to detect duplicate mouse move events and not // deliver them. Displaying a window may result in the system generating diff --git a/views/window/native_frame_view.cc b/views/window/native_frame_view.cc index c78d6d1..55906ba 100644 --- a/views/window/native_frame_view.cc +++ b/views/window/native_frame_view.cc @@ -4,7 +4,7 @@ #include "views/window/native_frame_view.h" -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" #include "views/window/native_window.h" #include "views/window/window.h" @@ -31,8 +31,8 @@ gfx::Rect NativeFrameView::GetBoundsForClientView() const { gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds( const gfx::Rect& client_bounds) const { RECT rect = client_bounds.ToRECT(); - WidgetWin* widget_win = - static_cast<WidgetWin*>(frame_->native_window()->AsNativeWidget()); + NativeWidgetWin* widget_win = + static_cast<NativeWidgetWin*>(frame_->native_window()->AsNativeWidget()); AdjustWindowRectEx(&rect, widget_win->window_style(), FALSE, widget_win->window_ex_style()); return gfx::Rect(rect); diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc index 5d72ed8..af2770b 100644 --- a/views/window/window_gtk.cc +++ b/views/window/window_gtk.cc @@ -80,7 +80,7 @@ GdkCursorType HitTestCodeToGdkCursorType(int hittest_code) { namespace views { WindowGtk::WindowGtk(internal::NativeWindowDelegate* delegate) - : WidgetGtk(delegate->AsNativeWidgetDelegate()), + : NativeWidgetGtk(delegate->AsNativeWidgetDelegate()), delegate_(delegate), window_state_(GDK_WINDOW_STATE_WITHDRAWN), window_closed_(false) { @@ -91,7 +91,7 @@ WindowGtk::~WindowGtk() { } //////////////////////////////////////////////////////////////////////////////// -// WindowGtk, WidgetGtk overrides: +// WindowGtk, NativeWidgetGtk overrides: gboolean WindowGtk::OnButtonPress(GtkWidget* widget, GdkEventButton* event) { GdkEventButton transformed_event = *event; @@ -103,9 +103,9 @@ gboolean WindowGtk::OnButtonPress(GtkWidget* widget, GdkEventButton* event) { case HTCAPTION: { // Start dragging if the mouse event is a single click and *not* a right // click. If it is a right click, then pass it through to - // WidgetGtk::OnButtonPress so that View class can show ContextMenu upon a - // mouse release event. We only start drag on single clicks as we get a - // crash in Gtk on double/triple clicks. + // NativeWidgetGtk::OnButtonPress so that View class can show ContextMenu + // upon a mouse release event. We only start drag on single clicks as we + // get a crash in Gtk on double/triple clicks. if (event->type == GDK_BUTTON_PRESS && !mouse_event.IsOnlyRightMouseButton()) { gfx::Point screen_point(event->x, event->y); @@ -140,7 +140,7 @@ gboolean WindowGtk::OnButtonPress(GtkWidget* widget, GdkEventButton* event) { // Everything else falls into standard client event handling... break; } - return WidgetGtk::OnButtonPress(widget, event); + return NativeWidgetGtk::OnButtonPress(widget, event); } gboolean WindowGtk::OnConfigureEvent(GtkWidget* widget, @@ -162,11 +162,11 @@ gboolean WindowGtk::OnMotionNotify(GtkWidget* widget, GdkEventMotion* event) { gdk_window_set_cursor(widget->window, gfx::GetCursor(cursor_type)); } - return WidgetGtk::OnMotionNotify(widget, event); + return NativeWidgetGtk::OnMotionNotify(widget, event); } void WindowGtk::OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) { - WidgetGtk::OnSizeAllocate(widget, allocation); + NativeWidgetGtk::OnSizeAllocate(widget, allocation); // The Window's NonClientView may provide a custom shape for the Window. gfx::Path window_mask; @@ -192,16 +192,16 @@ gboolean WindowGtk::OnWindowStateEvent(GtkWidget* widget, gboolean WindowGtk::OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event) { gdk_window_set_cursor(widget->window, gfx::GetCursor(GDK_LEFT_PTR)); - return WidgetGtk::OnLeaveNotify(widget, event); + return NativeWidgetGtk::OnLeaveNotify(widget, event); } void WindowGtk::IsActiveChanged() { - WidgetGtk::IsActiveChanged(); + NativeWidgetGtk::IsActiveChanged(); delegate_->OnNativeWindowActivationChanged(IsActive()); } void WindowGtk::InitNativeWidget(const Widget::InitParams& params) { - WidgetGtk::InitNativeWidget(params); + NativeWidgetGtk::InitNativeWidget(params); g_signal_connect(G_OBJECT(GetNativeWindow()), "configure-event", G_CALLBACK(CallConfigureEvent), this); @@ -297,7 +297,7 @@ const Window* WindowGtk::GetWindow() const { void WindowGtk::SetWindowBounds(const gfx::Rect& bounds, gfx::NativeWindow other_window) { // TODO: need to deal with other_window. - WidgetGtk::SetBounds(bounds); + NativeWidgetGtk::SetBounds(bounds); } void WindowGtk::HideWindow() { @@ -330,7 +330,7 @@ void WindowGtk::Restore() { } bool WindowGtk::IsActive() const { - return WidgetGtk::IsActive(); + return NativeWidgetGtk::IsActive(); } bool WindowGtk::IsVisible() const { @@ -419,7 +419,7 @@ void WindowGtk::SaveWindowPosition() { void WindowGtk::OnDestroy(GtkWidget* widget) { delegate_->OnNativeWindowDestroying(); - WidgetGtk::OnDestroy(widget); + NativeWidgetGtk::OnDestroy(widget); delegate_->OnNativeWindowDestroyed(); } diff --git a/views/window/window_gtk.h b/views/window/window_gtk.h index b235349..15a0c08 100644 --- a/views/window/window_gtk.h +++ b/views/window/window_gtk.h @@ -7,7 +7,7 @@ #pragma once #include "base/basictypes.h" -#include "views/widget/widget_gtk.h" +#include "views/widget/native_widget_gtk.h" #include "views/window/native_window.h" #include "views/window/window.h" @@ -25,7 +25,7 @@ class Client; class WindowDelegate; // Window implementation for GTK. -class WindowGtk : public WidgetGtk, public NativeWindow { +class WindowGtk : public NativeWidgetGtk, public NativeWindow { public: explicit WindowGtk(internal::NativeWindowDelegate* delegate); virtual ~WindowGtk(); @@ -33,7 +33,7 @@ class WindowGtk : public WidgetGtk, public NativeWindow { virtual Window* GetWindow() OVERRIDE; virtual const Window* GetWindow() const OVERRIDE; - // Overridden from WidgetGtk: + // Overridden from NativeWidgetGtk: virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event); virtual gboolean OnConfigureEvent(GtkWidget* widget, GdkEventConfigure* event); diff --git a/views/window/window_win.cc b/views/window/window_win.cc index f50cefa..bdae725 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -234,7 +234,7 @@ class WindowWin::ScopedRedrawLock { // WindowWin, public: WindowWin::WindowWin(internal::NativeWindowDelegate* delegate) - : WidgetWin(delegate->AsNativeWidgetDelegate()), + : NativeWidgetWin(delegate->AsNativeWidgetDelegate()), delegate_(delegate), focus_on_creation_(true), restored_enabled_(false), @@ -308,7 +308,7 @@ gfx::Font WindowWin::GetWindowTitleFont() { gfx::Insets WindowWin::GetClientAreaInsets() const { // Returning an empty Insets object causes the default handling in - // WidgetWin::OnNCCalcSize() to be invoked. + // NativeWidgetWin::OnNCCalcSize() to be invoked. if (GetWindow()->ShouldUseNativeFrame()) return gfx::Insets(); @@ -338,7 +338,7 @@ int WindowWin::GetShowState() const { } /////////////////////////////////////////////////////////////////////////////// -// WindowWin, WidgetWin overrides: +// WindowWin, NativeWidgetWin overrides: void WindowWin::InitNativeWidget(const Widget::InitParams& params) { if (window_style() == 0) @@ -349,7 +349,7 @@ void WindowWin::InitNativeWidget(const Widget::InitParams& params) { GetMonitorAndRects(params.bounds.ToRECT(), &last_monitor_, &last_monitor_rect_, &last_work_area_); - WidgetWin::InitNativeWidget(params); + NativeWidgetWin::InitNativeWidget(params); } void WindowWin::OnActivateApp(BOOL active, DWORD thread_id) { @@ -368,7 +368,7 @@ LRESULT WindowWin::OnAppCommand(HWND window, short app_command, WORD device, // We treat APPCOMMAND ids as an extension of our command namespace, and just // let the delegate figure out what to do... return GetWindow()->window_delegate()->ExecuteWindowsCommand(app_command) || - WidgetWin::OnAppCommand(window, app_command, device, keystate); + NativeWidgetWin::OnAppCommand(window, app_command, device, keystate); } void WindowWin::OnClose() { @@ -380,14 +380,14 @@ void WindowWin::OnCommand(UINT notification_code, int command_id, HWND window) { // should ignore it. if (notification_code > 1 || GetWindow()->window_delegate()->ExecuteWindowsCommand(command_id)) { - WidgetWin::OnCommand(notification_code, command_id, window); + NativeWidgetWin::OnCommand(notification_code, command_id, window); } } void WindowWin::OnDestroy() { delegate_->OnNativeWindowDestroying(); RestoreEnabledIfNecessary(); - WidgetWin::OnDestroy(); + NativeWidgetWin::OnDestroy(); } LRESULT WindowWin::OnDwmCompositionChanged(UINT msg, WPARAM w_param, @@ -403,32 +403,32 @@ LRESULT WindowWin::OnDwmCompositionChanged(UINT msg, WPARAM w_param, } void WindowWin::OnEnterSizeMove() { - WidgetWin::OnEnterSizeMove(); + NativeWidgetWin::OnEnterSizeMove(); delegate_->OnNativeWindowBeginUserBoundsChange(); } void WindowWin::OnExitSizeMove() { - WidgetWin::OnExitSizeMove(); + NativeWidgetWin::OnExitSizeMove(); delegate_->OnNativeWindowEndUserBoundsChange(); } void WindowWin::OnFinalMessage(HWND window) { delegate_->OnNativeWindowDestroyed(); - WidgetWin::OnFinalMessage(window); + NativeWidgetWin::OnFinalMessage(window); } void WindowWin::OnGetMinMaxInfo(MINMAXINFO* minmax_info) { gfx::Size min_window_size(delegate_->GetMinimumSize()); minmax_info->ptMinTrackSize.x = min_window_size.width(); minmax_info->ptMinTrackSize.y = min_window_size.height(); - WidgetWin::OnGetMinMaxInfo(minmax_info); + NativeWidgetWin::OnGetMinMaxInfo(minmax_info); } void WindowWin::OnInitMenu(HMENU menu) { // We only need to manually enable the system menu if we're not using a native // frame. if (GetWindow()->ShouldUseNativeFrame()) - WidgetWin::OnInitMenu(menu); + NativeWidgetWin::OnInitMenu(menu); bool is_fullscreen = IsFullscreen(); bool is_minimized = IsMinimized(); @@ -512,18 +512,18 @@ LRESULT WindowWin::OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param) { can't be enabled. if (message == WM_NCLBUTTONDOWN) { // WindowWin::OnNCLButtonDown set the message as unhandled. This normally - // means WidgetWin::ProcessWindowMessage will pass it to + // means NativeWidgetWin::ProcessWindowMessage will pass it to // DefWindowProc. Sadly, DefWindowProc for WM_NCLBUTTONDOWN does weird // non-client painting, so we need to call it directly here inside a // scoped update lock. ScopedRedrawLock lock(this); - WidgetWin::OnMouseRange(message, w_param, l_param); + NativeWidgetWin::OnMouseRange(message, w_param, l_param); DefWindowProc(GetNativeView(), WM_NCLBUTTONDOWN, w_param, l_param); SetMsgHandled(TRUE); } */ - WidgetWin::OnMouseRange(message, w_param, l_param); + NativeWidgetWin::OnMouseRange(message, w_param, l_param); return 0; } @@ -578,7 +578,7 @@ LRESULT WindowWin::OnNCCalcSize(BOOL mode, LPARAM l_param) { // custom width, but in fullscreen mode we want a custom width of 0. gfx::Insets insets = GetClientAreaInsets(); if (insets.empty() && !IsFullscreen()) - return WidgetWin::OnNCCalcSize(mode, l_param); + return NativeWidgetWin::OnNCCalcSize(mode, l_param); RECT* client_rect = mode ? &reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param)->rgrc[0] : @@ -673,7 +673,7 @@ LRESULT WindowWin::OnNCHitTest(const CPoint& point) { // Otherwise, we let Windows do all the native frame non-client handling for // us. - return WidgetWin::OnNCHitTest(point); + return NativeWidgetWin::OnNCHitTest(point); } namespace { @@ -710,7 +710,7 @@ void WindowWin::OnNCPaint(HRGN rgn) { // It's required to avoid some native painting artifacts from appearing when // the window is resized. if (GetWindow()->ShouldUseNativeFrame()) { - WidgetWin::OnNCPaint(rgn); + NativeWidgetWin::OnNCPaint(rgn); return; } @@ -834,7 +834,7 @@ void WindowWin::OnSettingChange(UINT flags, const wchar_t* section) { SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOOWNERZORDER); SetMsgHandled(TRUE); } else { - WidgetWin::OnSettingChange(flags, section); + NativeWidgetWin::OnSettingChange(flags, section); } } @@ -962,11 +962,11 @@ void WindowWin::OnWindowPosChanging(WINDOWPOS* window_pos) { } } - WidgetWin::OnWindowPosChanging(window_pos); + NativeWidgetWin::OnWindowPosChanging(window_pos); } void WindowWin::Close() { - WidgetWin::Close(); + NativeWidgetWin::Close(); // If the user activates another app after opening us, then comes back and // closes us, we want our owner to gain activation. But only if the owner @@ -1315,7 +1315,7 @@ gfx::NativeWindow WindowWin::GetNativeWindow() const { } bool WindowWin::ShouldUseNativeFrame() const { - return WidgetWin::IsAeroGlassEnabled(); + return NativeWidgetWin::IsAeroGlassEnabled(); } void WindowWin::FrameTypeChanged() { diff --git a/views/window/window_win.h b/views/window/window_win.h index c829e13..286c3a0 100644 --- a/views/window/window_win.h +++ b/views/window/window_win.h @@ -6,7 +6,7 @@ #define VIEWS_WINDOW_WINDOW_WIN_H_ #pragma once -#include "views/widget/widget_win.h" +#include "views/widget/native_widget_win.h" #include "views/window/native_window.h" #include "views/window/window.h" @@ -32,15 +32,16 @@ void EnsureRectIsVisibleInRect(const gfx::Rect& parent_rect, class Client; class WindowDelegate; -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// // // WindowWin // -// A WindowWin is a WidgetWin that has a caption and a border. The frame is -// rendered by the operating system. +// A WindowWin is a NativeWidgetWin that encapsulates a window with a frame. +// The frame may or may not be rendered by the operating system. The window may +// or may not be top level. // -/////////////////////////////////////////////////////////////////////////////// -class WindowWin : public WidgetWin, +//////////////////////////////////////////////////////////////////////////////// +class WindowWin : public NativeWidgetWin, public NativeWindow { public: explicit WindowWin(internal::NativeWindowDelegate* delegate); @@ -85,7 +86,7 @@ class WindowWin : public WidgetWin, // show state from the shortcut starutp info). virtual int GetShowState() const; - // Overridden from WidgetWin: + // Overridden from NativeWidgetWin: virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; virtual void OnActivateApp(BOOL active, DWORD thread_id) OVERRIDE; virtual LRESULT OnAppCommand(HWND window, |