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> |
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/api/commands/command_service.h" | 16 #include "chrome/browser/extensions/api/commands/command_service.h" |
17 #include "chrome/browser/extensions/api/commands/command_service_factory.h" | |
18 #include "chrome/browser/extensions/extension_action.h" | 17 #include "chrome/browser/extensions/extension_action.h" |
19 #include "chrome/browser/extensions/extension_action_icon_factory.h" | 18 #include "chrome/browser/extensions/extension_action_icon_factory.h" |
20 #include "chrome/browser/extensions/extension_action_manager.h" | 19 #include "chrome/browser/extensions/extension_action_manager.h" |
21 #include "chrome/browser/extensions/extension_context_menu_model.h" | 20 #include "chrome/browser/extensions/extension_context_menu_model.h" |
22 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
23 #include "chrome/browser/extensions/extension_system.h" | 22 #include "chrome/browser/extensions/extension_system.h" |
24 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/sessions/session_tab_helper.h" | 24 #include "chrome/browser/sessions/session_tab_helper.h" |
26 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
27 #include "chrome/browser/ui/browser_tabstrip.h" | 26 #include "chrome/browser/ui/browser_tabstrip.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 // The handler for when the browser action is realized. |user_data| contains a | 375 // The handler for when the browser action is realized. |user_data| contains a |
377 // pointer to the BrowserAction shown. | 376 // pointer to the BrowserAction shown. |
378 static void OnRealize(GtkWidget* widget, void* user_data) { | 377 static void OnRealize(GtkWidget* widget, void* user_data) { |
379 BrowserActionButton* button = static_cast<BrowserActionButton*>(user_data); | 378 BrowserActionButton* button = static_cast<BrowserActionButton*>(user_data); |
380 button->ConnectBrowserActionPopupAccelerator(); | 379 button->ConnectBrowserActionPopupAccelerator(); |
381 } | 380 } |
382 | 381 |
383 // Connect the accelerator for the browser action popup. | 382 // Connect the accelerator for the browser action popup. |
384 void ConnectBrowserActionPopupAccelerator() { | 383 void ConnectBrowserActionPopupAccelerator() { |
385 extensions::CommandService* command_service = | 384 extensions::CommandService* command_service = |
386 extensions::CommandServiceFactory::GetForProfile( | 385 extensions::CommandService::Get(toolbar_->browser()->profile()); |
387 toolbar_->browser()->profile()); | |
388 extensions::Command command; | 386 extensions::Command command; |
389 if (command_service->GetBrowserActionCommand(extension_->id(), | 387 if (command_service->GetBrowserActionCommand(extension_->id(), |
390 extensions::CommandService::ACTIVE_ONLY, | 388 extensions::CommandService::ACTIVE_ONLY, |
391 &command, | 389 &command, |
392 NULL)) { | 390 NULL)) { |
393 // Found the browser action shortcut command, register it. | 391 // Found the browser action shortcut command, register it. |
394 keybinding_ = command.accelerator(); | 392 keybinding_ = command.accelerator(); |
395 | 393 |
396 gfx::NativeWindow window = | 394 gfx::NativeWindow window = |
397 toolbar_->browser()->window()->GetNativeWindow(); | 395 toolbar_->browser()->window()->GetNativeWindow(); |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 | 1091 |
1094 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), | 1092 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), |
1095 event->time); | 1093 event->time); |
1096 return TRUE; | 1094 return TRUE; |
1097 } | 1095 } |
1098 | 1096 |
1099 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { | 1097 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { |
1100 if (!resize_animation_.is_animating()) | 1098 if (!resize_animation_.is_animating()) |
1101 UpdateChevronVisibility(); | 1099 UpdateChevronVisibility(); |
1102 } | 1100 } |
OLD | NEW |