OLD | NEW |
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> |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 372 |
373 // The handler for when the browser action is realized. |user_data| contains a | 373 // The handler for when the browser action is realized. |user_data| contains a |
374 // pointer to the BrowserAction shown. | 374 // pointer to the BrowserAction shown. |
375 static void OnRealize(GtkWidget* widget, void* user_data) { | 375 static void OnRealize(GtkWidget* widget, void* user_data) { |
376 BrowserActionButton* button = static_cast<BrowserActionButton*>(user_data); | 376 BrowserActionButton* button = static_cast<BrowserActionButton*>(user_data); |
377 button->ConnectBrowserActionPopupAccelerator(); | 377 button->ConnectBrowserActionPopupAccelerator(); |
378 } | 378 } |
379 | 379 |
380 // Connect the accelerator for the browser action popup. | 380 // Connect the accelerator for the browser action popup. |
381 void ConnectBrowserActionPopupAccelerator() { | 381 void ConnectBrowserActionPopupAccelerator() { |
382 ExtensionCommandService* command_service = | 382 extensions::ExtensionCommandService* command_service = |
383 ExtensionCommandServiceFactory::GetForProfile( | 383 extensions::ExtensionCommandServiceFactory::GetForProfile( |
384 toolbar_->browser()->profile()); | 384 toolbar_->browser()->profile()); |
385 const extensions::Command* command = | 385 const extensions::Command* command = |
386 command_service->GetActiveBrowserActionCommand(extension_->id()); | 386 command_service->GetBrowserActionCommand(extension_->id(), |
| 387 extensions::ExtensionCommandService::ACTIVE_ONLY); |
387 if (command) { | 388 if (command) { |
388 // Found the browser action shortcut command, register it. | 389 // Found the browser action shortcut command, register it. |
389 keybinding_.reset(new ui::AcceleratorGtk( | 390 keybinding_.reset(new ui::AcceleratorGtk( |
390 command->accelerator().key_code(), | 391 command->accelerator().key_code(), |
391 command->accelerator().IsShiftDown(), | 392 command->accelerator().IsShiftDown(), |
392 command->accelerator().IsCtrlDown(), | 393 command->accelerator().IsCtrlDown(), |
393 command->accelerator().IsAltDown())); | 394 command->accelerator().IsAltDown())); |
394 | 395 |
395 gfx::NativeWindow window = | 396 gfx::NativeWindow window = |
396 toolbar_->browser()->window()->GetNativeHandle(); | 397 toolbar_->browser()->window()->GetNativeHandle(); |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 | 1082 |
1082 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), | 1083 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), |
1083 event->time); | 1084 event->time); |
1084 return TRUE; | 1085 return TRUE; |
1085 } | 1086 } |
1086 | 1087 |
1087 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { | 1088 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { |
1088 if (!resize_animation_.is_animating()) | 1089 if (!resize_animation_.is_animating()) |
1089 UpdateChevronVisibility(); | 1090 UpdateChevronVisibility(); |
1090 } | 1091 } |
OLD | NEW |