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

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

Issue 239093007: Update Windows UI on system color changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make Widget the observer, address additional comments. Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/widget/widget.h" 5 #include "ui/views/widget/widget.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 saved_show_state_(ui::SHOW_STATE_DEFAULT), 176 saved_show_state_(ui::SHOW_STATE_DEFAULT),
177 focus_on_creation_(true), 177 focus_on_creation_(true),
178 is_top_level_(false), 178 is_top_level_(false),
179 native_widget_initialized_(false), 179 native_widget_initialized_(false),
180 native_widget_destroyed_(false), 180 native_widget_destroyed_(false),
181 is_mouse_button_pressed_(false), 181 is_mouse_button_pressed_(false),
182 is_touch_down_(false), 182 is_touch_down_(false),
183 last_mouse_event_was_move_(false), 183 last_mouse_event_was_move_(false),
184 auto_release_capture_(true), 184 auto_release_capture_(true),
185 root_layers_dirty_(false), 185 root_layers_dirty_(false),
186 movement_disabled_(false) { 186 movement_disabled_(false),
187 observer_manager_(this) {
187 } 188 }
188 189
189 Widget::~Widget() { 190 Widget::~Widget() {
190 DestroyRootView(); 191 DestroyRootView();
191 if (ownership_ == InitParams::WIDGET_OWNS_NATIVE_WIDGET) { 192 if (ownership_ == InitParams::WIDGET_OWNS_NATIVE_WIDGET) {
192 delete native_widget_; 193 delete native_widget_;
193 } else { 194 } else {
194 DCHECK(native_widget_destroyed_) 195 DCHECK(native_widget_destroyed_)
195 << "Destroying a widget with a live native widget. " 196 << "Destroying a widget with a live native widget. "
196 << "Widget probably should use WIDGET_OWNS_NATIVE_WIDGET ownership."; 197 << "Widget probably should use WIDGET_OWNS_NATIVE_WIDGET ownership.";
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 ownership_ = params.ownership; 362 ownership_ = params.ownership;
362 native_widget_ = CreateNativeWidget(params.native_widget, this)-> 363 native_widget_ = CreateNativeWidget(params.native_widget, this)->
363 AsNativeWidgetPrivate(); 364 AsNativeWidgetPrivate();
364 root_view_.reset(CreateRootView()); 365 root_view_.reset(CreateRootView());
365 default_theme_provider_.reset(new ui::DefaultThemeProvider); 366 default_theme_provider_.reset(new ui::DefaultThemeProvider);
366 if (params.type == InitParams::TYPE_MENU) { 367 if (params.type == InitParams::TYPE_MENU) {
367 is_mouse_button_pressed_ = 368 is_mouse_button_pressed_ =
368 internal::NativeWidgetPrivate::IsMouseButtonDown(); 369 internal::NativeWidgetPrivate::IsMouseButtonDown();
369 } 370 }
370 native_widget_->InitNativeWidget(params); 371 native_widget_->InitNativeWidget(params);
372 observer_manager_.Add(GetNativeTheme());
371 if (RequiresNonClientView(params.type)) { 373 if (RequiresNonClientView(params.type)) {
372 non_client_view_ = new NonClientView; 374 non_client_view_ = new NonClientView;
373 non_client_view_->SetFrameView(CreateNonClientFrameView()); 375 non_client_view_->SetFrameView(CreateNonClientFrameView());
374 // Create the ClientView, add it to the NonClientView and add the 376 // Create the ClientView, add it to the NonClientView and add the
375 // NonClientView to the RootView. This will cause everything to be parented. 377 // NonClientView to the RootView. This will cause everything to be parented.
376 non_client_view_->set_client_view(widget_delegate_->CreateClientView(this)); 378 non_client_view_->set_client_view(widget_delegate_->CreateClientView(this));
377 non_client_view_->SetOverlayView(widget_delegate_->CreateOverlayView()); 379 non_client_view_->SetOverlayView(widget_delegate_->CreateOverlayView());
378 SetContentsView(non_client_view_); 380 SetContentsView(non_client_view_);
379 // Initialize the window's title before setting the window's initial bounds; 381 // Initialize the window's title before setting the window's initial bounds;
380 // the frame view's preferred height may depend on the presence of a title. 382 // the frame view's preferred height may depend on the presence of a title.
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 } 1334 }
1333 1335
1334 View* Widget::GetFocusTraversableParentView() { 1336 View* Widget::GetFocusTraversableParentView() {
1335 // We are a proxy to the root view, so we should be bypassed when traversing 1337 // We are a proxy to the root view, so we should be bypassed when traversing
1336 // up and as a result this should not be called. 1338 // up and as a result this should not be called.
1337 NOTREACHED(); 1339 NOTREACHED();
1338 return NULL; 1340 return NULL;
1339 } 1341 }
1340 1342
1341 //////////////////////////////////////////////////////////////////////////////// 1343 ////////////////////////////////////////////////////////////////////////////////
1344 // Widget, ui::NativeThemeObserver implementation:
1345
1346 void Widget::OnNativeThemeUpdate() {
Evan Stade 2014/04/24 01:14:52 I still think this should pass the calling native
msw 2014/04/24 18:32:00 Done; this is a good idea, thanks for pushing for
1347 root_view_->PropagateNativeThemeChanged(GetNativeTheme());
1348 }
1349
1350 ////////////////////////////////////////////////////////////////////////////////
1342 // Widget, protected: 1351 // Widget, protected:
1343 1352
1344 internal::RootView* Widget::CreateRootView() { 1353 internal::RootView* Widget::CreateRootView() {
1345 return new internal::RootView(this); 1354 return new internal::RootView(this);
1346 } 1355 }
1347 1356
1348 void Widget::DestroyRootView() { 1357 void Widget::DestroyRootView() {
1349 non_client_view_ = NULL; 1358 non_client_view_ = NULL;
1350 root_view_.reset(); 1359 root_view_.reset();
1351 // Input method has to be destroyed before focus manager. 1360 // Input method has to be destroyed before focus manager.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 1472
1464 //////////////////////////////////////////////////////////////////////////////// 1473 ////////////////////////////////////////////////////////////////////////////////
1465 // internal::NativeWidgetPrivate, NativeWidget implementation: 1474 // internal::NativeWidgetPrivate, NativeWidget implementation:
1466 1475
1467 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1476 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1468 return this; 1477 return this;
1469 } 1478 }
1470 1479
1471 } // namespace internal 1480 } // namespace internal
1472 } // namespace views 1481 } // namespace views
OLDNEW
« chrome/browser/ui/libgtk2ui/gtk2_border.cc ('K') | « ui/views/widget/widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698