| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "ui/base/hit_test.h" | 10 #include "ui/base/hit_test.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ui/views/widget/native_widget_private.h" | 23 #include "ui/views/widget/native_widget_private.h" |
| 24 #include "ui/views/widget/root_view.h" | 24 #include "ui/views/widget/root_view.h" |
| 25 #include "ui/views/widget/tooltip_manager.h" | 25 #include "ui/views/widget/tooltip_manager.h" |
| 26 #include "ui/views/widget/widget_delegate.h" | 26 #include "ui/views/widget/widget_delegate.h" |
| 27 #include "ui/views/window/custom_frame_view.h" | 27 #include "ui/views/window/custom_frame_view.h" |
| 28 | 28 |
| 29 #if !defined(OS_MACOSX) | 29 #if !defined(OS_MACOSX) |
| 30 #include "ui/views/controls/menu/menu_controller.h" | 30 #include "ui/views/controls/menu/menu_controller.h" |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 namespace { | |
| 34 | |
| 35 // Set to true if a pure Views implementation is preferred | |
| 36 bool use_pure_views = false; | |
| 37 | |
| 38 } // namespace | |
| 39 | |
| 40 namespace views { | 33 namespace views { |
| 41 | 34 |
| 42 // This class is used to keep track of the event a Widget is processing, and | 35 // This class is used to keep track of the event a Widget is processing, and |
| 43 // restore any previously active event afterwards. | 36 // restore any previously active event afterwards. |
| 44 class ScopedEvent { | 37 class ScopedEvent { |
| 45 public: | 38 public: |
| 46 ScopedEvent(Widget* widget, const Event& event) | 39 ScopedEvent(Widget* widget, const Event& event) |
| 47 : widget_(widget), | 40 : widget_(widget), |
| 48 event_(&event) { | 41 event_(&event) { |
| 49 widget->event_stack_.push(this); | 42 widget->event_stack_.push(this); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 params.delegate = delegate; | 215 params.delegate = delegate; |
| 223 #if defined(OS_WIN) || defined(USE_AURA) | 216 #if defined(OS_WIN) || defined(USE_AURA) |
| 224 params.parent = parent; | 217 params.parent = parent; |
| 225 #endif | 218 #endif |
| 226 params.bounds = bounds; | 219 params.bounds = bounds; |
| 227 widget->Init(params); | 220 widget->Init(params); |
| 228 return widget; | 221 return widget; |
| 229 } | 222 } |
| 230 | 223 |
| 231 // static | 224 // static |
| 232 void Widget::SetPureViews(bool pure) { | |
| 233 use_pure_views = pure; | |
| 234 } | |
| 235 | |
| 236 // static | |
| 237 bool Widget::IsPureViews() { | |
| 238 #if defined(USE_AURA) | |
| 239 return true; | |
| 240 #else | |
| 241 return use_pure_views; | |
| 242 #endif | |
| 243 } | |
| 244 | |
| 245 // static | |
| 246 Widget* Widget::GetWidgetForNativeView(gfx::NativeView native_view) { | 225 Widget* Widget::GetWidgetForNativeView(gfx::NativeView native_view) { |
| 247 internal::NativeWidgetPrivate* native_widget = | 226 internal::NativeWidgetPrivate* native_widget = |
| 248 internal::NativeWidgetPrivate::GetNativeWidgetForNativeView(native_view); | 227 internal::NativeWidgetPrivate::GetNativeWidgetForNativeView(native_view); |
| 249 return native_widget ? native_widget->GetWidget() : NULL; | 228 return native_widget ? native_widget->GetWidget() : NULL; |
| 250 } | 229 } |
| 251 | 230 |
| 252 // static | 231 // static |
| 253 Widget* Widget::GetWidgetForNativeWindow(gfx::NativeWindow native_window) { | 232 Widget* Widget::GetWidgetForNativeWindow(gfx::NativeWindow native_window) { |
| 254 internal::NativeWidgetPrivate* native_widget = | 233 internal::NativeWidgetPrivate* native_widget = |
| 255 internal::NativeWidgetPrivate::GetNativeWidgetForNativeWindow( | 234 internal::NativeWidgetPrivate::GetNativeWidgetForNativeWindow( |
| (...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 | 1255 |
| 1277 //////////////////////////////////////////////////////////////////////////////// | 1256 //////////////////////////////////////////////////////////////////////////////// |
| 1278 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1257 // internal::NativeWidgetPrivate, NativeWidget implementation: |
| 1279 | 1258 |
| 1280 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1259 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
| 1281 return this; | 1260 return this; |
| 1282 } | 1261 } |
| 1283 | 1262 |
| 1284 } // namespace internal | 1263 } // namespace internal |
| 1285 } // namespace views | 1264 } // namespace views |
| OLD | NEW |