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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 void DesktopActivationClient::OnKeyEvent(ui::KeyEvent* event) { | 161 void DesktopActivationClient::OnKeyEvent(ui::KeyEvent* event) { |
162 } | 162 } |
163 | 163 |
164 ui::EventResult DesktopActivationClient::OnMouseEvent(ui::MouseEvent* event) { | 164 void DesktopActivationClient::OnMouseEvent(ui::MouseEvent* event) { |
165 if (event->type() == ui::ET_MOUSE_PRESSED) | 165 if (event->type() == ui::ET_MOUSE_PRESSED) |
166 FocusWindowWithEvent(event); | 166 FocusWindowWithEvent(event); |
167 return ui::ER_UNHANDLED; | |
168 } | 167 } |
169 | 168 |
170 void DesktopActivationClient::OnScrollEvent(ui::ScrollEvent* event) { | 169 void DesktopActivationClient::OnScrollEvent(ui::ScrollEvent* event) { |
171 } | 170 } |
172 | 171 |
173 void DesktopActivationClient::OnTouchEvent(ui::TouchEvent* event) { | 172 void DesktopActivationClient::OnTouchEvent(ui::TouchEvent* event) { |
174 } | 173 } |
175 | 174 |
176 void DesktopActivationClient::OnGestureEvent(ui::GestureEvent* event) { | 175 void DesktopActivationClient::OnGestureEvent(ui::GestureEvent* event) { |
177 if (event->type() == ui::ET_GESTURE_BEGIN && | 176 if (event->type() == ui::ET_GESTURE_BEGIN && |
178 event->details().touch_points() == 1) { | 177 event->details().touch_points() == 1) { |
179 FocusWindowWithEvent(event); | 178 FocusWindowWithEvent(event); |
180 } | 179 } |
181 } | 180 } |
182 | 181 |
183 void DesktopActivationClient::FocusWindowWithEvent(const ui::Event* event) { | 182 void DesktopActivationClient::FocusWindowWithEvent(const ui::Event* event) { |
184 aura::Window* window = static_cast<aura::Window*>(event->target()); | 183 aura::Window* window = static_cast<aura::Window*>(event->target()); |
185 if (GetActiveWindow() != window) { | 184 if (GetActiveWindow() != window) { |
186 aura::client::GetFocusClient(window)->FocusWindow( | 185 aura::client::GetFocusClient(window)->FocusWindow( |
187 FindFocusableWindowFor(window), event); | 186 FindFocusableWindowFor(window), event); |
188 } | 187 } |
189 } | 188 } |
190 | 189 |
191 } // namespace views | 190 } // namespace views |
OLD | NEW |