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

Side by Side Diff: chrome/browser/ui/views/keyboard_access_browsertest.cc

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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
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 // This functionality currently works on Windows and on Linux when 5 // This functionality currently works on Windows and on Linux when
6 // toolkit_views is defined (i.e. for Chrome OS). It's not needed 6 // toolkit_views is defined (i.e. for Chrome OS). It's not needed
7 // on the Mac, and it's not yet implemented on Linux. 7 // on the Mac, and it's not yet implemented on Linux.
8 8
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 private: 62 private:
63 // Inherited from FocusChangeListener 63 // Inherited from FocusChangeListener
64 virtual void OnWillChangeFocus(views::View* focused_before, 64 virtual void OnWillChangeFocus(views::View* focused_before,
65 views::View* focused_now) OVERRIDE { 65 views::View* focused_now) OVERRIDE {
66 } 66 }
67 67
68 virtual void OnDidChangeFocus(views::View* focused_before, 68 virtual void OnDidChangeFocus(views::View* focused_before,
69 views::View* focused_now) OVERRIDE { 69 views::View* focused_now) OVERRIDE {
70 if (focused_now && focused_now->id() != previous_view_id_) { 70 if (focused_now && focused_now->id() != previous_view_id_) {
71 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 71 base::MessageLoop::current()->PostTask(FROM_HERE,
72 base::MessageLoop::QuitClosure());
72 } 73 }
73 } 74 }
74 75
75 views::FocusManager* focus_manager_; 76 views::FocusManager* focus_manager_;
76 int previous_view_id_; 77 int previous_view_id_;
77 base::WeakPtrFactory<ViewFocusChangeWaiter> weak_factory_; 78 base::WeakPtrFactory<ViewFocusChangeWaiter> weak_factory_;
78 79
79 DISALLOW_COPY_AND_ASSIGN(ViewFocusChangeWaiter); 80 DISALLOW_COPY_AND_ASSIGN(ViewFocusChangeWaiter);
80 }; 81 };
81 82
(...skipping 20 matching lines...) Expand all
102 // Overridden from views::MenuListener: 103 // Overridden from views::MenuListener:
103 virtual void OnMenuOpened() OVERRIDE { 104 virtual void OnMenuOpened() OVERRIDE {
104 menu_open_count_++; 105 menu_open_count_++;
105 if (!test_dismiss_menu_) { 106 if (!test_dismiss_menu_) {
106 toolbar_view_->RemoveMenuListener(this); 107 toolbar_view_->RemoveMenuListener(this);
107 // Press DOWN to select the first item, then RETURN to select it. 108 // Press DOWN to select the first item, then RETURN to select it.
108 SendKeyPress(browser_, ui::VKEY_DOWN); 109 SendKeyPress(browser_, ui::VKEY_DOWN);
109 SendKeyPress(browser_, ui::VKEY_RETURN); 110 SendKeyPress(browser_, ui::VKEY_RETURN);
110 } else { 111 } else {
111 SendKeyPress(browser_, ui::VKEY_ESCAPE); 112 SendKeyPress(browser_, ui::VKEY_ESCAPE);
112 MessageLoop::current()->PostDelayedTask( 113 base::MessageLoop::current()->PostDelayedTask(
113 FROM_HERE, MessageLoop::QuitClosure(), 114 FROM_HERE,
115 base::MessageLoop::QuitClosure(),
114 base::TimeDelta::FromMilliseconds(200)); 116 base::TimeDelta::FromMilliseconds(200));
115 } 117 }
116 } 118 }
117 119
118 ToolbarView* toolbar_view_; 120 ToolbarView* toolbar_view_;
119 Browser* browser_; 121 Browser* browser_;
120 // Keeps track of the number of times the menu was opened. 122 // Keeps track of the number of times the menu was opened.
121 int menu_open_count_; 123 int menu_open_count_;
122 // If this is set then on receiving a notification that the menu was opened 124 // If this is set then on receiving a notification that the menu was opened
123 // we dismiss it by sending the ESC key. 125 // we dismiss it by sending the ESC key.
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 browser(), ui::VKEY_BROWSER_FORWARD, false, false, false, false)); 435 browser(), ui::VKEY_BROWSER_FORWARD, false, false, false, false));
434 436
435 string16 after_forward; 437 string16 after_forward;
436 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &after_forward)); 438 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &after_forward));
437 439
438 EXPECT_EQ(before_back, after_forward); 440 EXPECT_EQ(before_back, after_forward);
439 } 441 }
440 #endif 442 #endif
441 443
442 } // namespace 444 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698