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/location_bar_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "chrome/app/chrome_command_ids.h" | 18 #include "chrome/app/chrome_command_ids.h" |
19 #include "chrome/browser/accessibility/accessibility_events.h" | 19 #include "chrome/browser/accessibility/accessibility_events.h" |
20 #include "chrome/browser/alternate_nav_url_fetcher.h" | 20 #include "chrome/browser/alternate_nav_url_fetcher.h" |
21 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 21 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
22 #include "chrome/browser/chrome_to_mobile_service.h" | 22 #include "chrome/browser/chrome_to_mobile_service.h" |
23 #include "chrome/browser/chrome_to_mobile_service_factory.h" | 23 #include "chrome/browser/chrome_to_mobile_service_factory.h" |
24 #include "chrome/browser/command_updater.h" | 24 #include "chrome/browser/command_updater.h" |
25 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 25 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
26 #include "chrome/browser/defaults.h" | 26 #include "chrome/browser/defaults.h" |
27 #include "chrome/browser/extensions/api/commands/extension_command_service.h" | 27 #include "chrome/browser/extensions/api/commands/command_service.h" |
28 #include "chrome/browser/extensions/api/commands/extension_command_service_facto
ry.h" | 28 #include "chrome/browser/extensions/api/commands/command_service_factory.h" |
29 #include "chrome/browser/extensions/extension_browser_event_router.h" | 29 #include "chrome/browser/extensions/extension_browser_event_router.h" |
30 #include "chrome/browser/extensions/extension_service.h" | 30 #include "chrome/browser/extensions/extension_service.h" |
31 #include "chrome/browser/extensions/extension_tab_helper.h" | 31 #include "chrome/browser/extensions/extension_tab_helper.h" |
32 #include "chrome/browser/extensions/extension_tab_util.h" | 32 #include "chrome/browser/extensions/extension_tab_util.h" |
33 #include "chrome/browser/favicon/favicon_tab_helper.h" | 33 #include "chrome/browser/favicon/favicon_tab_helper.h" |
34 #include "chrome/browser/instant/instant_controller.h" | 34 #include "chrome/browser/instant/instant_controller.h" |
35 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
36 #include "chrome/browser/search_engines/template_url.h" | 36 #include "chrome/browser/search_engines/template_url.h" |
37 #include "chrome/browser/search_engines/template_url_service.h" | 37 #include "chrome/browser/search_engines/template_url_service.h" |
38 #include "chrome/browser/search_engines/template_url_service_factory.h" | 38 #include "chrome/browser/search_engines/template_url_service_factory.h" |
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1665 UpdateChromeToMobileIcon(); | 1665 UpdateChromeToMobileIcon(); |
1666 } | 1666 } |
1667 | 1667 |
1668 void LocationBarViewGtk::PageActionViewGtk::ConnectPageActionAccelerator() { | 1668 void LocationBarViewGtk::PageActionViewGtk::ConnectPageActionAccelerator() { |
1669 const ExtensionSet* extensions = owner_->browser()->profile()-> | 1669 const ExtensionSet* extensions = owner_->browser()->profile()-> |
1670 GetExtensionService()->extensions(); | 1670 GetExtensionService()->extensions(); |
1671 const Extension* extension = | 1671 const Extension* extension = |
1672 extensions->GetByID(page_action_->extension_id()); | 1672 extensions->GetByID(page_action_->extension_id()); |
1673 window_ = owner_->browser()->window()->GetNativeHandle(); | 1673 window_ = owner_->browser()->window()->GetNativeHandle(); |
1674 | 1674 |
1675 extensions::ExtensionCommandService* command_service = | 1675 extensions::CommandService* command_service = |
1676 extensions::ExtensionCommandServiceFactory::GetForProfile( | 1676 extensions::CommandServiceFactory::GetForProfile( |
1677 owner_->browser()->profile()); | 1677 owner_->browser()->profile()); |
1678 const extensions::Command* command = | 1678 const extensions::Command* command = |
1679 command_service->GetPageActionCommand( | 1679 command_service->GetPageActionCommand( |
1680 extension->id(), | 1680 extension->id(), |
1681 extensions::ExtensionCommandService::ACTIVE_ONLY); | 1681 extensions::CommandService::ACTIVE_ONLY); |
1682 if (command) { | 1682 if (command) { |
1683 // Found the browser action shortcut command, register it. | 1683 // Found the browser action shortcut command, register it. |
1684 keybinding_.reset(new ui::AcceleratorGtk( | 1684 keybinding_.reset(new ui::AcceleratorGtk( |
1685 command->accelerator().key_code(), | 1685 command->accelerator().key_code(), |
1686 command->accelerator().IsShiftDown(), | 1686 command->accelerator().IsShiftDown(), |
1687 command->accelerator().IsCtrlDown(), | 1687 command->accelerator().IsCtrlDown(), |
1688 command->accelerator().IsAltDown())); | 1688 command->accelerator().IsAltDown())); |
1689 | 1689 |
1690 accel_group_ = gtk_accel_group_new(); | 1690 accel_group_ = gtk_accel_group_new(); |
1691 gtk_window_add_accel_group(window_, accel_group_); | 1691 gtk_window_add_accel_group(window_, accel_group_); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 GdkModifierType modifier, | 1796 GdkModifierType modifier, |
1797 void* user_data) { | 1797 void* user_data) { |
1798 PageActionViewGtk* view = static_cast<PageActionViewGtk*>(user_data); | 1798 PageActionViewGtk* view = static_cast<PageActionViewGtk*>(user_data); |
1799 if (!gtk_widget_get_visible(view->widget())) | 1799 if (!gtk_widget_get_visible(view->widget())) |
1800 return FALSE; | 1800 return FALSE; |
1801 | 1801 |
1802 GdkEventButton event = {}; | 1802 GdkEventButton event = {}; |
1803 event.button = 1; | 1803 event.button = 1; |
1804 return view->OnButtonPressed(view->widget(), &event); | 1804 return view->OnButtonPressed(view->widget(), &event); |
1805 } | 1805 } |
OLD | NEW |