OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
21 #include "chrome/app/chrome_command_ids.h" | 21 #include "chrome/app/chrome_command_ids.h" |
22 #include "chrome/browser/accessibility/accessibility_events.h" | 22 #include "chrome/browser/accessibility/accessibility_events.h" |
23 #include "chrome/browser/alternate_nav_url_fetcher.h" | 23 #include "chrome/browser/alternate_nav_url_fetcher.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/command_service.h" | 27 #include "chrome/browser/extensions/api/commands/command_service.h" |
28 #include "chrome/browser/extensions/api/commands/command_service_factory.h" | |
29 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" | 28 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" |
30 #include "chrome/browser/extensions/extension_action.h" | 29 #include "chrome/browser/extensions/extension_action.h" |
31 #include "chrome/browser/extensions/extension_service.h" | 30 #include "chrome/browser/extensions/extension_service.h" |
32 #include "chrome/browser/extensions/extension_tab_util.h" | 31 #include "chrome/browser/extensions/extension_tab_util.h" |
33 #include "chrome/browser/extensions/location_bar_controller.h" | 32 #include "chrome/browser/extensions/location_bar_controller.h" |
34 #include "chrome/browser/extensions/script_bubble_controller.h" | 33 #include "chrome/browser/extensions/script_bubble_controller.h" |
35 #include "chrome/browser/extensions/tab_helper.h" | 34 #include "chrome/browser/extensions/tab_helper.h" |
36 #include "chrome/browser/favicon/favicon_tab_helper.h" | 35 #include "chrome/browser/favicon/favicon_tab_helper.h" |
37 #include "chrome/browser/prefs/pref_service.h" | 36 #include "chrome/browser/prefs/pref_service.h" |
38 #include "chrome/browser/profiles/profile.h" | 37 #include "chrome/browser/profiles/profile.h" |
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1993 } | 1992 } |
1994 | 1993 |
1995 void LocationBarViewGtk::PageActionViewGtk::ConnectPageActionAccelerator() { | 1994 void LocationBarViewGtk::PageActionViewGtk::ConnectPageActionAccelerator() { |
1996 const ExtensionSet* extensions = owner_->browser()->profile()-> | 1995 const ExtensionSet* extensions = owner_->browser()->profile()-> |
1997 GetExtensionService()->extensions(); | 1996 GetExtensionService()->extensions(); |
1998 const Extension* extension = | 1997 const Extension* extension = |
1999 extensions->GetByID(page_action_->extension_id()); | 1998 extensions->GetByID(page_action_->extension_id()); |
2000 window_ = owner_->browser()->window()->GetNativeWindow(); | 1999 window_ = owner_->browser()->window()->GetNativeWindow(); |
2001 | 2000 |
2002 extensions::CommandService* command_service = | 2001 extensions::CommandService* command_service = |
2003 extensions::CommandServiceFactory::GetForProfile( | 2002 extensions::CommandService::Get(owner_->browser()->profile()); |
2004 owner_->browser()->profile()); | |
2005 | 2003 |
2006 extensions::Command command_page_action; | 2004 extensions::Command command_page_action; |
2007 if (command_service->GetPageActionCommand( | 2005 if (command_service->GetPageActionCommand( |
2008 extension->id(), | 2006 extension->id(), |
2009 extensions::CommandService::ACTIVE_ONLY, | 2007 extensions::CommandService::ACTIVE_ONLY, |
2010 &command_page_action, | 2008 &command_page_action, |
2011 NULL)) { | 2009 NULL)) { |
2012 // Found the page action shortcut command, register it. | 2010 // Found the page action shortcut command, register it. |
2013 page_action_keybinding_.reset( | 2011 page_action_keybinding_.reset( |
2014 new ui::Accelerator(command_page_action.accelerator())); | 2012 new ui::Accelerator(command_page_action.accelerator())); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2184 } | 2182 } |
2185 | 2183 |
2186 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( | 2184 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( |
2187 ExtensionAction* action) { | 2185 ExtensionAction* action) { |
2188 ExtensionPopupGtk::Show( | 2186 ExtensionPopupGtk::Show( |
2189 action->GetPopupUrl(current_tab_id_), | 2187 action->GetPopupUrl(current_tab_id_), |
2190 owner_->browser_, | 2188 owner_->browser_, |
2191 event_box_.get(), | 2189 event_box_.get(), |
2192 ExtensionPopupGtk::SHOW_AND_INSPECT); | 2190 ExtensionPopupGtk::SHOW_AND_INSPECT); |
2193 } | 2191 } |
OLD | NEW |