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

Side by Side Diff: ui/aura/desktop/desktop_activation_client.cc

Issue 10378002: Aura desktop: Really implement DesktopActivationClient::OnWillFocusWindow(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « no previous file | no next file » | 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 "ui/aura/desktop/desktop_activation_client.h" 5 #include "ui/aura/desktop/desktop_activation_client.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "ui/aura/client/activation_delegate.h" 8 #include "ui/aura/client/activation_delegate.h"
9 #include "ui/aura/focus_manager.h" 9 #include "ui/aura/focus_manager.h"
10 #include "ui/aura/root_window.h" 10 #include "ui/aura/root_window.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 if (window == current_active_) 59 if (window == current_active_)
60 current_active_ = NULL; 60 current_active_ = NULL;
61 } 61 }
62 62
63 aura::Window* DesktopActivationClient::GetActiveWindow() { 63 aura::Window* DesktopActivationClient::GetActiveWindow() {
64 return current_active_; 64 return current_active_;
65 } 65 }
66 66
67 bool DesktopActivationClient::OnWillFocusWindow(Window* window, 67 bool DesktopActivationClient::OnWillFocusWindow(Window* window,
68 const Event* event) { 68 const Event* event) {
69 // TODO(erg): Is this OK? Logic is much more nuanced in ash. 69 return CanActivateWindow(window);
70 return true;
71 } 70 }
72 71
73 void DesktopActivationClient::OnWindowFocused(aura::Window* window) { 72 void DesktopActivationClient::OnWindowFocused(aura::Window* window) {
74 ActivateWindow(GetActivatableWindow(window)); 73 ActivateWindow(GetActivatableWindow(window));
75 } 74 }
76 75
77 bool DesktopActivationClient::CanActivateWindow(aura::Window* window) const { 76 bool DesktopActivationClient::CanActivateWindow(aura::Window* window) const {
78 return window && 77 return window &&
79 window->IsVisible() && 78 window->IsVisible() &&
80 (!aura::client::GetActivationDelegate(window) || 79 (!aura::client::GetActivationDelegate(window) ||
(...skipping 11 matching lines...) Expand all
92 // that path instead. 91 // that path instead.
93 if (child->transient_parent()) 92 if (child->transient_parent())
94 return GetActivatableWindow(child->transient_parent()); 93 return GetActivatableWindow(child->transient_parent());
95 parent = parent->parent(); 94 parent = parent->parent();
96 child = child->parent(); 95 child = child->parent();
97 } 96 }
98 return NULL; 97 return NULL;
99 } 98 }
100 99
101 } // namespace aura 100 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698