| 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 "ash/wm/ash_focus_rules.h" | 5 #include "ash/wm/ash_focus_rules.h" |
| 6 | 6 |
| 7 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
| 8 | 8 |
| 9 namespace ash { | 9 namespace ash { |
| 10 namespace wm { | 10 namespace wm { |
| 11 | 11 |
| 12 //////////////////////////////////////////////////////////////////////////////// | 12 //////////////////////////////////////////////////////////////////////////////// |
| 13 // AshFocusRules, public: | 13 // AshFocusRules, public: |
| 14 | 14 |
| 15 AshFocusRules::AshFocusRules() { | 15 AshFocusRules::AshFocusRules() { |
| 16 } | 16 } |
| 17 | 17 |
| 18 AshFocusRules::~AshFocusRules() { | 18 AshFocusRules::~AshFocusRules() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 //////////////////////////////////////////////////////////////////////////////// | 21 //////////////////////////////////////////////////////////////////////////////// |
| 22 // AshFocusRules, views::corewm::FocusRules: | 22 // AshFocusRules, views::corewm::FocusRules: |
| 23 | 23 |
| 24 bool AshFocusRules::CanActivateWindow(aura::Window* window) { | 24 bool AshFocusRules::CanActivateWindow(aura::Window* window) { |
| 25 return !!window->parent(); | 25 return window && !!window->parent(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 bool AshFocusRules::CanFocusWindow(aura::Window* window) { | 28 bool AshFocusRules::CanFocusWindow(aura::Window* window) { |
| 29 aura::Window* activatable = GetActivatableWindow(window); | 29 aura::Window* activatable = GetActivatableWindow(window); |
| 30 return activatable->Contains(window) && window->CanFocus(); | 30 return activatable->Contains(window) && window->CanFocus(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 aura::Window* AshFocusRules::GetActivatableWindow(aura::Window* window) { | 33 aura::Window* AshFocusRules::GetActivatableWindow(aura::Window* window) { |
| 34 return window; | 34 return window; |
| 35 } | 35 } |
| 36 | 36 |
| 37 aura::Window* AshFocusRules::GetFocusableWindow(aura::Window* window) { | 37 aura::Window* AshFocusRules::GetFocusableWindow(aura::Window* window) { |
| 38 return window; | 38 return window; |
| 39 } | 39 } |
| 40 | 40 |
| 41 aura::Window* AshFocusRules::GetNextActivatableWindow(aura::Window* ignore) { | 41 aura::Window* AshFocusRules::GetNextActivatableWindow(aura::Window* ignore) { |
| 42 return NULL; | 42 return NULL; |
| 43 } | 43 } |
| 44 | 44 |
| 45 aura::Window* AshFocusRules::GetNextFocusableWindow(aura::Window* ignore) { | 45 aura::Window* AshFocusRules::GetNextFocusableWindow(aura::Window* ignore) { |
| 46 return GetFocusableWindow(ignore->parent()); | 46 return GetFocusableWindow(ignore->parent()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace wm | 49 } // namespace wm |
| 50 } // namespace ash | 50 } // namespace ash |
| OLD | NEW |