Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Unified Diff: views/widget/widget_win.cc

Issue 6881107: Rework the way Widget::Init works: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/widget/widget_win.h ('k') | views/widget/widget_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/widget_win.cc
===================================================================
--- views/widget/widget_win.cc (revision 83020)
+++ views/widget/widget_win.cc (working copy)
@@ -194,17 +194,6 @@
////////////////////////////////////////////////////////////////////////////////
// WidgetWin, Widget implementation:
-void WidgetWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) {
- Widget::Init(parent, bounds);
-
- // Create the window.
- WindowImpl::Init(parent, bounds);
-}
-
-void WidgetWin::InitWithWidget(Widget* parent, const gfx::Rect& bounds) {
- Init(parent->GetNativeView(), bounds);
-}
-
gfx::NativeView WidgetWin::GetNativeView() const {
return WindowImpl::hwnd();
}
@@ -234,59 +223,13 @@
////////////////////////////////////////////////////////////////////////////////
// WidgetWin, NativeWidget implementation:
-void WidgetWin::SetCreateParams(const CreateParams& params) {
- DCHECK(!GetNativeView());
+void WidgetWin::InitNativeWidget(const Widget::CreateParams& params) {
+ SetCreateParams(params);
- // Set non-style attributes.
- delete_on_destroy_ = params.delete_on_destroy;
-
- DWORD style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
- DWORD ex_style = 0;
- DWORD class_style = CS_DBLCLKS;
-
- // Set type-independent style attributes.
- if (params.child)
- style |= WS_CHILD | WS_VISIBLE;
- if (!params.accept_events)
- ex_style |= WS_EX_TRANSPARENT;
- if (!params.can_activate)
- ex_style |= WS_EX_NOACTIVATE;
- if (params.keep_on_top)
- ex_style |= WS_EX_TOPMOST;
- if (params.mirror_origin_in_rtl)
- ex_style |= l10n_util::GetExtendedTooltipStyles();
- if (params.transparent)
- ex_style |= WS_EX_LAYERED;
- if (params.has_dropshadow) {
- class_style |= (base::win::GetVersion() < base::win::VERSION_XP) ?
- 0 : CS_DROPSHADOW;
- }
-
- // Set type-dependent style attributes.
- switch (params.type) {
- case CreateParams::TYPE_WINDOW:
- case CreateParams::TYPE_CONTROL:
- break;
- case CreateParams::TYPE_POPUP:
- style |= WS_POPUP;
- ex_style |= WS_EX_TOOLWINDOW;
- break;
- case CreateParams::TYPE_MENU:
- style |= WS_POPUP;
- is_mouse_button_pressed_ =
- ((GetKeyState(VK_LBUTTON) & 0x80) ||
- (GetKeyState(VK_RBUTTON) & 0x80) ||
- (GetKeyState(VK_MBUTTON) & 0x80) ||
- (GetKeyState(VK_XBUTTON1) & 0x80) ||
- (GetKeyState(VK_XBUTTON2) & 0x80));
- break;
- default:
- NOTREACHED();
- }
-
- set_initial_class_style(class_style);
- set_window_style(style);
- set_window_ex_style(ex_style);
+ // Create the window.
+ gfx::NativeView parent = params.parent_widget ?
+ params.parent_widget->GetNativeView() : params.parent;
+ WindowImpl::Init(parent, params.bounds);
}
Widget* WidgetWin::GetWidget() {
@@ -1123,10 +1066,8 @@
// Widget, public:
// static
-Widget* Widget::CreateWidget(const CreateParams& params) {
- WidgetWin* widget = new WidgetWin;
- widget->SetCreateParams(params);
- return widget;
+Widget* Widget::CreateWidget() {
+ return new WidgetWin;
}
// static
« no previous file with comments | « views/widget/widget_win.h ('k') | views/widget/widget_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698