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/desktop_aura/desktop_activation_client.h" | 5 #include "ui/views/widget/desktop_aura/desktop_activation_client.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "ui/aura/client/activation_delegate.h" | 9 #include "ui/aura/client/activation_delegate.h" |
10 #include "ui/aura/client/activation_change_observer.h" | 10 #include "ui/aura/client/activation_change_observer.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 | 137 |
138 void DesktopActivationClient::OnWindowFocused(aura::Window* window) { | 138 void DesktopActivationClient::OnWindowFocused(aura::Window* window) { |
139 ActivateWindow(GetActivatableWindow(window)); | 139 ActivateWindow(GetActivatableWindow(window)); |
140 } | 140 } |
141 | 141 |
142 bool DesktopActivationClient::CanActivateWindow(aura::Window* window) const { | 142 bool DesktopActivationClient::CanActivateWindow(aura::Window* window) const { |
143 return window && | 143 return window && |
144 window->IsVisible() && | 144 window->IsVisible() && |
145 (!aura::client::GetActivationDelegate(window) || | 145 (!aura::client::GetActivationDelegate(window) || |
146 aura::client::GetActivationDelegate(window)->ShouldActivate()); | 146 aura::client::GetActivationDelegate(window)->ShouldActivate(NULL)); |
147 } | 147 } |
148 | 148 |
149 ui::EventResult DesktopActivationClient::OnKeyEvent(ui::KeyEvent* event) { | 149 ui::EventResult DesktopActivationClient::OnKeyEvent(ui::KeyEvent* event) { |
150 return ui::ER_UNHANDLED; | 150 return ui::ER_UNHANDLED; |
151 } | 151 } |
152 | 152 |
153 ui::EventResult DesktopActivationClient::OnMouseEvent(ui::MouseEvent* event) { | 153 ui::EventResult DesktopActivationClient::OnMouseEvent(ui::MouseEvent* event) { |
154 if (event->type() == ui::ET_MOUSE_PRESSED) | 154 if (event->type() == ui::ET_MOUSE_PRESSED) |
155 FocusWindowWithEvent(event); | 155 FocusWindowWithEvent(event); |
156 return ui::ER_UNHANDLED; | 156 return ui::ER_UNHANDLED; |
(...skipping 18 matching lines...) Expand all Loading... |
175 | 175 |
176 void DesktopActivationClient::FocusWindowWithEvent(const ui::Event* event) { | 176 void DesktopActivationClient::FocusWindowWithEvent(const ui::Event* event) { |
177 aura::Window* window = static_cast<aura::Window*>(event->target()); | 177 aura::Window* window = static_cast<aura::Window*>(event->target()); |
178 if (GetActiveWindow() != window) { | 178 if (GetActiveWindow() != window) { |
179 aura::client::GetFocusClient(window)->FocusWindow( | 179 aura::client::GetFocusClient(window)->FocusWindow( |
180 FindFocusableWindowFor(window), event); | 180 FindFocusableWindowFor(window), event); |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 } // namespace views | 184 } // namespace views |
OLD | NEW |