| 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/extension_browser_event_router.h" | 27 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 28 #include "chrome/browser/extensions/extension_command_service.h" |
| 29 #include "chrome/browser/extensions/extension_command_service_factory.h" |
| 28 #include "chrome/browser/extensions/extension_service.h" | 30 #include "chrome/browser/extensions/extension_service.h" |
| 29 #include "chrome/browser/extensions/extension_tab_util.h" | 31 #include "chrome/browser/extensions/extension_tab_util.h" |
| 30 #include "chrome/browser/favicon/favicon_tab_helper.h" | 32 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 31 #include "chrome/browser/instant/instant_controller.h" | 33 #include "chrome/browser/instant/instant_controller.h" |
| 32 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
| 33 #include "chrome/browser/search_engines/template_url.h" | 35 #include "chrome/browser/search_engines/template_url.h" |
| 34 #include "chrome/browser/search_engines/template_url_service.h" | 36 #include "chrome/browser/search_engines/template_url_service.h" |
| 35 #include "chrome/browser/search_engines/template_url_service_factory.h" | 37 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 36 #include "chrome/browser/ui/browser.h" | 38 #include "chrome/browser/ui/browser.h" |
| 37 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" | 39 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" |
| (...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 return true; | 1692 return true; |
| 1691 } | 1693 } |
| 1692 | 1694 |
| 1693 void LocationBarViewGtk::PageActionViewGtk::ConnectPageActionAccelerator() { | 1695 void LocationBarViewGtk::PageActionViewGtk::ConnectPageActionAccelerator() { |
| 1694 const ExtensionSet* extensions = owner_->browser()->profile()-> | 1696 const ExtensionSet* extensions = owner_->browser()->profile()-> |
| 1695 GetExtensionService()->extensions(); | 1697 GetExtensionService()->extensions(); |
| 1696 const Extension* extension = | 1698 const Extension* extension = |
| 1697 extensions->GetByID(page_action_->extension_id()); | 1699 extensions->GetByID(page_action_->extension_id()); |
| 1698 window_ = owner_->browser()->window()->GetNativeHandle(); | 1700 window_ = owner_->browser()->window()->GetNativeHandle(); |
| 1699 | 1701 |
| 1702 ExtensionCommandService* command_service = |
| 1703 ExtensionCommandServiceFactory::GetForProfile( |
| 1704 owner_->browser()->profile()); |
| 1700 const Extension::ExtensionKeybinding* command = | 1705 const Extension::ExtensionKeybinding* command = |
| 1701 extension->page_action_command(); | 1706 command_service->GetActivePageActionCommand(extension->id()); |
| 1702 if (command) { | 1707 if (command) { |
| 1703 // Found the browser action shortcut command, register it. | 1708 // Found the browser action shortcut command, register it. |
| 1704 keybinding_.reset(new ui::AcceleratorGtk( | 1709 keybinding_.reset(new ui::AcceleratorGtk( |
| 1705 command->accelerator().key_code(), | 1710 command->accelerator().key_code(), |
| 1706 command->accelerator().IsShiftDown(), | 1711 command->accelerator().IsShiftDown(), |
| 1707 command->accelerator().IsCtrlDown(), | 1712 command->accelerator().IsCtrlDown(), |
| 1708 command->accelerator().IsAltDown())); | 1713 command->accelerator().IsAltDown())); |
| 1709 | 1714 |
| 1710 accel_group_ = gtk_accel_group_new(); | 1715 accel_group_ = gtk_accel_group_new(); |
| 1711 gtk_window_add_accel_group(window_, accel_group_); | 1716 gtk_window_add_accel_group(window_, accel_group_); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 GdkModifierType modifier, | 1805 GdkModifierType modifier, |
| 1801 void* user_data) { | 1806 void* user_data) { |
| 1802 PageActionViewGtk* view = static_cast<PageActionViewGtk*>(user_data); | 1807 PageActionViewGtk* view = static_cast<PageActionViewGtk*>(user_data); |
| 1803 if (!gtk_widget_get_visible(view->widget())) | 1808 if (!gtk_widget_get_visible(view->widget())) |
| 1804 return FALSE; | 1809 return FALSE; |
| 1805 | 1810 |
| 1806 GdkEventButton event = {}; | 1811 GdkEventButton event = {}; |
| 1807 event.button = 1; | 1812 event.button = 1; |
| 1808 return view->OnButtonPressed(view->widget(), &event); | 1813 return view->OnButtonPressed(view->widget(), &event); |
| 1809 } | 1814 } |
| OLD | NEW |