| 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/native_widget_aura.h" | 5 #include "ui/views/widget/native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
| 10 #include "ui/aura/client/activation_change_observer.h" | 10 #include "ui/aura/client/activation_change_observer.h" |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 // regardless of show state. | 539 // regardless of show state. |
| 540 SetInitialFocus(); | 540 SetInitialFocus(); |
| 541 } | 541 } |
| 542 } | 542 } |
| 543 | 543 |
| 544 bool NativeWidgetAura::IsVisible() const { | 544 bool NativeWidgetAura::IsVisible() const { |
| 545 return window_->IsVisible(); | 545 return window_->IsVisible(); |
| 546 } | 546 } |
| 547 | 547 |
| 548 void NativeWidgetAura::Activate() { | 548 void NativeWidgetAura::Activate() { |
| 549 aura::client::GetActivationClient(window_->GetRootWindow())->ActivateWindow( | 549 // We don't necessarily have a root window yet. This can happen with |
| 550 window_); | 550 // constrained windows. |
| 551 if (window_->GetRootWindow()) |
| 552 aura::client::GetActivationClient(window_->GetRootWindow())->ActivateWindow( |
| 553 window_); |
| 551 } | 554 } |
| 552 | 555 |
| 553 void NativeWidgetAura::Deactivate() { | 556 void NativeWidgetAura::Deactivate() { |
| 554 aura::client::GetActivationClient(window_->GetRootWindow())->DeactivateWindow( | 557 aura::client::GetActivationClient(window_->GetRootWindow())->DeactivateWindow( |
| 555 window_); | 558 window_); |
| 556 } | 559 } |
| 557 | 560 |
| 558 bool NativeWidgetAura::IsActive() const { | 561 bool NativeWidgetAura::IsActive() const { |
| 559 return aura::client::GetActivationClient(window_->GetRootWindow())-> | 562 return aura::client::GetActivationClient(window_->GetRootWindow())-> |
| 560 GetActiveWindow() == window_; | 563 GetActiveWindow() == window_; |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 return top_level_native_widget; | 998 return top_level_native_widget; |
| 996 } | 999 } |
| 997 | 1000 |
| 998 // static | 1001 // static |
| 999 void NativeWidgetPrivate::GetAllChildWidgets(gfx::NativeView native_view, | 1002 void NativeWidgetPrivate::GetAllChildWidgets(gfx::NativeView native_view, |
| 1000 Widget::Widgets* children) { | 1003 Widget::Widgets* children) { |
| 1001 { | 1004 { |
| 1002 // Code expects widget for |native_view| to be added to |children|. | 1005 // Code expects widget for |native_view| to be added to |children|. |
| 1003 NativeWidgetAura* native_widget = static_cast<NativeWidgetAura*>( | 1006 NativeWidgetAura* native_widget = static_cast<NativeWidgetAura*>( |
| 1004 GetNativeWidgetForNativeView(native_view)); | 1007 GetNativeWidgetForNativeView(native_view)); |
| 1005 if (native_widget->GetWidget()) | 1008 if (native_widget && native_widget->GetWidget()) |
| 1006 children->insert(native_widget->GetWidget()); | 1009 children->insert(native_widget->GetWidget()); |
| 1007 } | 1010 } |
| 1008 | 1011 |
| 1009 const aura::Window::Windows& child_windows = native_view->children(); | 1012 const aura::Window::Windows& child_windows = native_view->children(); |
| 1010 for (aura::Window::Windows::const_iterator i = child_windows.begin(); | 1013 for (aura::Window::Windows::const_iterator i = child_windows.begin(); |
| 1011 i != child_windows.end(); ++i) { | 1014 i != child_windows.end(); ++i) { |
| 1012 NativeWidgetAura* native_widget = | 1015 NativeWidgetAura* native_widget = |
| 1013 static_cast<NativeWidgetAura*>(GetNativeWidgetForNativeView(*i)); | 1016 static_cast<NativeWidgetAura*>(GetNativeWidgetForNativeView(*i)); |
| 1014 if (native_widget) | 1017 if (native_widget) |
| 1015 children->insert(native_widget->GetWidget()); | 1018 children->insert(native_widget->GetWidget()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 return aura::Env::GetInstance()->is_mouse_button_down(); | 1052 return aura::Env::GetInstance()->is_mouse_button_down(); |
| 1050 } | 1053 } |
| 1051 | 1054 |
| 1052 // static | 1055 // static |
| 1053 bool NativeWidgetPrivate::IsTouchDown() { | 1056 bool NativeWidgetPrivate::IsTouchDown() { |
| 1054 return aura::Env::GetInstance()->is_touch_down(); | 1057 return aura::Env::GetInstance()->is_touch_down(); |
| 1055 } | 1058 } |
| 1056 | 1059 |
| 1057 } // namespace internal | 1060 } // namespace internal |
| 1058 } // namespace views | 1061 } // namespace views |
| OLD | NEW |