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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 ActivateWindow(GetActivatableWindow(gained_focus)); | 151 ActivateWindow(GetActivatableWindow(gained_focus)); |
152 } | 152 } |
153 | 153 |
154 bool DesktopActivationClient::CanActivateWindow(aura::Window* window) const { | 154 bool DesktopActivationClient::CanActivateWindow(aura::Window* window) const { |
155 return window && | 155 return window && |
156 window->IsVisible() && | 156 window->IsVisible() && |
157 (!aura::client::GetActivationDelegate(window) || | 157 (!aura::client::GetActivationDelegate(window) || |
158 aura::client::GetActivationDelegate(window)->ShouldActivate()); | 158 aura::client::GetActivationDelegate(window)->ShouldActivate()); |
159 } | 159 } |
160 | 160 |
161 ui::EventResult DesktopActivationClient::OnKeyEvent(ui::KeyEvent* event) { | 161 void DesktopActivationClient::OnKeyEvent(ui::KeyEvent* event) { |
162 return ui::ER_UNHANDLED; | |
163 } | 162 } |
164 | 163 |
165 ui::EventResult DesktopActivationClient::OnMouseEvent(ui::MouseEvent* event) { | 164 ui::EventResult DesktopActivationClient::OnMouseEvent(ui::MouseEvent* event) { |
166 if (event->type() == ui::ET_MOUSE_PRESSED) | 165 if (event->type() == ui::ET_MOUSE_PRESSED) |
167 FocusWindowWithEvent(event); | 166 FocusWindowWithEvent(event); |
168 return ui::ER_UNHANDLED; | 167 return ui::ER_UNHANDLED; |
169 } | 168 } |
170 | 169 |
171 void DesktopActivationClient::OnScrollEvent(ui::ScrollEvent* event) { | 170 void DesktopActivationClient::OnScrollEvent(ui::ScrollEvent* event) { |
172 } | 171 } |
(...skipping 10 matching lines...) Expand all Loading... |
183 | 182 |
184 void DesktopActivationClient::FocusWindowWithEvent(const ui::Event* event) { | 183 void DesktopActivationClient::FocusWindowWithEvent(const ui::Event* event) { |
185 aura::Window* window = static_cast<aura::Window*>(event->target()); | 184 aura::Window* window = static_cast<aura::Window*>(event->target()); |
186 if (GetActiveWindow() != window) { | 185 if (GetActiveWindow() != window) { |
187 aura::client::GetFocusClient(window)->FocusWindow( | 186 aura::client::GetFocusClient(window)->FocusWindow( |
188 FindFocusableWindowFor(window), event); | 187 FindFocusableWindowFor(window), event); |
189 } | 188 } |
190 } | 189 } |
191 | 190 |
192 } // namespace views | 191 } // namespace views |
OLD | NEW |