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

Side by Side Diff: chrome/browser/ui/extensions/accelerator_priority.cc

Issue 360423002: Allow WebContents key handling to supplant extension overrides of the bookmark shortcut (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: address comments Created 6 years, 5 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
(Empty)
1 // Copyright 2014 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 "chrome/browser/ui/extensions/accelerator_priority.h"
6
7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/ui/accelerator_utils.h"
9 #include "chrome/common/extensions/manifest_handlers/ui_overrides_handler.h"
10 #include "extensions/browser/extension_registry.h"
11 #include "ui/base/accelerators/accelerator.h"
12
13 ui::AcceleratorManager::HandlerPriority GetAcceleratorPriority(
14 const ui::Accelerator& accelerator,
15 const extensions::Extension* extension) {
16 // Extensions overriding the bookmark shortcut need normal priority to
17 // preserve the built-in processing order of the key and not override
18 // WebContents key handling.
19 if (accelerator ==
20 chrome::GetPrimaryChromeAcceleratorForCommandId(IDC_BOOKMARK_PAGE) &&
21 extensions::UIOverrides::RemovesBookmarkShortcut(extension)) {
22 return ui::AcceleratorManager::kNormalPriority;
Finnur 2014/07/03 11:09:59 Nit: single line, no braces.
Mike Wittman 2014/07/07 18:43:58 Done.
23 }
Finnur 2014/07/03 11:09:59 Just to be sure this is working as I expect it: W
Mike Wittman 2014/07/07 18:43:58 Yes, that's correct.
24
25 return ui::AcceleratorManager::kHighPriority;
26 }
27
28 ui::AcceleratorManager::HandlerPriority GetAcceleratorPriority(
29 const ui::Accelerator& accelerator,
30 const std::string& extension_id,
31 content::BrowserContext* browser_context) {
32 return GetAcceleratorPriority(
33 accelerator,
34 extensions::ExtensionRegistry::Get(browser_context)->enabled_extensions().
35 GetByID(extension_id));
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698