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

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

Issue 2073783003: Fixed bug where mash chrome crashes accessing ash::Shell with context menus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Early return LEAVE_MENU_OPEN instead of CLOSE_MENU 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
« 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 "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/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/lifetime/keep_alive_types.h" 16 #include "chrome/browser/lifetime/keep_alive_types.h"
17 #include "chrome/browser/lifetime/scoped_keep_alive.h" 17 #include "chrome/browser/lifetime/scoped_keep_alive.h"
18 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/browser/ui/ash/ash_util.h"
19 #include "chrome/browser/ui/browser_window_state.h" 20 #include "chrome/browser/ui/browser_window_state.h"
20 #include "components/prefs/pref_service.h" 21 #include "components/prefs/pref_service.h"
21 #include "components/prefs/scoped_user_pref_update.h" 22 #include "components/prefs/scoped_user_pref_update.h"
22 #include "components/version_info/version_info.h" 23 #include "components/version_info/version_info.h"
23 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/context_factory.h" 25 #include "content/public/browser/context_factory.h"
25 #include "grit/chrome_unscaled_resources.h" 26 #include "grit/chrome_unscaled_resources.h"
26 #include "ui/base/resource/resource_bundle.h" 27 #include "ui/base/resource/resource_bundle.h"
27 #include "ui/base/ui_base_switches.h" 28 #include "ui/base/ui_base_switches.h"
28 #include "ui/display/display.h" 29 #include "ui/display/display.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 #if defined(USE_AURA) 264 #if defined(USE_AURA)
264 AutomationManagerAura::GetInstance()->HandleEvent( 265 AutomationManagerAura::GetInstance()->HandleEvent(
265 GetProfileForWindow(view->GetWidget()), view, event_type); 266 GetProfileForWindow(view->GetWidget()), view, event_type);
266 #endif 267 #endif
267 } 268 }
268 269
269 views::ViewsDelegate::ProcessMenuAcceleratorResult 270 views::ViewsDelegate::ProcessMenuAcceleratorResult
270 ChromeViewsDelegate::ProcessAcceleratorWhileMenuShowing( 271 ChromeViewsDelegate::ProcessAcceleratorWhileMenuShowing(
271 const ui::Accelerator& accelerator) { 272 const ui::Accelerator& accelerator) {
272 #if defined(USE_ASH) 273 #if defined(USE_ASH)
274 // Early return because mash chrome does not have access to ash::Shell
275 if (chrome::IsRunningInMash())
276 return views::ViewsDelegate::ProcessMenuAcceleratorResult::LEAVE_MENU_OPEN;
277
273 ash::AcceleratorController* accelerator_controller = 278 ash::AcceleratorController* accelerator_controller =
274 ash::Shell::GetInstance()->accelerator_controller(); 279 ash::Shell::GetInstance()->accelerator_controller();
275 280
276 accelerator_controller->accelerator_history()->StoreCurrentAccelerator( 281 accelerator_controller->accelerator_history()->StoreCurrentAccelerator(
277 accelerator); 282 accelerator);
278 if (accelerator_controller->ShouldCloseMenuAndRepostAccelerator( 283 if (accelerator_controller->ShouldCloseMenuAndRepostAccelerator(
279 accelerator)) { 284 accelerator)) {
280 base::ThreadTaskRunnerHandle::Get()->PostTask( 285 base::ThreadTaskRunnerHandle::Get()->PostTask(
281 FROM_HERE, base::Bind(ProcessAcceleratorNow, accelerator)); 286 FROM_HERE, base::Bind(ProcessAcceleratorNow, accelerator));
282 return views::ViewsDelegate::ProcessMenuAcceleratorResult::CLOSE_MENU; 287 return views::ViewsDelegate::ProcessMenuAcceleratorResult::CLOSE_MENU;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 return content::BrowserThread::GetBlockingPool(); 504 return content::BrowserThread::GetBlockingPool();
500 } 505 }
501 506
502 #if !defined(USE_ASH) 507 #if !defined(USE_ASH)
503 views::Widget::InitParams::WindowOpacity 508 views::Widget::InitParams::WindowOpacity
504 ChromeViewsDelegate::GetOpacityForInitParams( 509 ChromeViewsDelegate::GetOpacityForInitParams(
505 const views::Widget::InitParams& params) { 510 const views::Widget::InitParams& params) {
506 return views::Widget::InitParams::OPAQUE_WINDOW; 511 return views::Widget::InitParams::OPAQUE_WINDOW;
507 } 512 }
508 #endif 513 #endif
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