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

Side by Side Diff: ui/aura/test/test_focus_client.cc

Issue 29883002: Attempt to re-land FocusManager removal from Aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable test with note. Created 7 years, 2 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 | « ui/aura/test/test_focus_client.h ('k') | ui/aura/window.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/aura/test/test_focus_client.h"
6
7 #include "ui/aura/client/focus_change_observer.h"
8 #include "ui/aura/window.h"
9
10 namespace aura {
11 namespace test {
12
13 ////////////////////////////////////////////////////////////////////////////////
14 // TestFocusClient, public:
15
16 TestFocusClient::TestFocusClient()
17 : focused_window_(NULL),
18 observer_manager_(this) {
19 }
20
21 TestFocusClient::~TestFocusClient() {
22 }
23
24 ////////////////////////////////////////////////////////////////////////////////
25 // TestFocusClient, client::FocusClient implementation:
26
27 void TestFocusClient::AddObserver(client::FocusChangeObserver* observer) {
28 }
29
30 void TestFocusClient::RemoveObserver(client::FocusChangeObserver* observer) {
31 }
32
33 void TestFocusClient::FocusWindow(Window* window) {
34 if (window && !window->CanFocus())
35 return;
36 if (focused_window_)
37 observer_manager_.Remove(focused_window_);
38 aura::Window* old_focused_window = focused_window_;
39 focused_window_ = window;
40 if (focused_window_)
41 observer_manager_.Add(focused_window_);
42
43 client::FocusChangeObserver* observer =
44 client::GetFocusChangeObserver(old_focused_window);
45 if (observer)
46 observer->OnWindowFocused(focused_window_, old_focused_window);
47 observer = client::GetFocusChangeObserver(focused_window_);
48 if (observer)
49 observer->OnWindowFocused(focused_window_, old_focused_window);
50 }
51
52 void TestFocusClient::ResetFocusWithinActiveWindow(Window* window) {
53 if (!window->Contains(focused_window_))
54 FocusWindow(window);
55 }
56
57 Window* TestFocusClient::GetFocusedWindow() {
58 return focused_window_;
59 }
60
61 ////////////////////////////////////////////////////////////////////////////////
62 // TestFocusClient, WindowObserver implementation:
63
64 void TestFocusClient::OnWindowDestroying(Window* window) {
65 DCHECK_EQ(window, focused_window_);
66 FocusWindow(NULL);
67 }
68
69 } // namespace test
70 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/test_focus_client.h ('k') | ui/aura/window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698