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

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

Issue 2375663002: Replace MessageLoop::current()->task_runner() with ThreadTaskRunnerHandle::Get(). (Closed)
Patch Set: rebase Created 4 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
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 "chrome/browser/ui/views/chrome_views_delegate.h" 5 #include "chrome/browser/ui/views/chrome_views_delegate.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
11 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
12 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/threading/thread_task_runner_handle.h"
14 #include "base/time/time.h" 16 #include "base/time/time.h"
15 #include "build/build_config.h" 17 #include "build/build_config.h"
16 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/lifetime/keep_alive_types.h" 19 #include "chrome/browser/lifetime/keep_alive_types.h"
18 #include "chrome/browser/lifetime/scoped_keep_alive.h" 20 #include "chrome/browser/lifetime/scoped_keep_alive.h"
19 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/ui/ash/ash_util.h" 22 #include "chrome/browser/ui/ash/ash_util.h"
21 #include "chrome/browser/ui/browser_window_state.h" 23 #include "chrome/browser/ui/browser_window_state.h"
22 #include "chrome/grit/chrome_unscaled_resources.h" 24 #include "chrome/grit/chrome_unscaled_resources.h"
23 #include "components/prefs/pref_service.h" 25 #include "components/prefs/pref_service.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 #if defined(USE_AURA) 267 #if defined(USE_AURA)
266 AutomationManagerAura::GetInstance()->HandleEvent( 268 AutomationManagerAura::GetInstance()->HandleEvent(
267 GetProfileForWindow(view->GetWidget()), view, event_type); 269 GetProfileForWindow(view->GetWidget()), view, event_type);
268 #endif 270 #endif
269 } 271 }
270 272
271 views::ViewsDelegate::ProcessMenuAcceleratorResult 273 views::ViewsDelegate::ProcessMenuAcceleratorResult
272 ChromeViewsDelegate::ProcessAcceleratorWhileMenuShowing( 274 ChromeViewsDelegate::ProcessAcceleratorWhileMenuShowing(
273 const ui::Accelerator& accelerator) { 275 const ui::Accelerator& accelerator) {
274 #if defined(USE_ASH) 276 #if defined(USE_ASH)
277 DCHECK(base::MessageLoopForUI::IsCurrent());
278
275 // Early return because mash chrome does not have access to ash::Shell 279 // Early return because mash chrome does not have access to ash::Shell
276 if (chrome::IsRunningInMash()) 280 if (chrome::IsRunningInMash())
277 return views::ViewsDelegate::ProcessMenuAcceleratorResult::LEAVE_MENU_OPEN; 281 return views::ViewsDelegate::ProcessMenuAcceleratorResult::LEAVE_MENU_OPEN;
278 282
279 ash::AcceleratorController* accelerator_controller = 283 ash::AcceleratorController* accelerator_controller =
280 ash::WmShell::Get()->accelerator_controller(); 284 ash::WmShell::Get()->accelerator_controller();
281 285
282 accelerator_controller->accelerator_history()->StoreCurrentAccelerator( 286 accelerator_controller->accelerator_history()->StoreCurrentAccelerator(
283 accelerator); 287 accelerator);
284 if (accelerator_controller->ShouldCloseMenuAndRepostAccelerator( 288 if (accelerator_controller->ShouldCloseMenuAndRepostAccelerator(
285 accelerator)) { 289 accelerator)) {
286 base::MessageLoopForUI::current()->task_runner()->PostTask( 290 base::ThreadTaskRunnerHandle::Get()->PostTask(
287 FROM_HERE, base::Bind(ProcessAcceleratorNow, accelerator)); 291 FROM_HERE, base::Bind(ProcessAcceleratorNow, accelerator));
288 return views::ViewsDelegate::ProcessMenuAcceleratorResult::CLOSE_MENU; 292 return views::ViewsDelegate::ProcessMenuAcceleratorResult::CLOSE_MENU;
289 } 293 }
290 294
291 ProcessAcceleratorNow(accelerator); 295 ProcessAcceleratorNow(accelerator);
292 return views::ViewsDelegate::ProcessMenuAcceleratorResult::LEAVE_MENU_OPEN; 296 return views::ViewsDelegate::ProcessMenuAcceleratorResult::LEAVE_MENU_OPEN;
293 #else 297 #else
294 return views::ViewsDelegate::ProcessMenuAcceleratorResult::LEAVE_MENU_OPEN; 298 return views::ViewsDelegate::ProcessMenuAcceleratorResult::LEAVE_MENU_OPEN;
295 #endif // defined(USE_ASH) 299 #endif // defined(USE_ASH)
296 } 300 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 return content::BrowserThread::GetBlockingPool(); 509 return content::BrowserThread::GetBlockingPool();
506 } 510 }
507 511
508 #if !defined(USE_ASH) 512 #if !defined(USE_ASH)
509 views::Widget::InitParams::WindowOpacity 513 views::Widget::InitParams::WindowOpacity
510 ChromeViewsDelegate::GetOpacityForInitParams( 514 ChromeViewsDelegate::GetOpacityForInitParams(
511 const views::Widget::InitParams& params) { 515 const views::Widget::InitParams& params) {
512 return views::Widget::InitParams::OPAQUE_WINDOW; 516 return views::Widget::InitParams::OPAQUE_WINDOW;
513 } 517 }
514 #endif 518 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/media_delegate_chromeos.cc ('k') | chrome/browser/ui/views/menu_model_adapter_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698