summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-11 23:17:36 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-11 23:17:36 +0000
commitb022f3639b133d47fad75ae9419061680369064e (patch)
treecc731aad202dcce650ea563097a02af468dc9e0e /views
parenta17930d85c1a30bcb97c793ba08d2e6ea019deb6 (diff)
downloadchromium_src-b022f3639b133d47fad75ae9419061680369064e.zip
chromium_src-b022f3639b133d47fad75ae9419061680369064e.tar.gz
chromium_src-b022f3639b133d47fad75ae9419061680369064e.tar.bz2
Rename Widgetwin->NativeWidgetWin
BUG=72040 TEST=none TBR=sky Review URL: http://codereview.chromium.org/6510001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74693 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/accessibility/view_accessibility.cc13
-rw-r--r--views/controls/menu/menu_host_win.cc8
-rw-r--r--views/controls/menu/menu_host_win.h6
-rw-r--r--views/controls/tabbed_pane/native_tabbed_pane_win.cc4
-rw-r--r--views/controls/tabbed_pane/native_tabbed_pane_win.h4
-rw-r--r--views/focus/focus_manager_unittest.cc8
-rw-r--r--views/focus/focus_manager_win.cc4
-rw-r--r--views/view_unittest.cc16
-rw-r--r--views/view_win.cc4
-rw-r--r--views/views.gyp10
-rw-r--r--views/widget/default_theme_provider.cc4
-rw-r--r--views/widget/native_widget_win.cc (renamed from views/widget/widget_win.cc)361
-rw-r--r--views/widget/native_widget_win.h (renamed from views/widget/widget_win.h)38
-rw-r--r--views/widget/native_widget_win_unittest.cc (renamed from views/widget/widget_win_unittest.cc)26
-rw-r--r--views/window/window_win.cc54
-rw-r--r--views/window/window_win.h13
16 files changed, 291 insertions, 282 deletions
diff --git a/views/accessibility/view_accessibility.cc b/views/accessibility/view_accessibility.cc
index c7ab6cc..fd93aba 100644
--- a/views/accessibility/view_accessibility.cc
+++ b/views/accessibility/view_accessibility.cc
@@ -6,8 +6,8 @@
#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"
const char kViewsNativeHostPropForAccessibility[] =
"Views_NativeViewHostHWNDForAccessibility";
@@ -35,8 +35,8 @@ IAccessible* ViewAccessibility::GetAccessibleForView(views::View* view) {
// 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;
@@ -249,9 +249,10 @@ STDMETHODIMP ViewAccessibility::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());
+ // Negative values are used for events fired using the view's
+ // NativeWidgetWin.
+ views::NativeWidgetWin* widget =
+ static_cast<views::NativeWidgetWin*>(view_->GetWidget());
child_view = widget->GetAccessibilityViewEventAt(child_id);
}
diff --git a/views/controls/menu/menu_host_win.cc b/views/controls/menu/menu_host_win.cc
index c22dcb9..2be9ad5 100644
--- a/views/controls/menu/menu_host_win.cc
+++ b/views/controls/menu/menu_host_win.cc
@@ -42,7 +42,7 @@ void MenuHostWin::Init(HWND parent,
const gfx::Rect& bounds,
View* contents_view,
bool do_capture) {
- WidgetWin::Init(parent, bounds);
+ NativeWidgetWin::Init(parent, bounds);
SetContentsView(contents_view);
ShowMenuHost(do_capture);
}
@@ -63,7 +63,7 @@ void MenuHostWin::HideMenuHost() {
// Make sure we release capture before hiding.
ReleaseMenuHostCapture();
- WidgetWin::Hide();
+ NativeWidgetWin::Hide();
}
void MenuHostWin::DestroyMenuHost() {
@@ -94,11 +94,11 @@ void MenuHostWin::OnDestroy() {
// the SubmenuView to drop references to us.
submenu_->MenuHostDestroyed();
}
- WidgetWin::OnDestroy();
+ NativeWidgetWin::OnDestroy();
}
void MenuHostWin::OnCaptureChanged(HWND hwnd) {
- WidgetWin::OnCaptureChanged(hwnd);
+ NativeWidgetWin::OnCaptureChanged(hwnd);
owns_capture_ = false;
}
diff --git a/views/controls/menu/menu_host_win.h b/views/controls/menu/menu_host_win.h
index ca8e12c..73f4a1c 100644
--- a/views/controls/menu/menu_host_win.h
+++ b/views/controls/menu/menu_host_win.h
@@ -8,14 +8,14 @@
#pragma once
#include "views/controls/menu/menu_host.h"
-#include "views/widget/widget_win.h"
+#include "views/widget/native_widget_win.h"
namespace views {
class SubmenuView;
// MenuHost implementation for windows.
-class MenuHostWin : public WidgetWin, public MenuHost {
+class MenuHostWin : public NativeWidgetWin, public MenuHost {
public:
explicit MenuHostWin(SubmenuView* submenu);
virtual ~MenuHostWin();
@@ -33,7 +33,7 @@ class MenuHostWin : public WidgetWin, public MenuHost {
virtual void ReleaseMenuHostCapture();
virtual gfx::NativeWindow GetMenuHostWindow();
- // WidgetWin overrides:
+ // NativeWidgetWin overrides:
virtual void OnDestroy();
virtual void OnCaptureChanged(HWND hwnd);
virtual void OnCancelMode();
diff --git a/views/controls/tabbed_pane/native_tabbed_pane_win.cc b/views/controls/tabbed_pane/native_tabbed_pane_win.cc
index aa651ac..bc8b33f 100644
--- a/views/controls/tabbed_pane/native_tabbed_pane_win.cc
+++ b/views/controls/tabbed_pane/native_tabbed_pane_win.cc
@@ -15,8 +15,8 @@
#include "ui/gfx/native_theme_win.h"
#include "views/controls/tabbed_pane/tabbed_pane.h"
#include "views/layout/fill_layout.h"
+#include "views/widget/native_widget_win.h"
#include "views/widget/root_view.h"
-#include "views/widget/widget_win.h"
namespace views {
@@ -288,7 +288,7 @@ void NativeTabbedPaneWin::CreateNativeControl() {
SendMessage(tab_control, WM_SETFONT, reinterpret_cast<WPARAM>(font), FALSE);
// Create the view container which is a child of the TabControl.
- content_window_ = new WidgetWin();
+ content_window_ = new NativeWidgetWin;
content_window_->Init(tab_control, gfx::Rect());
// Explicitly setting the WS_EX_LAYOUTRTL property for the HWND (see above
diff --git a/views/controls/tabbed_pane/native_tabbed_pane_win.h b/views/controls/tabbed_pane/native_tabbed_pane_win.h
index 8eac285..37e0f79 100644
--- a/views/controls/tabbed_pane/native_tabbed_pane_win.h
+++ b/views/controls/tabbed_pane/native_tabbed_pane_win.h
@@ -13,7 +13,7 @@
namespace views {
-class WidgetWin;
+class NativeWidgetWin;
class TabLayout;
class NativeTabbedPaneWin : public NativeControlWin,
@@ -86,7 +86,7 @@ class NativeTabbedPaneWin : public NativeControlWin,
int selected_index_;
// The window displayed in the tab.
- WidgetWin* content_window_;
+ NativeWidgetWin* content_window_;
DISALLOW_COPY_AND_ASSIGN(NativeTabbedPaneWin);
};
diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc
index 457ed09..396a11e 100644
--- a/views/focus/focus_manager_unittest.cc
+++ b/views/focus/focus_manager_unittest.cc
@@ -33,7 +33,7 @@
#include "views/window/window_delegate.h"
#if defined(OS_WIN)
-#include "views/widget/widget_win.h"
+#include "views/widget/native_widget_win.h"
#include "views/window/window_win.h"
#elif defined(OS_LINUX)
#include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
@@ -293,7 +293,7 @@ class BorderView : public NativeViewHost {
if (child == this && is_add) {
if (!widget_) {
#if defined(OS_WIN)
- WidgetWin* widget_win = new WidgetWin();
+ NativeWidgetWin* widget_win = new NativeWidgetWin;
widget_win->Init(parent->GetRootView()->GetWidget()->GetNativeView(),
gfx::Rect(0, 0, 0, 0));
widget_win->SetFocusTraversableParentView(this);
@@ -1587,7 +1587,7 @@ TEST_F(FocusManagerTest, CreationForNativeRoot) {
ASSERT_TRUE(hwnd);
// Create a view window parented to native dialog.
- WidgetWin window1;
+ NativeWidgetWin window1;
window1.set_delete_on_destroy(false);
window1.set_window_style(WS_CHILD);
window1.Init(hwnd, gfx::Rect(0, 0, 100, 100));
@@ -1598,7 +1598,7 @@ TEST_F(FocusManagerTest, CreationForNativeRoot) {
EXPECT_TRUE(focus_manager_member1);
// Create another view window parented to the first view window.
- WidgetWin window2;
+ NativeWidgetWin window2;
window2.set_delete_on_destroy(false);
window2.set_window_style(WS_CHILD);
window2.Init(window1.GetNativeView(), gfx::Rect(0, 0, 100, 100));
diff --git a/views/focus/focus_manager_win.cc b/views/focus/focus_manager_win.cc
index faf3815..dc13cb0 100644
--- a/views/focus/focus_manager_win.cc
+++ b/views/focus/focus_manager_win.cc
@@ -5,7 +5,7 @@
#include "views/focus/focus_manager.h"
#include "views/view.h"
-#include "views/widget/widget_win.h"
+#include "views/widget/native_widget_win.h"
namespace views {
@@ -23,7 +23,7 @@ void FocusManager::FocusNativeView(gfx::NativeView native_view) {
// static
FocusManager* FocusManager::GetFocusManagerForNativeView(
gfx::NativeView native_view) {
- WidgetWin* widget = WidgetWin::GetRootWidget(native_view);
+ NativeWidgetWin* widget = NativeWidgetWin::GetRootWidget(native_view);
return widget ? widget->GetFocusManager() : NULL;
}
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index d50bac6..1ae67d3 100644
--- a/views/view_unittest.cc
+++ b/views/view_unittest.cc
@@ -26,9 +26,9 @@
#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"
+#include "views/widget/native_widget_win.h"
#elif defined(OS_LINUX)
#include "views/widget/widget_gtk.h"
#include "views/window/window_gtk.h"
@@ -51,7 +51,7 @@ class ViewTest : public ViewsTestBase {
Widget* CreateWidget() {
#if defined(OS_WIN)
- return new WidgetWin();
+ return new NativeWidgetWin;
#elif defined(OS_LINUX)
return new WidgetGtk(WidgetGtk::TYPE_WINDOW);
#endif
@@ -351,7 +351,7 @@ TEST_F(ViewTest, MouseEvent) {
scoped_ptr<Widget> window(CreateWidget());
#if defined(OS_WIN)
- WidgetWin* window_win = static_cast<WidgetWin*>(window.get());
+ NativeWidgetWin* window_win = static_cast<NativeWidgetWin*>(window.get());
window_win->set_delete_on_destroy(false);
window_win->set_window_style(WS_OVERLAPPEDWINDOW);
window_win->Init(NULL, gfx::Rect(50, 50, 650, 650));
@@ -457,7 +457,7 @@ TEST_F(ViewTest, TouchEvent) {
#if defined(OS_WIN)
// This code would need to be here when we support
// touch on windows?
- WidgetWin* window_win = static_cast<WidgetWin*>(window.get());
+ NativeWidgetWin* window_win = static_cast<NativeWidgetWin*>(window.get());
window_win->set_delete_on_destroy(false);
window_win->set_window_style(WS_OVERLAPPEDWINDOW);
window_win->Init(NULL, gfx::Rect(50, 50, 650, 650));
@@ -575,7 +575,7 @@ TEST_F(ViewTest, DISABLED_Painting) {
RDW_UPDATENOW | RDW_INVALIDATE | RDW_ALLCHILDREN);
bool empty_paint = paint_window.empty_paint();
- views::WidgetWin window;
+ views::NativeWidgetWin window;
window.set_delete_on_destroy(false);
window.set_window_style(WS_OVERLAPPEDWINDOW);
window.Init(NULL, gfx::Rect(50, 50, 650, 650), NULL);
@@ -844,7 +844,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) {
Widget* window = CreateWidget();
#if defined(OS_WIN)
- static_cast<WidgetWin*>(window)->Init(NULL, gfx::Rect(0, 0, 100, 100));
+ static_cast<NativeWidgetWin*>(window)->Init(NULL, gfx::Rect(0, 0, 100, 100));
#endif
RootView* root_view = window->GetRootView();
@@ -966,7 +966,7 @@ TEST_F(ViewTest, ActivateAccelerator) {
EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 0);
// Create a window and add the view as its child.
- WidgetWin window;
+ NativeWidgetWin window;
window.Init(NULL, gfx::Rect(0, 0, 100, 100));
window.set_delete_on_destroy(false);
window.set_window_style(WS_OVERLAPPEDWINDOW);
@@ -1030,7 +1030,7 @@ TEST_F(ViewTest, HiddenViewWithAccelerator) {
view->AddAccelerator(return_accelerator);
EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 0);
- WidgetWin window;
+ NativeWidgetWin window;
window.Init(NULL, gfx::Rect(0, 0, 100, 100));
window.set_delete_on_destroy(false);
window.set_window_style(WS_OVERLAPPEDWINDOW);
diff --git a/views/view_win.cc b/views/view_win.cc
index f95e9e0..b139caa 100644
--- a/views/view_win.cc
+++ b/views/view_win.cc
@@ -18,7 +18,7 @@
#include "views/views_delegate.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
-#include "views/widget/widget_win.h"
+#include "views/widget/native_widget_win.h"
namespace views {
@@ -46,7 +46,7 @@ void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type,
// with this view so that clients can call get_accChild in ViewAccessibility
// to retrieve the IAccessible associated with this view.
if (send_native_event) {
- WidgetWin* view_widget = static_cast<WidgetWin*>(GetWidget());
+ NativeWidgetWin* view_widget = static_cast<NativeWidgetWin*>(GetWidget());
int child_id = view_widget->AddAccessibilityViewEvent(this);
::NotifyWinEvent(ViewAccessibility::MSAAEvent(event_type),
view_widget->GetNativeView(), OBJID_CLIENT, child_id);
diff --git a/views/views.gyp b/views/views.gyp
index 077c167..881085e 100644
--- a/views/views.gyp
+++ b/views/views.gyp
@@ -342,13 +342,13 @@
'widget/tooltip_window_gtk.h',
'widget/monitor_win.cc',
'widget/monitor_win.h',
+ 'widget/native_widget_win.cc',
+ 'widget/native_widget_win.h',
'widget/widget.h',
'widget/widget_gtk.cc',
'widget/widget_gtk.h',
'widget/widget_utils.cc',
'widget/widget_utils.h',
- 'widget/widget_win.cc',
- 'widget/widget_win.h',
'window/client_view.cc',
'window/client_view.h',
'window/custom_frame_view.cc',
@@ -401,13 +401,13 @@
'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',
'window/hit_test.cc',
'window/native_frame_view.cc',
- 'widget/widget_win.cc',
],
}],
['touchui==1', {
@@ -473,7 +473,7 @@
'run_all_unittests.cc',
'test/test_views_delegate.h',
'view_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/default_theme_provider.cc b/views/widget/default_theme_provider.cc
index 8a03bab..4ba1342 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 {
@@ -18,7 +18,7 @@ SkBitmap* DefaultThemeProvider::GetBitmapNamed(int id) const {
bool DefaultThemeProvider::ShouldUseNativeFrame() const {
#if defined(OS_WIN)
- return WidgetWin::IsAeroGlassEnabled();
+ return NativeWidgetWin::IsAeroGlassEnabled();
#else
return false;
#endif
diff --git a/views/widget/widget_win.cc b/views/widget/native_widget_win.cc
index 162d69f..f9efbbb 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>
@@ -51,11 +51,11 @@ namespace views {
// Property used to link the HWND to its RootView.
static const char* const kRootViewWindowProperty = "__ROOT_VIEW__";
-// Links the HWND to it's Widget (as a Widget, not a WidgetWin).
+// Links the HWND to it's Widget (as a Widget, not a NativeWidgetWin).
static const char* const kWidgetKey = "__VIEWS_WIDGET__";
// static
-bool WidgetWin::screen_reader_active_ = false;
+bool NativeWidgetWin::screen_reader_active_ = false;
// A custom MSAA object id used to determine if a screen reader is actively
// listening for MSAA events.
@@ -67,9 +67,9 @@ RootView* GetRootViewForHWND(HWND hwnd) {
}
///////////////////////////////////////////////////////////////////////////////
-// WidgetWin, public
+// NativeWidgetWin, public
-WidgetWin::WidgetWin()
+NativeWidgetWin::NativeWidgetWin()
: close_widget_factory_(this),
active_mouse_tracking_flags_(0),
has_capture_(false),
@@ -86,35 +86,35 @@ WidgetWin::WidgetWin()
accessibility_view_events_(kMaxAccessibilityViewEvents) {
}
-WidgetWin::~WidgetWin() {
+NativeWidgetWin::~NativeWidgetWin() {
}
// static
-WidgetWin* WidgetWin::GetWidget(HWND hwnd) {
+NativeWidgetWin* NativeWidgetWin::GetWidget(HWND hwnd) {
// TODO(jcivelli): http://crbug.com/44499 We need a way to test that hwnd is
- // associated with a WidgetWin (it might be a pure
+ // associated with a NativeWidgetWin (it might be a pure
// WindowImpl).
if (!WindowImpl::IsWindowImpl(hwnd))
return NULL;
- return reinterpret_cast<WidgetWin*>(ui::GetWindowUserData(hwnd));
+ return reinterpret_cast<NativeWidgetWin*>(ui::GetWindowUserData(hwnd));
}
// static
-WidgetWin* WidgetWin::GetRootWidget(HWND hwnd) {
+NativeWidgetWin* NativeWidgetWin::GetRootWidget(HWND hwnd) {
// First, check if the top-level window is a Widget.
HWND root = ::GetAncestor(hwnd, GA_ROOT);
if (!root)
return NULL;
- WidgetWin* widget = WidgetWin::GetWidget(root);
+ NativeWidgetWin* widget = NativeWidgetWin::GetWidget(root);
if (widget)
return widget;
// Second, try to locate the last Widget window in the parent hierarchy.
HWND parent_hwnd = hwnd;
- WidgetWin* parent_widget;
+ NativeWidgetWin* parent_widget;
do {
- parent_widget = WidgetWin::GetWidget(parent_hwnd);
+ parent_widget = NativeWidgetWin::GetWidget(parent_hwnd);
if (parent_widget) {
widget = parent_widget;
parent_hwnd = ::GetAncestor(parent_hwnd, GA_PARENT);
@@ -125,7 +125,7 @@ WidgetWin* WidgetWin::GetRootWidget(HWND hwnd) {
}
// 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.
@@ -133,7 +133,7 @@ bool WidgetWin::IsAeroGlassEnabled() {
return SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled;
}
-void WidgetWin::SetUseLayeredBuffer(bool use_layered_buffer) {
+void NativeWidgetWin::SetUseLayeredBuffer(bool use_layered_buffer) {
if (use_layered_buffer_ == use_layered_buffer)
return;
@@ -147,14 +147,14 @@ void WidgetWin::SetUseLayeredBuffer(bool use_layered_buffer) {
contents_.reset(NULL);
}
-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;
@@ -163,7 +163,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) {
@@ -175,7 +175,7 @@ void WidgetWin::ClearAccessibilityViewEvent(View* view) {
///////////////////////////////////////////////////////////////////////////////
// Widget implementation:
-void WidgetWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) {
+void NativeWidgetWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) {
// Force creation of the RootView; otherwise, we may get a WM_SIZE after the
// window is created and before the root view is set up.
GetRootView();
@@ -199,7 +199,7 @@ void WidgetWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) {
drop_target_ = new DropTargetWin(root_view_.get());
if ((window_style() & WS_CHILD) == 0 ||
- (WidgetWin::GetRootWidget(parent) == NULL &&
+ (NativeWidgetWin::GetRootWidget(parent) == NULL &&
parent != GetDesktopWindow())) {
// Top-level widgets and child widgets who do not have a top-level widget
// ancestor get a FocusManager. Child widgets parented to the desktop do not
@@ -234,23 +234,23 @@ void WidgetWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) {
ImmAssociateContextEx(hwnd(), NULL, 0);
}
-void WidgetWin::InitWithWidget(Widget* parent, const gfx::Rect& bounds) {
+void NativeWidgetWin::InitWithWidget(Widget* parent, const gfx::Rect& bounds) {
Init(parent->GetNativeView(), bounds);
}
-WidgetDelegate* WidgetWin::GetWidgetDelegate() {
+WidgetDelegate* NativeWidgetWin::GetWidgetDelegate() {
return delegate_;
}
-void WidgetWin::SetWidgetDelegate(WidgetDelegate* delegate) {
+void NativeWidgetWin::SetWidgetDelegate(WidgetDelegate* delegate) {
delegate_ = delegate;
}
-void WidgetWin::SetContentsView(View* view) {
+void NativeWidgetWin::SetContentsView(View* view) {
root_view_->SetContentsView(view);
}
-void WidgetWin::GetBounds(gfx::Rect* out, bool including_frame) const {
+void NativeWidgetWin::GetBounds(gfx::Rect* out, bool including_frame) const {
CRect crect;
if (including_frame) {
GetWindowRect(&crect);
@@ -265,7 +265,7 @@ void WidgetWin::GetBounds(gfx::Rect* out, bool including_frame) const {
crect.Width(), crect.Height());
}
-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);
@@ -273,18 +273,18 @@ void WidgetWin::SetBounds(const gfx::Rect& bounds) {
SWP_NOACTIVATE | SWP_NOZORDER);
}
-void WidgetWin::MoveAbove(Widget* other) {
+void NativeWidgetWin::MoveAbove(Widget* other) {
gfx::Rect bounds;
GetBounds(&bounds, false);
SetWindowPos(other->GetNativeView(), bounds.x(), bounds.y(),
bounds.width(), bounds.height(), 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.
@@ -298,11 +298,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() {
// We may already have been destroyed if the selection resulted in a tab
// switch which will have reactivated the browser window and closed us, so
// we need to check to see if we're still a window before trying to destroy
@@ -311,12 +311,12 @@ void WidgetWin::CloseNow() {
DestroyWindow(hwnd());
}
-void WidgetWin::Show() {
+void NativeWidgetWin::Show() {
if (IsWindow())
ShowWindow(SW_SHOWNOACTIVATE);
}
-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
@@ -328,7 +328,7 @@ void WidgetWin::Hide() {
}
}
-gfx::NativeView WidgetWin::GetNativeView() const {
+gfx::NativeView NativeWidgetWin::GetNativeView() const {
return WindowImpl::hwnd();
}
@@ -348,7 +348,7 @@ static BOOL CALLBACK EnumChildProcForRedraw(HWND hwnd, LPARAM lparam) {
return TRUE;
}
-void WidgetWin::PaintNow(const gfx::Rect& update_rect) {
+void NativeWidgetWin::PaintNow(const gfx::Rect& update_rect) {
if (use_layered_buffer_) {
PaintLayeredWindow();
} else if (root_view_->NeedsPainting(false) && IsWindow()) {
@@ -391,18 +391,18 @@ void WidgetWin::PaintNow(const gfx::Rect& update_rect) {
}
}
-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);
}
-RootView* WidgetWin::GetRootView() {
+RootView* NativeWidgetWin::GetRootView() {
if (!root_view_.get()) {
// First time the root view is being asked for, create it now.
root_view_.reset(CreateRootView());
@@ -410,27 +410,27 @@ RootView* WidgetWin::GetRootView() {
return root_view_.get();
}
-Widget* WidgetWin::GetRootWidget() const {
+Widget* NativeWidgetWin::GetRootWidget() const {
return GetRootWidget(hwnd());
}
-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_;
}
-TooltipManager* WidgetWin::GetTooltipManager() {
+TooltipManager* NativeWidgetWin::GetTooltipManager() {
return tooltip_manager_.get();
}
-void WidgetWin::GenerateMousePressedForView(View* view,
+void NativeWidgetWin::GenerateMousePressedForView(View* view,
const gfx::Point& point) {
gfx::Point point_in_widget(point);
View::ConvertPointToWidget(view, &point_in_widget);
@@ -438,19 +438,19 @@ void WidgetWin::GenerateMousePressedForView(View* view,
ProcessMousePressed(point_in_widget.ToPOINT(), MK_LBUTTON, false, false);
}
-bool WidgetWin::GetAccelerator(int cmd_id, ui::Accelerator* accelerator) {
+bool NativeWidgetWin::GetAccelerator(int cmd_id, ui::Accelerator* accelerator) {
return false;
}
-Window* WidgetWin::GetWindow() {
+Window* NativeWidgetWin::GetWindow() {
return GetWindowImpl(hwnd());
}
-const Window* WidgetWin::GetWindow() const {
+const Window* NativeWidgetWin::GetWindow() const {
return GetWindowImpl(hwnd());
}
-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) {
@@ -463,33 +463,33 @@ 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);
}
-ThemeProvider* WidgetWin::GetThemeProvider() const {
+ThemeProvider* NativeWidgetWin::GetThemeProvider() const {
return GetWidgetThemeProvider(this);
}
-ThemeProvider* WidgetWin::GetDefaultThemeProvider() const {
+ThemeProvider* NativeWidgetWin::GetDefaultThemeProvider() const {
return default_theme_provider_.get();
}
-FocusManager* WidgetWin::GetFocusManager() {
+FocusManager* NativeWidgetWin::GetFocusManager() {
if (focus_manager_.get())
return focus_manager_.get();
- WidgetWin* widget = static_cast<WidgetWin*>(GetRootWidget());
+ NativeWidgetWin* widget = static_cast<NativeWidgetWin*>(GetRootWidget());
if (widget && widget != this) {
- // WidgetWin subclasses may override GetFocusManager(), for example for
- // dealing with cases where the widget has been unparented.
+ // NativeWidgetWin subclasses may override GetFocusManager(), for example
+ // for dealing with cases where the widget has been unparented.
return widget->GetFocusManager();
}
return NULL;
}
-void WidgetWin::ViewHierarchyChanged(bool is_add, View *parent,
- View *child) {
+void NativeWidgetWin::ViewHierarchyChanged(bool is_add, View *parent,
+ View *child) {
if (drop_target_.get())
drop_target_->ResetTargetViewIfEquals(child);
@@ -498,7 +498,7 @@ void WidgetWin::ViewHierarchyChanged(bool is_add, View *parent,
}
-bool WidgetWin::ContainsNativeView(gfx::NativeView native_view) {
+bool NativeWidgetWin::ContainsNativeView(gfx::NativeView native_view) {
if (hwnd() == native_view)
return true;
@@ -522,10 +522,10 @@ bool WidgetWin::ContainsNativeView(gfx::NativeView native_view) {
////////////////////////////////////////////////////////////////////////////////
// MessageLoop::Observer
-void WidgetWin::WillProcessMessage(const MSG& msg) {
+void NativeWidgetWin::WillProcessMessage(const MSG& msg) {
}
-void WidgetWin::DidProcessMessage(const MSG& msg) {
+void NativeWidgetWin::DidProcessMessage(const MSG& msg) {
if (root_view_->NeedsPainting(true))
PaintNow(root_view_->GetScheduledPaintRect());
}
@@ -533,53 +533,55 @@ void WidgetWin::DidProcessMessage(const MSG& msg) {
////////////////////////////////////////////////////////////////////////////////
// FocusTraversable
-FocusSearch* WidgetWin::GetFocusSearch() {
+FocusSearch* NativeWidgetWin::GetFocusSearch() {
return root_view_->GetFocusSearch();
}
-FocusTraversable* WidgetWin::GetFocusTraversableParent() {
+FocusTraversable* NativeWidgetWin::GetFocusTraversableParent() {
// We are a proxy to the root view, so we should be bypassed when traversing
// up and as a result this should not be called.
NOTREACHED();
return NULL;
}
-void WidgetWin::SetFocusTraversableParent(FocusTraversable* parent) {
+void NativeWidgetWin::SetFocusTraversableParent(FocusTraversable* parent) {
root_view_->SetFocusTraversableParent(parent);
}
-View* WidgetWin::GetFocusTraversableParentView() {
+View* NativeWidgetWin::GetFocusTraversableParentView() {
// We are a proxy to the root view, so we should be bypassed when traversing
// up and as a result this should not be called.
NOTREACHED();
return NULL;
}
-void WidgetWin::SetFocusTraversableParentView(View* parent_view) {
+void NativeWidgetWin::SetFocusTraversableParentView(View* parent_view) {
root_view_->SetFocusTraversableParentView(parent_view);
}
///////////////////////////////////////////////////////////////////////////////
// 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) {
if (has_capture_) {
if (is_mouse_down_)
root_view_->ProcessMouseDragCanceled();
@@ -588,22 +590,23 @@ void WidgetWin::OnCaptureChanged(HWND hwnd) {
}
}
-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) {
// Widget::GetWidgetFromNativeView expects the contents of this property
// to be of type Widget, so the cast is necessary.
SetNativeWindowProperty(kWidgetKey, static_cast<Widget*>(this));
return 0;
}
-void WidgetWin::OnDestroy() {
+void NativeWidgetWin::OnDestroy() {
if (drop_target_.get()) {
RevokeDragDrop(hwnd());
drop_target_ = NULL;
@@ -612,40 +615,41 @@ 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 (GetWidgetDelegate())
GetWidgetDelegate()->DisplayChanged();
}
-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
@@ -671,25 +675,27 @@ 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);
}
-void WidgetWin::OnInitMenu(HMENU menu) {
+void NativeWidgetWin::OnInitMenu(HMENU menu) {
SetMsgHandled(FALSE);
}
-void WidgetWin::OnInitMenuPopup(HMENU menu,
+void NativeWidgetWin::OnInitMenuPopup(HMENU menu,
UINT position,
BOOL is_system_menu) {
SetMsgHandled(FALSE);
}
-LRESULT WidgetWin::OnKeyDown(UINT message, WPARAM w_param, LPARAM l_param) {
+LRESULT NativeWidgetWin::OnKeyDown(UINT message, WPARAM w_param,
+ LPARAM l_param) {
RootView* root_view = GetFocusedViewRootView();
if (!root_view)
root_view = root_view_.get();
@@ -700,7 +706,7 @@ LRESULT WidgetWin::OnKeyDown(UINT message, WPARAM w_param, LPARAM l_param) {
return 0;
}
-LRESULT WidgetWin::OnKeyUp(UINT message, WPARAM w_param, LPARAM l_param) {
+LRESULT NativeWidgetWin::OnKeyUp(UINT message, WPARAM w_param, LPARAM l_param) {
RootView* root_view = GetFocusedViewRootView();
if (!root_view)
root_view = root_view_.get();
@@ -711,7 +717,7 @@ LRESULT WidgetWin::OnKeyUp(UINT message, WPARAM w_param, LPARAM l_param) {
return 0;
}
-void WidgetWin::OnKillFocus(HWND focused_window) {
+void NativeWidgetWin::OnKillFocus(HWND focused_window) {
GetFocusManager()->GetWidgetFocusManager()->OnWidgetFocusEvent(
this->GetNativeView(),
focused_window);
@@ -724,47 +730,49 @@ void WidgetWin::OnKillFocus(HWND focused_window) {
// a separate member on the MouseEvent, then audit all consumers of MouseEvents
// to fix them to use the resulting values correctly.
-void WidgetWin::OnLButtonDown(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnLButtonDown(UINT flags, const CPoint& point) {
ProcessMousePressed(point, flags | MK_LBUTTON, false, false);
}
-void WidgetWin::OnLButtonUp(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnLButtonUp(UINT flags, const CPoint& point) {
ProcessMouseReleased(point, flags | MK_LBUTTON);
}
-void WidgetWin::OnLButtonDblClk(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnLButtonDblClk(UINT flags, const CPoint& point) {
ProcessMousePressed(point, flags | MK_LBUTTON, true, false);
}
-void WidgetWin::OnMButtonDown(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnMButtonDown(UINT flags, const CPoint& point) {
ProcessMousePressed(point, flags | MK_MBUTTON, false, false);
}
-void WidgetWin::OnMButtonUp(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnMButtonUp(UINT flags, const CPoint& point) {
ProcessMouseReleased(point, flags | MK_MBUTTON);
}
-void WidgetWin::OnMButtonDblClk(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnMButtonDblClk(UINT flags, const CPoint& point) {
ProcessMousePressed(point, flags | MK_MBUTTON, true, false);
}
-LRESULT WidgetWin::OnMouseActivate(HWND window, UINT hittest_code,
+LRESULT NativeWidgetWin::OnMouseActivate(HWND window, UINT hittest_code,
UINT message) {
SetMsgHandled(FALSE);
return MA_ACTIVATE;
}
-void WidgetWin::OnMouseMove(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnMouseMove(UINT flags, const CPoint& point) {
ProcessMouseMoved(point, flags, false);
}
-LRESULT WidgetWin::OnMouseLeave(UINT message, WPARAM w_param, LPARAM l_param) {
+LRESULT NativeWidgetWin::OnMouseLeave(UINT message, WPARAM w_param,
+ LPARAM l_param) {
tooltip_manager_->OnMouseLeave();
ProcessMouseExited();
return 0;
}
-LRESULT WidgetWin::OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param) {
+LRESULT NativeWidgetWin::OnMouseWheel(UINT message, WPARAM w_param,
+ LPARAM l_param) {
// Reroute the mouse-wheel to the window under the mouse pointer if
// applicable.
if (message == WM_MOUSEWHEEL &&
@@ -780,64 +788,65 @@ LRESULT WidgetWin::OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param) {
return root_view_->ProcessMouseWheelEvent(e) ? 0 : 1;
}
-void WidgetWin::OnMove(const CPoint& point) {
+void NativeWidgetWin::OnMove(const CPoint& point) {
SetMsgHandled(FALSE);
}
-void WidgetWin::OnMoving(UINT param, const LPRECT new_bounds) {
+void NativeWidgetWin::OnMoving(UINT param, const LPRECT new_bounds) {
}
-LRESULT WidgetWin::OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param) {
+LRESULT NativeWidgetWin::OnMouseRange(UINT msg, WPARAM w_param,
+ LPARAM l_param) {
tooltip_manager_->OnMouse(msg, w_param, l_param);
SetMsgHandled(FALSE);
return 0;
}
-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::OnNCLButtonDblClk(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnNCLButtonDblClk(UINT flags, const CPoint& point) {
SetMsgHandled(ProcessMousePressed(point, flags | MK_LBUTTON, true, true));
}
-void WidgetWin::OnNCLButtonDown(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnNCLButtonDown(UINT flags, const CPoint& point) {
SetMsgHandled(ProcessMousePressed(point, flags | MK_LBUTTON, false, true));
}
-void WidgetWin::OnNCLButtonUp(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnNCLButtonUp(UINT flags, const CPoint& point) {
SetMsgHandled(FALSE);
}
-void WidgetWin::OnNCMButtonDblClk(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnNCMButtonDblClk(UINT flags, const CPoint& point) {
SetMsgHandled(ProcessMousePressed(point, flags | MK_MBUTTON, true, true));
}
-void WidgetWin::OnNCMButtonDown(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnNCMButtonDown(UINT flags, const CPoint& point) {
SetMsgHandled(ProcessMousePressed(point, flags | MK_MBUTTON, false, true));
}
-void WidgetWin::OnNCMButtonUp(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnNCMButtonUp(UINT flags, const CPoint& point) {
SetMsgHandled(FALSE);
}
-LRESULT WidgetWin::OnNCMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param) {
+LRESULT NativeWidgetWin::OnNCMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param) {
ProcessMouseExited();
return 0;
}
-LRESULT WidgetWin::OnNCMouseMove(UINT flags, const CPoint& point) {
+LRESULT NativeWidgetWin::OnNCMouseMove(UINT flags, const CPoint& point) {
// NC points are in screen coordinates.
CPoint temp = point;
MapWindowPoints(HWND_DESKTOP, hwnd(), &temp, 1);
@@ -849,35 +858,35 @@ LRESULT WidgetWin::OnNCMouseMove(UINT flags, const CPoint& point) {
return 0;
}
-void WidgetWin::OnNCPaint(HRGN rgn) {
+void NativeWidgetWin::OnNCPaint(HRGN rgn) {
SetMsgHandled(FALSE);
}
-void WidgetWin::OnNCRButtonDblClk(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnNCRButtonDblClk(UINT flags, const CPoint& point) {
SetMsgHandled(ProcessMousePressed(point, flags | MK_RBUTTON, true, true));
}
-void WidgetWin::OnNCRButtonDown(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnNCRButtonDown(UINT flags, const CPoint& point) {
SetMsgHandled(ProcessMousePressed(point, flags | MK_RBUTTON, false, true));
}
-void WidgetWin::OnNCRButtonUp(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnNCRButtonUp(UINT flags, const CPoint& point) {
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.
@@ -891,11 +900,11 @@ LRESULT WidgetWin::OnNotify(int w_param, NMHDR* l_param) {
return 0;
}
-void WidgetWin::OnPaint(HDC dc) {
+void NativeWidgetWin::OnPaint(HDC dc) {
root_view_->OnPaint(hwnd());
}
-LRESULT WidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) {
+LRESULT NativeWidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) {
ui::SystemMonitor* monitor = ui::SystemMonitor::Get();
if (monitor)
monitor->ProcessWmPowerBroadcastMessage(power_event);
@@ -903,78 +912,78 @@ LRESULT WidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) {
return 0;
}
-void WidgetWin::OnRButtonDown(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnRButtonDown(UINT flags, const CPoint& point) {
ProcessMousePressed(point, flags | MK_RBUTTON, false, false);
}
-void WidgetWin::OnRButtonUp(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnRButtonUp(UINT flags, const CPoint& point) {
ProcessMouseReleased(point, flags | MK_RBUTTON);
}
-void WidgetWin::OnRButtonDblClk(UINT flags, const CPoint& point) {
+void NativeWidgetWin::OnRButtonDblClk(UINT flags, const CPoint& point) {
ProcessMousePressed(point, flags | MK_RBUTTON, true, false);
}
-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;
}
-void WidgetWin::OnSetFocus(HWND focused_window) {
+void NativeWidgetWin::OnSetFocus(HWND focused_window) {
GetFocusManager()->GetWidgetFocusManager()->OnWidgetFocusEvent(
focused_window,
this->GetNativeView());
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) {
if (flags == SPI_SETWORKAREA && GetWidgetDelegate())
GetWidgetDelegate()->WorkAreaChanged();
SetMsgHandled(FALSE);
}
-void WidgetWin::OnSize(UINT param, const CSize& size) {
+void NativeWidgetWin::OnSize(UINT param, const CSize& size) {
LayoutRootView();
}
-void WidgetWin::OnSysCommand(UINT notification_code, CPoint click) {
+void NativeWidgetWin::OnSysCommand(UINT notification_code, CPoint click) {
}
-void WidgetWin::OnThemeChanged() {
+void NativeWidgetWin::OnThemeChanged() {
// Notify NativeTheme.
gfx::NativeTheme::instance()->CloseHandles();
}
-void WidgetWin::OnFinalMessage(HWND window) {
+void NativeWidgetWin::OnFinalMessage(HWND window) {
if (delete_on_destroy_)
delete this;
}
-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) {
SetMsgHandled(FALSE);
}
-gfx::Size WidgetWin::GetRootViewSize() const {
+gfx::Size NativeWidgetWin::GetRootViewSize() const {
CRect rect;
if (use_layered_buffer_)
GetWindowRect(&rect);
@@ -985,9 +994,9 @@ gfx::Size WidgetWin::GetRootViewSize() const {
}
///////////////////////////////////////////////////////////////////////////////
-// 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) {
@@ -1011,10 +1020,10 @@ void WidgetWin::TrackMouseEvents(DWORD mouse_tracking_flags) {
}
}
-bool WidgetWin::ProcessMousePressed(const CPoint& point,
- UINT flags,
- bool dbl_click,
- bool non_client) {
+bool NativeWidgetWin::ProcessMousePressed(const CPoint& point,
+ UINT flags,
+ bool dbl_click,
+ bool non_client) {
last_mouse_event_was_move_ = false;
// Windows gives screen coordinates for nonclient events, while the RootView
// expects window coordinates; convert if necessary.
@@ -1038,7 +1047,7 @@ bool WidgetWin::ProcessMousePressed(const CPoint& point,
return false;
}
-void WidgetWin::ProcessMouseDragged(const CPoint& point, UINT flags) {
+void NativeWidgetWin::ProcessMouseDragged(const CPoint& point, UINT flags) {
last_mouse_event_was_move_ = false;
MouseEvent mouse_drag(ui::ET_MOUSE_DRAGGED,
point.x,
@@ -1047,7 +1056,7 @@ void WidgetWin::ProcessMouseDragged(const CPoint& point, UINT flags) {
root_view_->OnMouseDragged(mouse_drag);
}
-void WidgetWin::ProcessMouseReleased(const CPoint& point, UINT flags) {
+void NativeWidgetWin::ProcessMouseReleased(const CPoint& point, UINT flags) {
last_mouse_event_was_move_ = false;
MouseEvent mouse_up(ui::ET_MOUSE_RELEASED,
point.x,
@@ -1063,8 +1072,8 @@ void WidgetWin::ProcessMouseReleased(const CPoint& point, UINT flags) {
root_view_->OnMouseReleased(mouse_up, false);
}
-void WidgetWin::ProcessMouseMoved(const CPoint &point, UINT flags,
- bool is_nonclient) {
+void NativeWidgetWin::ProcessMouseMoved(const CPoint &point, UINT flags,
+ bool is_nonclient) {
// Windows only fires WM_MOUSELEAVE events if the application begins
// "tracking" mouse events for a given HWND during WM_MOUSEMOVE events.
// We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE.
@@ -1091,15 +1100,15 @@ void WidgetWin::ProcessMouseMoved(const CPoint &point, UINT flags,
}
}
-void WidgetWin::ProcessMouseExited() {
+void NativeWidgetWin::ProcessMouseExited() {
last_mouse_event_was_move_ = false;
root_view_->ProcessOnMouseExited();
- // Reset our tracking flag so that future mouse movement over this WidgetWin
+ // Reset our tracking flag so that future mouse movement over this NativeWidgetWin
// results in a new tracking session.
active_mouse_tracking_flags_ = 0;
}
-void WidgetWin::LayoutRootView() {
+void NativeWidgetWin::LayoutRootView() {
gfx::Size size(GetRootViewSize());
if (use_layered_buffer_)
@@ -1114,29 +1123,29 @@ void WidgetWin::LayoutRootView() {
PaintNow(gfx::Rect(0, 0, size.width(), size.height()));
}
-void WidgetWin::OnScreenReaderDetected() {
+void NativeWidgetWin::OnScreenReaderDetected() {
screen_reader_active_ = true;
}
-bool WidgetWin::ReleaseCaptureOnMouseReleased() {
+bool NativeWidgetWin::ReleaseCaptureOnMouseReleased() {
return true;
}
-RootView* WidgetWin::CreateRootView() {
+RootView* NativeWidgetWin::CreateRootView() {
return new RootView(this);
}
///////////////////////////////////////////////////////////////////////////////
-// 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);
parent = ::GetParent(parent);
@@ -1144,13 +1153,13 @@ Window* WidgetWin::GetWindowImpl(HWND hwnd) {
return NULL;
}
-void WidgetWin::SizeContents(const gfx::Size& window_size) {
+void NativeWidgetWin::SizeContents(const gfx::Size& window_size) {
contents_.reset(new gfx::CanvasSkia(window_size.width(),
window_size.height(),
false));
}
-void WidgetWin::PaintLayeredWindow() {
+void NativeWidgetWin::PaintLayeredWindow() {
// Painting monkeys with our cliprect, so we need to save it so that the
// call to UpdateLayeredWindow updates the entire window, not just the
// cliprect.
@@ -1164,7 +1173,7 @@ void WidgetWin::PaintLayeredWindow() {
UpdateWindowFromContents(contents_->getTopPlatformDevice().getBitmapDC());
}
-void WidgetWin::UpdateWindowFromContents(HDC dib_dc) {
+void NativeWidgetWin::UpdateWindowFromContents(HDC dib_dc) {
DCHECK(use_layered_buffer_);
if (can_update_layered_window_) {
CRect wr;
@@ -1180,7 +1189,7 @@ void WidgetWin::UpdateWindowFromContents(HDC dib_dc) {
}
}
-RootView* WidgetWin::GetFocusedViewRootView() {
+RootView* NativeWidgetWin::GetFocusedViewRootView() {
FocusManager* focus_manager = GetFocusManager();
if (!focus_manager) {
NOTREACHED();
@@ -1213,7 +1222,7 @@ static HWND GetControlHWNDForMessage(UINT message,
return NULL;
}
-HICON WidgetWin::GetDefaultWindowIcon() const {
+HICON NativeWidgetWin::GetDefaultWindowIcon() const {
if (ViewsDelegate::views_delegate)
return ViewsDelegate::views_delegate->GetDefaultWindowIcon();
return NULL;
@@ -1244,13 +1253,13 @@ static bool ProcessChildWindowMessage(UINT message,
return false;
}
-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;
@@ -1271,8 +1280,8 @@ LRESULT WidgetWin::OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) {
}
// static
-void WidgetWin::PostProcessActivateMessage(WidgetWin* widget,
- int activation_state) {
+void NativeWidgetWin::PostProcessActivateMessage(NativeWidgetWin* widget,
+ int activation_state) {
if (!widget->focus_manager_.get()) {
NOTREACHED();
return;
@@ -1300,7 +1309,7 @@ void WidgetWin::PostProcessActivateMessage(WidgetWin* widget,
}
}
-void WidgetWin::MakeMSG(MSG* msg, UINT message, WPARAM w_param,
+void NativeWidgetWin::MakeMSG(MSG* msg, UINT message, WPARAM w_param,
LPARAM l_param) const {
msg->hwnd = hwnd();
msg->message = message;
@@ -1318,7 +1327,7 @@ Widget* Widget::CreatePopupWidget(TransparencyParam transparent,
EventsParam accept_events,
DeleteParam delete_on_destroy,
MirroringParam mirror_in_rtl) {
- WidgetWin* popup = new WidgetWin;
+ NativeWidgetWin* popup = new NativeWidgetWin;
DWORD ex_style = WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE;
if (mirror_in_rtl == MirrorOriginInRTL)
ex_style |= l10n_util::GetExtendedTooltipStyles();
diff --git a/views/widget/widget_win.h b/views/widget/native_widget_win.h
index c93db90..7143491 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>
@@ -64,7 +64,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.
@@ -75,19 +75,19 @@ const int WM_NCUAHDRAWFRAME = 0xAF;
// then responsible for cleaning up after it.
//
///////////////////////////////////////////////////////////////////////////////
-class WidgetWin : public ui::WindowImpl,
- public Widget,
- public MessageLoopForUI::Observer,
- public FocusTraversable {
+class NativeWidgetWin : public ui::WindowImpl,
+ public Widget,
+ public MessageLoopForUI::Observer,
+ public FocusTraversable {
public:
- WidgetWin();
- virtual ~WidgetWin();
+ NativeWidgetWin();
+ virtual ~NativeWidgetWin();
// Returns the Widget associated with the specified HWND (if any).
- static WidgetWin* GetWidget(HWND hwnd);
+ static NativeWidgetWin* GetWidget(HWND hwnd);
// Returns the root Widget associated with the specified HWND (if any).
- static WidgetWin* GetRootWidget(HWND hwnd);
+ static NativeWidgetWin* GetRootWidget(HWND hwnd);
// Returns true if we are on Windows Vista or greater and composition is
// enabled.
@@ -114,13 +114,13 @@ 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.
void ClearAccessibilityViewEvent(View* view);
- 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_NCMOUSEMOVE, OnMouseRange)
@@ -460,7 +460,7 @@ class WidgetWin : public ui::WindowImpl,
// create specialized RootView implementations.
virtual RootView* CreateRootView();
- // Returns true if this WidgetWin is opaque.
+ // Returns true if this NativeWidgetWin is opaque.
bool opaque() const { return opaque_; }
// The TooltipManager.
@@ -518,15 +518,15 @@ 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);
// Fills out a MSG struct with the supplied values.
void MakeMSG(MSG* msg, UINT message, WPARAM w_param, LPARAM l_param) const;
- // 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
@@ -604,9 +604,9 @@ class WidgetWin : public ui::WindowImpl,
ViewProps props_;
- 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 d0cb4e4..a646b34 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/message_loop.h"
@@ -11,13 +11,13 @@
using namespace views;
-class WidgetWinTest : public testing::Test {
+class NativeWidgetWinTest : public testing::Test {
public:
- WidgetWinTest() {
+ NativeWidgetWinTest() {
OleInitialize(NULL);
}
- ~WidgetWinTest() {
+ ~NativeWidgetWinTest() {
OleUninitialize();
}
@@ -29,7 +29,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();
@@ -38,20 +38,20 @@ class WidgetWinTest : public testing::Test {
private:
MessageLoopForUI message_loop_;
- DISALLOW_COPY_AND_ASSIGN(WidgetWinTest);
+ DISALLOW_COPY_AND_ASSIGN(NativeWidgetWinTest);
};
-WidgetWin* WidgetWinTest::CreateWidgetWin() {
- scoped_ptr<WidgetWin> window(new WidgetWin());
+NativeWidgetWin* NativeWidgetWinTest::CreateNativeWidgetWin() {
+ scoped_ptr<NativeWidgetWin> window(new NativeWidgetWin);
window->set_delete_on_destroy(false);
window->set_window_style(WS_OVERLAPPEDWINDOW);
window->Init(NULL, gfx::Rect(50, 50, 650, 650));
return window.release();
}
-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);
@@ -59,13 +59,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/window/window_win.cc b/views/window/window_win.cc
index fdca1e9..e5c0e19 100644
--- a/views/window/window_win.cc
+++ b/views/window/window_win.cc
@@ -224,7 +224,7 @@ Window* Window::CreateChromeWindow(gfx::NativeWindow parent,
gfx::Rect WindowWin::GetBounds() const {
gfx::Rect bounds;
- WidgetWin::GetBounds(&bounds, true);
+ NativeWidgetWin::GetBounds(&bounds, true);
return bounds;
}
@@ -274,11 +274,11 @@ void WindowWin::HideWindow() {
}
void WindowWin::SetNativeWindowProperty(const char* name, void* value) {
- WidgetWin::SetNativeWindowProperty(name, value);
+ NativeWidgetWin::SetNativeWindowProperty(name, value);
}
void* WindowWin::GetNativeWindowProperty(const char* name) {
- return WidgetWin::GetNativeWindowProperty(name);
+ return NativeWidgetWin::GetNativeWindowProperty(name);
}
void WindowWin::PushForceHidden() {
@@ -345,7 +345,7 @@ void WindowWin::Close() {
if (non_client_view_->CanClose()) {
SaveWindowPosition();
RestoreEnabledIfNecessary();
- 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
// is visible. If we don't manually force that here, the other app will
@@ -572,7 +572,7 @@ gfx::NativeWindow WindowWin::GetNativeWindow() const {
bool WindowWin::ShouldUseNativeFrame() const {
ui::ThemeProvider* tp = GetThemeProvider();
if (!tp)
- return WidgetWin::IsAeroGlassEnabled();
+ return NativeWidgetWin::IsAeroGlassEnabled();
return tp->ShouldUseNativeFrame();
}
@@ -627,7 +627,7 @@ gfx::Font WindowWin::GetWindowTitleFont() {
// WindowWin, protected:
WindowWin::WindowWin(WindowDelegate* window_delegate)
- : WidgetWin(),
+ : NativeWidgetWin(),
focus_on_creation_(true),
window_delegate_(window_delegate),
non_client_view_(new NonClientView(this)),
@@ -663,7 +663,7 @@ void WindowWin::Init(HWND parent, const gfx::Rect& bounds) {
// return NULL.
owning_hwnd_ = parent;
// We call this after initializing our members since our implementations of
- // assorted WidgetWin functions may be called during initialization.
+ // assorted NativeWidgetWin functions may be called during initialization.
is_modal_ = window_delegate_->IsModal();
if (is_modal_)
BecomeModal();
@@ -673,13 +673,13 @@ void WindowWin::Init(HWND parent, const gfx::Rect& bounds) {
if (window_ex_style() == 0)
set_window_ex_style(CalculateWindowExStyle());
- WidgetWin::Init(parent, bounds);
+ NativeWidgetWin::Init(parent, bounds);
ui::SetWindowUserData(GetNativeView(), this);
// Create the ClientView, add it to the NonClientView and add the
// NonClientView to the RootView. This will cause everything to be parented.
non_client_view_->set_client_view(window_delegate_->CreateClientView(this));
- WidgetWin::SetContentsView(non_client_view_);
+ NativeWidgetWin::SetContentsView(non_client_view_);
UpdateWindowTitle();
UpdateAccessibleRole();
@@ -700,7 +700,7 @@ void WindowWin::SizeWindowToDefault() {
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 (GetNonClientView()->UseNativeFrame())
return gfx::Insets();
@@ -726,7 +726,7 @@ gfx::Insets WindowWin::GetClientAreaInsets() const {
}
///////////////////////////////////////////////////////////////////////////////
-// WindowWin, WidgetWin overrides:
+// WindowWin, NativeWidgetWin overrides:
void WindowWin::OnActivate(UINT action, BOOL minimized, HWND window) {
if (action == WA_INACTIVE)
@@ -750,7 +750,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...
if (!window_delegate_->ExecuteWindowsCommand(app_command))
- return WidgetWin::OnAppCommand(window, app_command, device, keystate);
+ return NativeWidgetWin::OnAppCommand(window, app_command, device, keystate);
return 0;
}
@@ -759,14 +759,14 @@ void WindowWin::OnCommand(UINT notification_code, int command_id, HWND window) {
// should ignore it.
if (notification_code > 1 ||
window_delegate_->ExecuteWindowsCommand(command_id)) {
- WidgetWin::OnCommand(notification_code, command_id, window);
+ NativeWidgetWin::OnCommand(notification_code, command_id, window);
}
}
void WindowWin::OnDestroy() {
non_client_view_->WindowClosing();
RestoreEnabledIfNecessary();
- WidgetWin::OnDestroy();
+ NativeWidgetWin::OnDestroy();
}
LRESULT WindowWin::OnDwmCompositionChanged(UINT msg, WPARAM w_param,
@@ -786,14 +786,14 @@ void WindowWin::OnFinalMessage(HWND window) {
// messages.
window_delegate_->DeleteDelegate();
window_delegate_ = NULL;
- WidgetWin::OnFinalMessage(window);
+ NativeWidgetWin::OnFinalMessage(window);
}
void WindowWin::OnGetMinMaxInfo(MINMAXINFO* minmax_info) {
gfx::Size min_window_size(GetNonClientView()->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);
}
namespace {
@@ -807,7 +807,7 @@ void WindowWin::OnInitMenu(HMENU menu) {
// We only need to manually enable the system menu if we're not using a native
// frame.
if (non_client_view_->UseNativeFrame())
- WidgetWin::OnInitMenu(menu);
+ NativeWidgetWin::OnInitMenu(menu);
bool is_fullscreen = IsFullscreen();
bool is_minimized = IsMinimized();
@@ -889,7 +889,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] :
@@ -974,7 +974,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 {
@@ -1011,7 +1011,7 @@ void WindowWin::OnNCPaint(HRGN rgn) {
// It's required to avoid some native painting artifacts from appearing when
// the window is resized.
if (non_client_view_->UseNativeFrame()) {
- WidgetWin::OnNCPaint(rgn);
+ NativeWidgetWin::OnNCPaint(rgn);
return;
}
@@ -1113,13 +1113,13 @@ void WindowWin::OnNCLButtonDown(UINT ht_component, const CPoint& point) {
}
}
- WidgetWin::OnNCLButtonDown(ht_component, point);
+ NativeWidgetWin::OnNCLButtonDown(ht_component, point);
/* TODO(beng): Fix the standard non-client over-painting bug. This code
doesn't work but identifies the problem.
if (!IsMsgHandled()) {
// 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.
@@ -1140,7 +1140,7 @@ void WindowWin::OnNCRButtonDown(UINT ht_component, const CPoint& point) {
SetCapture();
}
- WidgetWin::OnNCRButtonDown(ht_component, point);
+ NativeWidgetWin::OnNCRButtonDown(ht_component, point);
}
void WindowWin::OnRButtonUp(UINT ht_component, const CPoint& point) {
@@ -1165,7 +1165,7 @@ void WindowWin::OnRButtonUp(UINT ht_component, const CPoint& point) {
}
}
- WidgetWin::OnRButtonUp(ht_component, point);
+ NativeWidgetWin::OnRButtonUp(ht_component, point);
}
LRESULT WindowWin::OnNCUAHDrawCaption(UINT msg, WPARAM w_param,
@@ -1206,7 +1206,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);
}
}
@@ -1339,7 +1339,7 @@ void WindowWin::OnWindowPosChanging(WINDOWPOS* window_pos) {
}
}
- WidgetWin::OnWindowPosChanging(window_pos);
+ NativeWidgetWin::OnWindowPosChanging(window_pos);
}
gfx::Size WindowWin::GetRootViewSize() const {
@@ -1347,7 +1347,7 @@ gfx::Size WindowWin::GetRootViewSize() const {
// determined by the relevant WM_NCCALCSIZE handling, so we just use the
// default handling which does this.
if (GetNonClientView()->UseNativeFrame() || IsMaximized())
- return WidgetWin::GetRootViewSize();
+ return NativeWidgetWin::GetRootViewSize();
// When using an opaque frame, we consider the entire window rect to be client
// area visually.
diff --git a/views/window/window_win.h b/views/window/window_win.h
index 5cd2bdd..4542383 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/window.h"
namespace gfx {
@@ -31,15 +31,14 @@ 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 represents a Window.
//
-///////////////////////////////////////////////////////////////////////////////
-class WindowWin : public WidgetWin,
+////////////////////////////////////////////////////////////////////////////////
+class WindowWin : public NativeWidgetWin,
public Window {
public:
virtual ~WindowWin();
@@ -124,7 +123,7 @@ class WindowWin : public WidgetWin,
// crazily complicated.
virtual gfx::Insets GetClientAreaInsets() const;
- // Overridden from WidgetWin:
+ // Overridden from NativeWidgetWin:
virtual void OnActivate(UINT action, BOOL minimized, HWND window);
virtual void OnActivateApp(BOOL active, DWORD thread_id);
virtual LRESULT OnAppCommand(HWND window, short app_command, WORD device,