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

Side by Side Diff: views/widget/widget.cc

Issue 6881107: Rework the way Widget::Init works: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/widget/widget.h ('k') | views/widget/widget_gtk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/widget/widget.h" 5 #include "views/widget/widget.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "ui/gfx/compositor/compositor.h" 9 #include "ui/gfx/compositor/compositor.h"
10 #include "views/focus/view_storage.h" 10 #include "views/focus/view_storage.h"
(...skipping 10 matching lines...) Expand all
21 Widget::CreateParams::CreateParams() 21 Widget::CreateParams::CreateParams()
22 : type(TYPE_WINDOW), 22 : type(TYPE_WINDOW),
23 child(false), 23 child(false),
24 transparent(false), 24 transparent(false),
25 accept_events(true), 25 accept_events(true),
26 can_activate(true), 26 can_activate(true),
27 keep_on_top(false), 27 keep_on_top(false),
28 delete_on_destroy(true), 28 delete_on_destroy(true),
29 mirror_origin_in_rtl(false), 29 mirror_origin_in_rtl(false),
30 has_dropshadow(false), 30 has_dropshadow(false),
31 parent(NULL),
32 parent_widget(NULL),
31 native_widget(NULL) { 33 native_widget(NULL) {
32 } 34 }
33 35
34 Widget::CreateParams::CreateParams(Type type) 36 Widget::CreateParams::CreateParams(Type type)
35 : type(type), 37 : type(type),
36 child(type == TYPE_CONTROL), 38 child(type == TYPE_CONTROL),
37 transparent(false), 39 transparent(false),
38 accept_events(true), 40 accept_events(true),
39 can_activate(type != TYPE_POPUP && type != TYPE_MENU), 41 can_activate(type != TYPE_POPUP && type != TYPE_MENU),
40 keep_on_top(type == TYPE_MENU), 42 keep_on_top(type == TYPE_MENU),
41 delete_on_destroy(true), 43 delete_on_destroy(true),
42 mirror_origin_in_rtl(false), 44 mirror_origin_in_rtl(false),
43 has_dropshadow(false), 45 has_dropshadow(false),
46 parent(NULL),
47 parent_widget(NULL),
44 native_widget(NULL) { 48 native_widget(NULL) {
45 } 49 }
46 50
47 //////////////////////////////////////////////////////////////////////////////// 51 ////////////////////////////////////////////////////////////////////////////////
48 // Widget, public: 52 // Widget, public:
49 53
54 // static
55 Widget::CreateParams Widget::WindowCreateParams() {
56 return CreateParams(CreateParams::TYPE_WINDOW);
57 }
58
50 Widget::Widget() 59 Widget::Widget()
51 : is_mouse_button_pressed_(false), 60 : is_mouse_button_pressed_(false),
52 last_mouse_event_was_move_(false), 61 last_mouse_event_was_move_(false),
53 native_widget_(NULL), 62 native_widget_(NULL),
54 widget_delegate_(NULL), 63 widget_delegate_(NULL),
55 dragged_view_(NULL) { 64 dragged_view_(NULL) {
56 } 65 }
57 66
58 Widget::~Widget() { 67 Widget::~Widget() {
59 } 68 }
60 69
61 void Widget::SetCreateParams(const CreateParams& params) { 70 void Widget::Init(const CreateParams& params) {
62 native_widget_->SetCreateParams(params); 71 GetRootView();
72 default_theme_provider_.reset(new DefaultThemeProvider);
73 native_widget_->InitNativeWidget(params);
63 } 74 }
64 75
65 // Unconverted methods (see header) -------------------------------------------- 76 // Unconverted methods (see header) --------------------------------------------
66 77
67 void Widget::Init(gfx::NativeView parent, const gfx::Rect& bounds) {
68 GetRootView();
69 default_theme_provider_.reset(new DefaultThemeProvider);
70 }
71
72 void Widget::InitWithWidget(Widget* parent, const gfx::Rect& bounds) {
73 }
74
75 gfx::NativeView Widget::GetNativeView() const { 78 gfx::NativeView Widget::GetNativeView() const {
76 return NULL; 79 return NULL;
77 } 80 }
78 81
79 void Widget::GenerateMousePressedForView(View* view, const gfx::Point& point) { 82 void Widget::GenerateMousePressedForView(View* view, const gfx::Point& point) {
80 } 83 }
81 84
82 bool Widget::GetAccelerator(int cmd_id, ui::Accelerator* accelerator) { 85 bool Widget::GetAccelerator(int cmd_id, ui::Accelerator* accelerator) {
83 return false; 86 return false;
84 } 87 }
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 compositor_ = ui::Compositor::Create(widget); 449 compositor_ = ui::Compositor::Create(widget);
447 450
448 return compositor_.get() != NULL; 451 return compositor_.get() != NULL;
449 } 452 }
450 453
451 bool Widget::ShouldReleaseCaptureOnMouseReleased() const { 454 bool Widget::ShouldReleaseCaptureOnMouseReleased() const {
452 return true; 455 return true;
453 } 456 }
454 457
455 } // namespace views 458 } // namespace views
OLDNEW
« no previous file with comments | « views/widget/widget.h ('k') | views/widget/widget_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698