Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: ash/wm/ash_focus_rules.cc

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/app_list_controller.cc ('k') | ash/wm/ash_native_cursor_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/wm/window_state.h" 9 #include "ash/wm/window_state.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return true; 98 return true;
99 } 99 }
100 100
101 aura::Window* AshFocusRules::GetNextActivatableWindow( 101 aura::Window* AshFocusRules::GetNextActivatableWindow(
102 aura::Window* ignore) const { 102 aura::Window* ignore) const {
103 DCHECK(ignore); 103 DCHECK(ignore);
104 104
105 int starting_container_index = 0; 105 int starting_container_index = 0;
106 // If the container of the window losing focus is in the list, start from that 106 // If the container of the window losing focus is in the list, start from that
107 // container. 107 // container.
108 aura::RootWindow* root = ignore->GetRootWindow(); 108 aura::Window* root = ignore->GetRootWindow();
109 if (!root) 109 if (!root)
110 root = Shell::GetTargetRootWindow(); 110 root = Shell::GetTargetRootWindow();
111 int container_count = static_cast<int>(arraysize(kWindowContainerIds)); 111 int container_count = static_cast<int>(arraysize(kWindowContainerIds));
112 for (int i = 0; ignore && i < container_count; i++) { 112 for (int i = 0; ignore && i < container_count; i++) {
113 aura::Window* container = Shell::GetContainer(root, kWindowContainerIds[i]); 113 aura::Window* container = Shell::GetContainer(root, kWindowContainerIds[i]);
114 if (container && container->Contains(ignore)) { 114 if (container && container->Contains(ignore)) {
115 starting_container_index = i; 115 starting_container_index = i;
116 break; 116 break;
117 } 117 }
118 } 118 }
(...skipping 11 matching lines...) Expand all
130 return window; 130 return window;
131 } 131 }
132 132
133 //////////////////////////////////////////////////////////////////////////////// 133 ////////////////////////////////////////////////////////////////////////////////
134 // AshFocusRules, private: 134 // AshFocusRules, private:
135 135
136 aura::Window* AshFocusRules::GetTopmostWindowToActivateForContainerIndex( 136 aura::Window* AshFocusRules::GetTopmostWindowToActivateForContainerIndex(
137 int index, 137 int index,
138 aura::Window* ignore) const { 138 aura::Window* ignore) const {
139 aura::Window* window = NULL; 139 aura::Window* window = NULL;
140 aura::RootWindow* root = ignore ? ignore->GetRootWindow() : NULL; 140 aura::Window* root = ignore ? ignore->GetRootWindow() : NULL;
141 aura::Window::Windows containers = Shell::GetContainersFromAllRootWindows( 141 aura::Window::Windows containers = Shell::GetContainersFromAllRootWindows(
142 kWindowContainerIds[index], root); 142 kWindowContainerIds[index], root);
143 for (aura::Window::Windows::const_iterator iter = containers.begin(); 143 for (aura::Window::Windows::const_iterator iter = containers.begin();
144 iter != containers.end() && !window; ++iter) { 144 iter != containers.end() && !window; ++iter) {
145 window = GetTopmostWindowToActivateInContainer((*iter), ignore); 145 window = GetTopmostWindowToActivateInContainer((*iter), ignore);
146 } 146 }
147 return window; 147 return window;
148 } 148 }
149 149
150 aura::Window* AshFocusRules::GetTopmostWindowToActivateInContainer( 150 aura::Window* AshFocusRules::GetTopmostWindowToActivateInContainer(
151 aura::Window* container, 151 aura::Window* container,
152 aura::Window* ignore) const { 152 aura::Window* ignore) const {
153 for (aura::Window::Windows::const_reverse_iterator i = 153 for (aura::Window::Windows::const_reverse_iterator i =
154 container->children().rbegin(); 154 container->children().rbegin();
155 i != container->children().rend(); 155 i != container->children().rend();
156 ++i) { 156 ++i) {
157 WindowState* window_state = GetWindowState(*i); 157 WindowState* window_state = GetWindowState(*i);
158 if (*i != ignore && 158 if (*i != ignore &&
159 window_state->CanActivate() && 159 window_state->CanActivate() &&
160 !window_state->IsMinimized()) 160 !window_state->IsMinimized())
161 return *i; 161 return *i;
162 } 162 }
163 return NULL; 163 return NULL;
164 } 164 }
165 165
166 } // namespace wm 166 } // namespace wm
167 } // namespace ash 167 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/app_list_controller.cc ('k') | ash/wm/ash_native_cursor_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698