| OLD | NEW | 
|---|
| 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/logging.h" | 8 #include "base/logging.h" | 
| 8 #include "base/macros.h" | 9 #include "base/macros.h" | 
| 9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" | 
| 10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" | 
| 11 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" | 
| 12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" | 
| 13 #include "ui/base/cursor/cursor.h" | 14 #include "ui/base/cursor/cursor.h" | 
| 14 #include "ui/base/default_style.h" | 15 #include "ui/base/default_style.h" | 
| 15 #include "ui/base/default_theme_provider.h" | 16 #include "ui/base/default_theme_provider.h" | 
| 16 #include "ui/base/hit_test.h" | 17 #include "ui/base/hit_test.h" | 
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 167       focus_on_creation_(true), | 168       focus_on_creation_(true), | 
| 168       is_top_level_(false), | 169       is_top_level_(false), | 
| 169       native_widget_initialized_(false), | 170       native_widget_initialized_(false), | 
| 170       native_widget_destroyed_(false), | 171       native_widget_destroyed_(false), | 
| 171       is_mouse_button_pressed_(false), | 172       is_mouse_button_pressed_(false), | 
| 172       ignore_capture_loss_(false), | 173       ignore_capture_loss_(false), | 
| 173       last_mouse_event_was_move_(false), | 174       last_mouse_event_was_move_(false), | 
| 174       auto_release_capture_(true), | 175       auto_release_capture_(true), | 
| 175       views_with_layers_dirty_(false), | 176       views_with_layers_dirty_(false), | 
| 176       movement_disabled_(false), | 177       movement_disabled_(false), | 
| 177       observer_manager_(this) {} | 178       observer_manager_(this), | 
|  | 179       processing_theme_changed_(false) {} | 
| 178 | 180 | 
| 179 Widget::~Widget() { | 181 Widget::~Widget() { | 
| 180   DestroyRootView(); | 182   DestroyRootView(); | 
| 181   if (ownership_ == InitParams::WIDGET_OWNS_NATIVE_WIDGET) { | 183   if (ownership_ == InitParams::WIDGET_OWNS_NATIVE_WIDGET) { | 
| 182     delete native_widget_; | 184     delete native_widget_; | 
| 183   } else { | 185   } else { | 
| 184     DCHECK(native_widget_destroyed_) | 186     DCHECK(native_widget_destroyed_) | 
| 185         << "Destroying a widget with a live native widget. " | 187         << "Destroying a widget with a live native widget. " | 
| 186         << "Widget probably should use WIDGET_OWNS_NATIVE_WIDGET ownership."; | 188         << "Widget probably should use WIDGET_OWNS_NATIVE_WIDGET ownership."; | 
| 187   } | 189   } | 
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 891     frame_type_ = ShouldUseNativeFrame() ? FRAME_TYPE_FORCE_CUSTOM : | 893     frame_type_ = ShouldUseNativeFrame() ? FRAME_TYPE_FORCE_CUSTOM : | 
| 892         FRAME_TYPE_FORCE_NATIVE; | 894         FRAME_TYPE_FORCE_NATIVE; | 
| 893   } else { | 895   } else { | 
| 894     frame_type_ = frame_type_ == FRAME_TYPE_FORCE_CUSTOM ? | 896     frame_type_ = frame_type_ == FRAME_TYPE_FORCE_CUSTOM ? | 
| 895         FRAME_TYPE_FORCE_NATIVE : FRAME_TYPE_FORCE_CUSTOM; | 897         FRAME_TYPE_FORCE_NATIVE : FRAME_TYPE_FORCE_CUSTOM; | 
| 896   } | 898   } | 
| 897   FrameTypeChanged(); | 899   FrameTypeChanged(); | 
| 898 } | 900 } | 
| 899 | 901 | 
| 900 void Widget::FrameTypeChanged() { | 902 void Widget::FrameTypeChanged() { | 
|  | 903   if (processing_theme_changed_) | 
|  | 904     return; | 
| 901   native_widget_->FrameTypeChanged(); | 905   native_widget_->FrameTypeChanged(); | 
| 902 } | 906 } | 
| 903 | 907 | 
| 904 const ui::Compositor* Widget::GetCompositor() const { | 908 const ui::Compositor* Widget::GetCompositor() const { | 
| 905   return native_widget_->GetCompositor(); | 909   return native_widget_->GetCompositor(); | 
| 906 } | 910 } | 
| 907 | 911 | 
| 908 const ui::Layer* Widget::GetLayer() const { | 912 const ui::Layer* Widget::GetLayer() const { | 
| 909   return native_widget_->GetLayer(); | 913   return native_widget_->GetLayer(); | 
| 910 } | 914 } | 
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1394 | 1398 | 
| 1395 void Widget::OnNativeThemeUpdated(ui::NativeTheme* observed_theme) { | 1399 void Widget::OnNativeThemeUpdated(ui::NativeTheme* observed_theme) { | 
| 1396   DCHECK(observer_manager_.IsObserving(observed_theme)); | 1400   DCHECK(observer_manager_.IsObserving(observed_theme)); | 
| 1397 | 1401 | 
| 1398   ui::NativeTheme* current_native_theme = GetNativeTheme(); | 1402   ui::NativeTheme* current_native_theme = GetNativeTheme(); | 
| 1399   if (!observer_manager_.IsObserving(current_native_theme)) { | 1403   if (!observer_manager_.IsObserving(current_native_theme)) { | 
| 1400     observer_manager_.RemoveAll(); | 1404     observer_manager_.RemoveAll(); | 
| 1401     observer_manager_.Add(current_native_theme); | 1405     observer_manager_.Add(current_native_theme); | 
| 1402   } | 1406   } | 
| 1403 | 1407 | 
|  | 1408   DCHECK_EQ(processing_theme_changed_, false); | 
|  | 1409 | 
|  | 1410   base::AutoReset<bool> auto_theme_changed_recursion_break( | 
|  | 1411       &processing_theme_changed_, true); | 
| 1404   root_view_->PropagateNativeThemeChanged(current_native_theme); | 1412   root_view_->PropagateNativeThemeChanged(current_native_theme); | 
| 1405 } | 1413 } | 
| 1406 | 1414 | 
| 1407 //////////////////////////////////////////////////////////////////////////////// | 1415 //////////////////////////////////////////////////////////////////////////////// | 
| 1408 // Widget, protected: | 1416 // Widget, protected: | 
| 1409 | 1417 | 
| 1410 internal::RootView* Widget::CreateRootView() { | 1418 internal::RootView* Widget::CreateRootView() { | 
| 1411   return new internal::RootView(this); | 1419   return new internal::RootView(this); | 
| 1412 } | 1420 } | 
| 1413 | 1421 | 
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1544 | 1552 | 
| 1545 //////////////////////////////////////////////////////////////////////////////// | 1553 //////////////////////////////////////////////////////////////////////////////// | 
| 1546 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1554 // internal::NativeWidgetPrivate, NativeWidget implementation: | 
| 1547 | 1555 | 
| 1548 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1556 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 
| 1549   return this; | 1557   return this; | 
| 1550 } | 1558 } | 
| 1551 | 1559 | 
| 1552 }  // namespace internal | 1560 }  // namespace internal | 
| 1553 }  // namespace views | 1561 }  // namespace views | 
| OLD | NEW | 
|---|