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

Side by Side Diff: ash/common/focus_cycler.cc

Issue 2787363002: Moves couple of WmShell methods to standalone functions (Closed)
Patch Set: feedback and fix applist Created 3 years, 8 months 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
« no previous file with comments | « ash/common/accelerators/debug_commands.cc ('k') | ash/common/wm/fullscreen_window_finder.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/common/focus_cycler.h" 5 #include "ash/common/focus_cycler.h"
6 6
7 #include "ash/common/wm/mru_window_tracker.h" 7 #include "ash/common/wm/mru_window_tracker.h"
8 #include "ash/common/wm/window_state.h" 8 #include "ash/common/wm/window_state.h"
9 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
10 #include "ash/common/wm_window.h" 10 #include "ash/common/wm_window.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/wm/window_util.h"
12 #include "ui/views/accessible_pane_view.h" 13 #include "ui/views/accessible_pane_view.h"
13 #include "ui/views/focus/focus_search.h" 14 #include "ui/views/focus/focus_search.h"
14 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
15 #include "ui/wm/public/activation_client.h" 16 #include "ui/wm/public/activation_client.h"
16 17
17 namespace ash { 18 namespace ash {
18 19
19 namespace { 20 namespace {
20 21
21 bool HasFocusableWindow() { 22 bool HasFocusableWindow() {
(...skipping 10 matching lines...) Expand all
32 widgets_.push_back(widget); 33 widgets_.push_back(widget);
33 } 34 }
34 35
35 void FocusCycler::RemoveWidget(views::Widget* widget) { 36 void FocusCycler::RemoveWidget(views::Widget* widget) {
36 auto iter = std::find(widgets_.begin(), widgets_.end(), widget); 37 auto iter = std::find(widgets_.begin(), widgets_.end(), widget);
37 if (iter != widgets_.end()) 38 if (iter != widgets_.end())
38 widgets_.erase(iter); 39 widgets_.erase(iter);
39 } 40 }
40 41
41 void FocusCycler::RotateFocus(Direction direction) { 42 void FocusCycler::RotateFocus(Direction direction) {
42 WmWindow* window = WmShell::Get()->GetActiveWindow(); 43 WmWindow* window = WmWindow::Get(wm::GetActiveWindow());
43 if (window) { 44 if (window) {
44 views::Widget* widget = window->GetInternalWidget(); 45 views::Widget* widget = window->GetInternalWidget();
45 // First try to rotate focus within the active widget. If that succeeds, 46 // First try to rotate focus within the active widget. If that succeeds,
46 // we're done. 47 // we're done.
47 if (widget && 48 if (widget &&
48 widget->GetFocusManager()->RotatePaneFocus( 49 widget->GetFocusManager()->RotatePaneFocus(
49 direction == BACKWARD ? views::FocusManager::kBackward 50 direction == BACKWARD ? views::FocusManager::kBackward
50 : views::FocusManager::kForward, 51 : views::FocusManager::kForward,
51 views::FocusManager::kNoWrap)) { 52 views::FocusManager::kNoWrap)) {
52 return; 53 return;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 bool FocusCycler::FocusWidget(views::Widget* widget) { 107 bool FocusCycler::FocusWidget(views::Widget* widget) {
107 // Note: It is not necessary to set the focus directly to the pane since that 108 // Note: It is not necessary to set the focus directly to the pane since that
108 // will be taken care of by the widget activation. 109 // will be taken care of by the widget activation.
109 widget_activating_ = widget; 110 widget_activating_ = widget;
110 widget->Activate(); 111 widget->Activate();
111 widget_activating_ = NULL; 112 widget_activating_ = NULL;
112 return widget->IsActive(); 113 return widget->IsActive();
113 } 114 }
114 115
115 } // namespace ash 116 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/accelerators/debug_commands.cc ('k') | ash/common/wm/fullscreen_window_finder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698