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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_focus_rules.cc

Issue 193593002: Revert 256067 "Merge 255714 "Fixes bug that resulted in status b..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1847/src/
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 "ui/views/widget/desktop_aura/desktop_focus_rules.h" 5 #include "ui/views/widget/desktop_aura/desktop_focus_rules.h"
6 6
7 #include "ui/aura/root_window.h" 7 #include "ui/aura/root_window.h"
8 #include "ui/aura/window.h" 8 #include "ui/aura/window.h"
9 9
10 namespace views { 10 namespace views {
11 11
12 DesktopFocusRules::DesktopFocusRules(aura::Window* content_window) 12 DesktopFocusRules::DesktopFocusRules(aura::Window* content_window)
13 : content_window_(content_window) {} 13 : content_window_(content_window) {}
14 14
15 DesktopFocusRules::~DesktopFocusRules() {} 15 DesktopFocusRules::~DesktopFocusRules() {}
16 16
17 bool DesktopFocusRules::CanActivateWindow(aura::Window* window) const {
18 if (!BaseFocusRules::CanActivateWindow(window))
19 return false;
20 // Never activate a window that is not a child of the root window. Transients
21 // spanning different DesktopNativeWidgetAuras may trigger this.
22 return !window || content_window_->GetRootWindow()->Contains(window);
23 }
24
25 bool DesktopFocusRules::SupportsChildActivation(aura::Window* window) const { 17 bool DesktopFocusRules::SupportsChildActivation(aura::Window* window) const {
26 // In Desktop-Aura, only the content_window or children of the RootWindow are 18 // In Desktop-Aura, only the content_window or children of the RootWindow are
27 // activatable. 19 // activatable.
28 return window == content_window_->parent() || 20 return window == content_window_->parent() ||
29 window->GetRootWindow() == window; 21 window->GetRootWindow() == window;
30 } 22 }
31 23
32 bool DesktopFocusRules::IsWindowConsideredVisibleForActivation( 24 bool DesktopFocusRules::IsWindowConsideredVisibleForActivation(
33 aura::Window* window) const { 25 aura::Window* window) const {
34 // |content_window_| is initially hidden and made visible from Show(). Even in 26 // |content_window_| is initially hidden and made visible from Show(). Even in
(...skipping 20 matching lines...) Expand all
55 // In Desktop-Aura the content_window_'s parent is a dummy window and thus 47 // In Desktop-Aura the content_window_'s parent is a dummy window and thus
56 // should never be activated. We should return the content_window_ if it 48 // should never be activated. We should return the content_window_ if it
57 // can be activated in this case. 49 // can be activated in this case.
58 if (next_activatable_window == content_window_->parent() && 50 if (next_activatable_window == content_window_->parent() &&
59 CanActivateWindow(content_window_)) 51 CanActivateWindow(content_window_))
60 return content_window_; 52 return content_window_;
61 return next_activatable_window; 53 return next_activatable_window;
62 } 54 }
63 55
64 } // namespace views 56 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_focus_rules.h ('k') | ui/views/widget/desktop_aura/desktop_focus_rules_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698