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

Side by Side Diff: chrome/browser/ui/gtk/browser_actions_toolbar_gtk.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/gtk/browser_actions_toolbar_gtk.h" 5 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/i18n/rtl.h" 13 #include "base/i18n/rtl.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/extensions/extension_browser_event_router.h" 16 #include "chrome/browser/extensions/extension_browser_event_router.h"
17 #include "chrome/browser/extensions/extension_command_service.h"
18 #include "chrome/browser/extensions/extension_command_service_factory.h"
17 #include "chrome/browser/extensions/extension_context_menu_model.h" 19 #include "chrome/browser/extensions/extension_context_menu_model.h"
18 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/extensions/image_loading_tracker.h" 21 #include "chrome/browser/extensions/image_loading_tracker.h"
20 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/sessions/restore_tab_helper.h" 23 #include "chrome/browser/sessions/restore_tab_helper.h"
22 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 25 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
24 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" 26 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h"
25 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" 27 #include "chrome/browser/ui/gtk/gtk_chrome_button.h"
26 #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h" 28 #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 360
359 // The handler for when the browser action is realized. |user_data| contains a 361 // The handler for when the browser action is realized. |user_data| contains a
360 // pointer to the BrowserAction shown. 362 // pointer to the BrowserAction shown.
361 static void OnRealize(GtkWidget* widget, void* user_data) { 363 static void OnRealize(GtkWidget* widget, void* user_data) {
362 BrowserActionButton* button = static_cast<BrowserActionButton*>(user_data); 364 BrowserActionButton* button = static_cast<BrowserActionButton*>(user_data);
363 button->ConnectBrowserActionPopupAccelerator(); 365 button->ConnectBrowserActionPopupAccelerator();
364 } 366 }
365 367
366 // Connect the accelerator for the browser action popup. 368 // Connect the accelerator for the browser action popup.
367 void ConnectBrowserActionPopupAccelerator() { 369 void ConnectBrowserActionPopupAccelerator() {
370 ExtensionCommandService* command_service =
371 ExtensionCommandServiceFactory::GetForProfile(
372 toolbar_->browser()->profile());
368 const Extension::ExtensionKeybinding* command = 373 const Extension::ExtensionKeybinding* command =
369 extension_->browser_action_command(); 374 command_service->GetActiveBrowserActionCommand(extension_->id());
370 if (command) { 375 if (command) {
371 // Found the browser action shortcut command, register it. 376 // Found the browser action shortcut command, register it.
372 keybinding_.reset(new ui::AcceleratorGtk( 377 keybinding_.reset(new ui::AcceleratorGtk(
373 command->accelerator().key_code(), 378 command->accelerator().key_code(),
374 command->accelerator().IsShiftDown(), 379 command->accelerator().IsShiftDown(),
375 command->accelerator().IsCtrlDown(), 380 command->accelerator().IsCtrlDown(),
376 command->accelerator().IsAltDown())); 381 command->accelerator().IsAltDown()));
377 382
378 gfx::NativeWindow window = 383 gfx::NativeWindow window =
379 toolbar_->browser()->window()->GetNativeHandle(); 384 toolbar_->browser()->window()->GetNativeHandle();
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 1069
1065 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), 1070 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root),
1066 event->time); 1071 event->time);
1067 return TRUE; 1072 return TRUE;
1068 } 1073 }
1069 1074
1070 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { 1075 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) {
1071 if (!resize_animation_.is_animating()) 1076 if (!resize_animation_.is_animating())
1072 UpdateChevronVisibility(); 1077 UpdateChevronVisibility();
1073 } 1078 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698