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

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

Issue 2033753002: Remove use of deprecated MessageLoop methods in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: manual change Created 4 years, 6 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
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/location.h"
9 #include "base/macros.h" 10 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/single_thread_task_runner.h"
12 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/threading/thread_task_runner_handle.h"
13 #include "base/time/time.h" 16 #include "base/time/time.h"
14 #include "build/build_config.h" 17 #include "build/build_config.h"
15 #include "chrome/browser/chrome_notification_types.h" 18 #include "chrome/browser/chrome_notification_types.h"
16 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
19 #include "chrome/browser/ui/views/frame/browser_view.h" 22 #include "chrome/browser/ui/views/frame/browser_view.h"
20 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" 23 #include "chrome/browser/ui/views/toolbar/app_menu_button.h"
21 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 24 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
22 #include "chrome/test/base/in_process_browser_test.h" 25 #include "chrome/test/base/in_process_browser_test.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 66 }
64 67
65 private: 68 private:
66 // Inherited from FocusChangeListener 69 // Inherited from FocusChangeListener
67 void OnWillChangeFocus(views::View* focused_before, 70 void OnWillChangeFocus(views::View* focused_before,
68 views::View* focused_now) override {} 71 views::View* focused_now) override {}
69 72
70 void OnDidChangeFocus(views::View* focused_before, 73 void OnDidChangeFocus(views::View* focused_before,
71 views::View* focused_now) override { 74 views::View* focused_now) override {
72 if (focused_now && focused_now->id() != previous_view_id_) { 75 if (focused_now && focused_now->id() != previous_view_id_) {
73 base::MessageLoop::current()->PostTask( 76 base::ThreadTaskRunnerHandle::Get()->PostTask(
74 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); 77 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
75 } 78 }
76 } 79 }
77 80
78 views::FocusManager* focus_manager_; 81 views::FocusManager* focus_manager_;
79 int previous_view_id_; 82 int previous_view_id_;
80 base::WeakPtrFactory<ViewFocusChangeWaiter> weak_factory_; 83 base::WeakPtrFactory<ViewFocusChangeWaiter> weak_factory_;
81 84
82 DISALLOW_COPY_AND_ASSIGN(ViewFocusChangeWaiter); 85 DISALLOW_COPY_AND_ASSIGN(ViewFocusChangeWaiter);
83 }; 86 };
(...skipping 23 matching lines...) Expand all
107 // Overridden from views::MenuListener: 110 // Overridden from views::MenuListener:
108 void OnMenuOpened() override { 111 void OnMenuOpened() override {
109 menu_open_count_++; 112 menu_open_count_++;
110 if (!test_dismiss_menu_) { 113 if (!test_dismiss_menu_) {
111 app_menu_button_->RemoveMenuListener(this); 114 app_menu_button_->RemoveMenuListener(this);
112 // Press DOWN to select the first item, then RETURN to select it. 115 // Press DOWN to select the first item, then RETURN to select it.
113 SendKeyPress(browser_, ui::VKEY_DOWN); 116 SendKeyPress(browser_, ui::VKEY_DOWN);
114 SendKeyPress(browser_, ui::VKEY_RETURN); 117 SendKeyPress(browser_, ui::VKEY_RETURN);
115 } else { 118 } else {
116 SendKeyPress(browser_, ui::VKEY_ESCAPE); 119 SendKeyPress(browser_, ui::VKEY_ESCAPE);
117 base::MessageLoop::current()->PostDelayedTask( 120 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
118 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), 121 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
119 base::TimeDelta::FromMilliseconds(200)); 122 base::TimeDelta::FromMilliseconds(200));
120 } 123 }
121 } 124 }
122 125
123 AppMenuButton* app_menu_button_; 126 AppMenuButton* app_menu_button_;
124 Browser* browser_; 127 Browser* browser_;
125 // Keeps track of the number of times the menu was opened. 128 // Keeps track of the number of times the menu was opened.
126 int menu_open_count_; 129 int menu_open_count_;
127 // If this is set then on receiving a notification that the menu was opened 130 // If this is set then on receiving a notification that the menu was opened
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 browser(), ui::VKEY_BROWSER_FORWARD, false, false, false, false)); 439 browser(), ui::VKEY_BROWSER_FORWARD, false, false, false, false));
437 440
438 base::string16 after_forward; 441 base::string16 after_forward;
439 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &after_forward)); 442 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &after_forward));
440 443
441 EXPECT_EQ(before_back, after_forward); 444 EXPECT_EQ(before_back, after_forward);
442 } 445 }
443 #endif 446 #endif
444 447
445 } // namespace 448 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/exclusive_access_bubble_views.cc ('k') | chrome/browser/ui/views/new_back_shortcut_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698