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

Side by Side Diff: chrome/browser/ui/views/location_bar/page_action_image_view.cc

Issue 10201016: Conflict detection for Extension Keybinding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Addressed comments Created 8 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 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" 5 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_browser_event_router.h" 8 #include "chrome/browser/extensions/extension_browser_event_router.h"
9 #include "chrome/browser/extensions/extension_command_service.h"
10 #include "chrome/browser/extensions/extension_command_service_factory.h"
9 #include "chrome/browser/extensions/extension_context_menu_model.h" 11 #include "chrome/browser/extensions/extension_context_menu_model.h"
10 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/extension_tab_util.h" 13 #include "chrome/browser/extensions/extension_tab_util.h"
12 #include "chrome/browser/platform_util.h" 14 #include "chrome/browser/platform_util.h"
13 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser_list.h" 16 #include "chrome/browser/ui/browser_list.h"
15 #include "chrome/browser/ui/views/frame/browser_view.h" 17 #include "chrome/browser/ui/views/frame/browser_view.h"
16 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 18 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
17 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
18 #include "chrome/common/extensions/extension.h" 20 #include "chrome/common/extensions/extension.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 Extension::kPageActionIconMaxSize), 57 Extension::kPageActionIconMaxSize),
56 ImageLoadingTracker::DONT_CACHE); 58 ImageLoadingTracker::DONT_CACHE);
57 } 59 }
58 60
59 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 61 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
60 content::Source<Profile>( 62 content::Source<Profile>(
61 owner_->profile()->GetOriginalProfile())); 63 owner_->profile()->GetOriginalProfile()));
62 64
63 set_accessibility_focusable(true); 65 set_accessibility_focusable(true);
64 66
67 ExtensionCommandService* command_service =
68 ExtensionCommandServiceFactory::GetForProfile(browser_->profile());
65 const Extension::ExtensionKeybinding* page_action_command = 69 const Extension::ExtensionKeybinding* page_action_command =
66 extension->page_action_command(); 70 command_service->GetActivePageActionCommand(extension->id());
67 if (page_action_command) { 71 if (page_action_command) {
68 keybinding_.reset(new ui::Accelerator(page_action_command->accelerator())); 72 keybinding_.reset(new ui::Accelerator(page_action_command->accelerator()));
69 owner_->GetFocusManager()->RegisterAccelerator( 73 owner_->GetFocusManager()->RegisterAccelerator(
70 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); 74 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this);
71 } 75 }
72 } 76 }
73 77
74 PageActionImageView::~PageActionImageView() { 78 PageActionImageView::~PageActionImageView() {
75 if (keybinding_.get() && owner_->GetFocusManager()) 79 if (keybinding_.get() && owner_->GetFocusManager())
76 owner_->GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); 80 owner_->GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 const Extension* unloaded_extension = 274 const Extension* unloaded_extension =
271 content::Details<UnloadedExtensionInfo>(details)->extension; 275 content::Details<UnloadedExtensionInfo>(details)->extension;
272 if (page_action_ == unloaded_extension ->page_action()) 276 if (page_action_ == unloaded_extension ->page_action())
273 owner_->UpdatePageActions(); 277 owner_->UpdatePageActions();
274 } 278 }
275 279
276 void PageActionImageView::HidePopup() { 280 void PageActionImageView::HidePopup() {
277 if (popup_) 281 if (popup_)
278 popup_->GetWidget()->Close(); 282 popup_->GetWidget()->Close();
279 } 283 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698