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

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

Issue 2753813003: Fix theme change paint issue on linux. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « ui/views/widget/widget.h ('k') | ui/views/win/hwnd_message_handler.cc » ('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) 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/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 focus_on_creation_(true), 168 focus_on_creation_(true),
169 is_top_level_(false), 169 is_top_level_(false),
170 native_widget_initialized_(false), 170 native_widget_initialized_(false),
171 native_widget_destroyed_(false), 171 native_widget_destroyed_(false),
172 is_mouse_button_pressed_(false), 172 is_mouse_button_pressed_(false),
173 ignore_capture_loss_(false), 173 ignore_capture_loss_(false),
174 last_mouse_event_was_move_(false), 174 last_mouse_event_was_move_(false),
175 auto_release_capture_(true), 175 auto_release_capture_(true),
176 views_with_layers_dirty_(false), 176 views_with_layers_dirty_(false),
177 movement_disabled_(false), 177 movement_disabled_(false),
178 observer_manager_(this), 178 observer_manager_(this) {}
179 processing_theme_changed_(false) {}
180 179
181 Widget::~Widget() { 180 Widget::~Widget() {
182 DestroyRootView(); 181 DestroyRootView();
183 if (ownership_ == InitParams::WIDGET_OWNS_NATIVE_WIDGET) { 182 if (ownership_ == InitParams::WIDGET_OWNS_NATIVE_WIDGET) {
184 delete native_widget_; 183 delete native_widget_;
185 } else { 184 } else {
186 DCHECK(native_widget_destroyed_) 185 DCHECK(native_widget_destroyed_)
187 << "Destroying a widget with a live native widget. " 186 << "Destroying a widget with a live native widget. "
188 << "Widget probably should use WIDGET_OWNS_NATIVE_WIDGET ownership."; 187 << "Widget probably should use WIDGET_OWNS_NATIVE_WIDGET ownership.";
189 } 188 }
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 frame_type_ = ShouldUseNativeFrame() ? FRAME_TYPE_FORCE_CUSTOM : 911 frame_type_ = ShouldUseNativeFrame() ? FRAME_TYPE_FORCE_CUSTOM :
913 FRAME_TYPE_FORCE_NATIVE; 912 FRAME_TYPE_FORCE_NATIVE;
914 } else { 913 } else {
915 frame_type_ = frame_type_ == FRAME_TYPE_FORCE_CUSTOM ? 914 frame_type_ = frame_type_ == FRAME_TYPE_FORCE_CUSTOM ?
916 FRAME_TYPE_FORCE_NATIVE : FRAME_TYPE_FORCE_CUSTOM; 915 FRAME_TYPE_FORCE_NATIVE : FRAME_TYPE_FORCE_CUSTOM;
917 } 916 }
918 FrameTypeChanged(); 917 FrameTypeChanged();
919 } 918 }
920 919
921 void Widget::FrameTypeChanged() { 920 void Widget::FrameTypeChanged() {
922 if (processing_theme_changed_)
923 return;
924 native_widget_->FrameTypeChanged(); 921 native_widget_->FrameTypeChanged();
925 } 922 }
926 923
927 const ui::Compositor* Widget::GetCompositor() const { 924 const ui::Compositor* Widget::GetCompositor() const {
928 return native_widget_->GetCompositor(); 925 return native_widget_->GetCompositor();
929 } 926 }
930 927
931 const ui::Layer* Widget::GetLayer() const { 928 const ui::Layer* Widget::GetLayer() const {
932 return native_widget_->GetLayer(); 929 return native_widget_->GetLayer();
933 } 930 }
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 1417
1421 void Widget::OnNativeThemeUpdated(ui::NativeTheme* observed_theme) { 1418 void Widget::OnNativeThemeUpdated(ui::NativeTheme* observed_theme) {
1422 DCHECK(observer_manager_.IsObserving(observed_theme)); 1419 DCHECK(observer_manager_.IsObserving(observed_theme));
1423 1420
1424 ui::NativeTheme* current_native_theme = GetNativeTheme(); 1421 ui::NativeTheme* current_native_theme = GetNativeTheme();
1425 if (!observer_manager_.IsObserving(current_native_theme)) { 1422 if (!observer_manager_.IsObserving(current_native_theme)) {
1426 observer_manager_.RemoveAll(); 1423 observer_manager_.RemoveAll();
1427 observer_manager_.Add(current_native_theme); 1424 observer_manager_.Add(current_native_theme);
1428 } 1425 }
1429 1426
1430 DCHECK_EQ(processing_theme_changed_, false);
1431
1432 base::AutoReset<bool> auto_theme_changed_recursion_break(
1433 &processing_theme_changed_, true);
1434 root_view_->PropagateNativeThemeChanged(current_native_theme); 1427 root_view_->PropagateNativeThemeChanged(current_native_theme);
1435 } 1428 }
1436 1429
1437 //////////////////////////////////////////////////////////////////////////////// 1430 ////////////////////////////////////////////////////////////////////////////////
1438 // Widget, protected: 1431 // Widget, protected:
1439 1432
1440 internal::RootView* Widget::CreateRootView() { 1433 internal::RootView* Widget::CreateRootView() {
1441 return new internal::RootView(this); 1434 return new internal::RootView(this);
1442 } 1435 }
1443 1436
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 1567
1575 //////////////////////////////////////////////////////////////////////////////// 1568 ////////////////////////////////////////////////////////////////////////////////
1576 // internal::NativeWidgetPrivate, NativeWidget implementation: 1569 // internal::NativeWidgetPrivate, NativeWidget implementation:
1577 1570
1578 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1571 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1579 return this; 1572 return this;
1580 } 1573 }
1581 1574
1582 } // namespace internal 1575 } // namespace internal
1583 } // namespace views 1576 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/widget.h ('k') | ui/views/win/hwnd_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698