| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura/client/activation_client.h" | 9 #include "ui/aura/client/activation_client.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 aura::RootWindow::GetInstance()->RemoveObserver(this); | 86 aura::RootWindow::GetInstance()->RemoveObserver(this); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // Overridden from aura::WindowObserver: | 89 // Overridden from aura::WindowObserver: |
| 90 virtual void OnWindowPropertyChanged(aura::Window* window, | 90 virtual void OnWindowPropertyChanged(aura::Window* window, |
| 91 const char* key, | 91 const char* key, |
| 92 void* old) OVERRIDE { | 92 void* old) OVERRIDE { |
| 93 if (key != aura::kRootWindowActiveWindow) | 93 if (key != aura::kRootWindowActiveWindow) |
| 94 return; | 94 return; |
| 95 aura::Window* active = | 95 aura::Window* active = |
| 96 aura::ActivationClient::GetActivationClient()->GetActiveWindow(); | 96 aura::client::GetActivationClient()->GetActiveWindow(); |
| 97 if (!active || (active != host_->window_ && | 97 if (!active || (active != host_->window_ && |
| 98 active->transient_parent() != host_->window_)) { | 98 active->transient_parent() != host_->window_)) { |
| 99 host_->delegate_->EnableInactiveRendering(); | 99 host_->delegate_->EnableInactiveRendering(); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 NativeWidgetAura* host_; | 104 NativeWidgetAura* host_; |
| 105 | 105 |
| 106 DISALLOW_COPY_AND_ASSIGN(ActiveWindowObserver); | 106 DISALLOW_COPY_AND_ASSIGN(ActiveWindowObserver); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 if (params.type != Widget::InitParams::TYPE_TOOLTIP) { | 180 if (params.type != Widget::InitParams::TYPE_TOOLTIP) { |
| 181 tooltip_manager_.reset(new views::TooltipManagerAura(this)); | 181 tooltip_manager_.reset(new views::TooltipManagerAura(this)); |
| 182 } | 182 } |
| 183 | 183 |
| 184 drop_helper_.reset(new DropHelper(GetWidget()->GetRootView())); | 184 drop_helper_.reset(new DropHelper(GetWidget()->GetRootView())); |
| 185 if (params.type != Widget::InitParams::TYPE_TOOLTIP && | 185 if (params.type != Widget::InitParams::TYPE_TOOLTIP && |
| 186 params.type != Widget::InitParams::TYPE_POPUP) { | 186 params.type != Widget::InitParams::TYPE_POPUP) { |
| 187 aura::client::SetDragDropDelegate(window_, this); | 187 aura::client::SetDragDropDelegate(window_, this); |
| 188 } | 188 } |
| 189 | 189 |
| 190 aura::ActivationDelegate::SetActivationDelegate(window_, this); | 190 aura::client::SetActivationDelegate(window_, this); |
| 191 | 191 |
| 192 if (window_type == Widget::InitParams::TYPE_MENU || | 192 if (window_type == Widget::InitParams::TYPE_MENU || |
| 193 window_type == Widget::InitParams::TYPE_TOOLTIP) | 193 window_type == Widget::InitParams::TYPE_TOOLTIP) |
| 194 window_->SetIntProperty(aura::kShadowTypeKey, | 194 window_->SetIntProperty(aura::kShadowTypeKey, |
| 195 aura::SHADOW_TYPE_RECTANGULAR); | 195 aura::SHADOW_TYPE_RECTANGULAR); |
| 196 } | 196 } |
| 197 | 197 |
| 198 NonClientFrameView* NativeWidgetAura::CreateNonClientFrameView() { | 198 NonClientFrameView* NativeWidgetAura::CreateNonClientFrameView() { |
| 199 return NULL; | 199 return NULL; |
| 200 } | 200 } |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 !GetWidget()->SetInitialFocus())) { | 435 !GetWidget()->SetInitialFocus())) { |
| 436 Activate(); | 436 Activate(); |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 | 439 |
| 440 bool NativeWidgetAura::IsVisible() const { | 440 bool NativeWidgetAura::IsVisible() const { |
| 441 return window_->IsVisible(); | 441 return window_->IsVisible(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 void NativeWidgetAura::Activate() { | 444 void NativeWidgetAura::Activate() { |
| 445 aura::ActivationClient::GetActivationClient()->ActivateWindow(window_); | 445 aura::client::GetActivationClient()->ActivateWindow(window_); |
| 446 } | 446 } |
| 447 | 447 |
| 448 void NativeWidgetAura::Deactivate() { | 448 void NativeWidgetAura::Deactivate() { |
| 449 aura::ActivationClient::GetActivationClient()->DeactivateWindow(window_); | 449 aura::client::GetActivationClient()->DeactivateWindow(window_); |
| 450 } | 450 } |
| 451 | 451 |
| 452 bool NativeWidgetAura::IsActive() const { | 452 bool NativeWidgetAura::IsActive() const { |
| 453 return aura::ActivationClient::GetActivationClient()->GetActiveWindow() == | 453 return aura::client::GetActivationClient()->GetActiveWindow() == window_; |
| 454 window_; | |
| 455 } | 454 } |
| 456 | 455 |
| 457 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { | 456 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { |
| 458 window_->SetIntProperty(aura::kAlwaysOnTopKey, on_top); | 457 window_->SetIntProperty(aura::kAlwaysOnTopKey, on_top); |
| 459 } | 458 } |
| 460 | 459 |
| 461 void NativeWidgetAura::Maximize() { | 460 void NativeWidgetAura::Maximize() { |
| 462 window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 461 window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 463 } | 462 } |
| 464 | 463 |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 } | 847 } |
| 849 } | 848 } |
| 850 | 849 |
| 851 // static | 850 // static |
| 852 bool NativeWidgetPrivate::IsMouseButtonDown() { | 851 bool NativeWidgetPrivate::IsMouseButtonDown() { |
| 853 return aura::RootWindow::GetInstance()->IsMouseButtonDown(); | 852 return aura::RootWindow::GetInstance()->IsMouseButtonDown(); |
| 854 } | 853 } |
| 855 | 854 |
| 856 } // namespace internal | 855 } // namespace internal |
| 857 } // namespace views | 856 } // namespace views |
| OLD | NEW |