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/strings/string_util.h" | 8 #include "base/strings/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_client.h" | 10 #include "ui/aura/client/activation_client.h" |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 } | 514 } |
515 | 515 |
516 void NativeWidgetAura::Deactivate() { | 516 void NativeWidgetAura::Deactivate() { |
517 if (!window_) | 517 if (!window_) |
518 return; | 518 return; |
519 aura::client::GetActivationClient(window_->GetRootWindow())->DeactivateWindow( | 519 aura::client::GetActivationClient(window_->GetRootWindow())->DeactivateWindow( |
520 window_); | 520 window_); |
521 } | 521 } |
522 | 522 |
523 bool NativeWidgetAura::IsActive() const { | 523 bool NativeWidgetAura::IsActive() const { |
524 return window_ && | 524 if (!window_) |
525 aura::client::GetActivationClient(window_->GetRootWindow())-> | 525 return false; |
526 GetActiveWindow() == window_; | 526 |
| 527 // We may up here during destruction of the root, in which case |
| 528 // GetRootWindow() returns NULL (~RootWindow() has run and we're in ~Window). |
| 529 aura::RootWindow* root = window_->GetRootWindow(); |
| 530 return root && |
| 531 aura::client::GetActivationClient(root)->GetActiveWindow() == window_; |
527 } | 532 } |
528 | 533 |
529 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { | 534 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { |
530 if (window_) | 535 if (window_) |
531 window_->SetProperty(aura::client::kAlwaysOnTopKey, on_top); | 536 window_->SetProperty(aura::client::kAlwaysOnTopKey, on_top); |
532 } | 537 } |
533 | 538 |
534 void NativeWidgetAura::Maximize() { | 539 void NativeWidgetAura::Maximize() { |
535 if (window_) | 540 if (window_) |
536 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 541 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 return aura::Env::GetInstance()->is_mouse_button_down(); | 1128 return aura::Env::GetInstance()->is_mouse_button_down(); |
1124 } | 1129 } |
1125 | 1130 |
1126 // static | 1131 // static |
1127 bool NativeWidgetPrivate::IsTouchDown() { | 1132 bool NativeWidgetPrivate::IsTouchDown() { |
1128 return aura::Env::GetInstance()->is_touch_down(); | 1133 return aura::Env::GetInstance()->is_touch_down(); |
1129 } | 1134 } |
1130 | 1135 |
1131 } // namespace internal | 1136 } // namespace internal |
1132 } // namespace views | 1137 } // namespace views |
OLD | NEW |