Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: chrome/browser/ui/gtk/location_bar_view_gtk.cc

Issue 10446034: Rename ActionBoxController -> LocationBarController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: grammar Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/action_box_controller.h"
28 #include "chrome/browser/extensions/api/commands/command_service.h" 27 #include "chrome/browser/extensions/api/commands/command_service.h"
29 #include "chrome/browser/extensions/api/commands/command_service_factory.h" 28 #include "chrome/browser/extensions/api/commands/command_service_factory.h"
30 #include "chrome/browser/extensions/extension_browser_event_router.h" 29 #include "chrome/browser/extensions/extension_browser_event_router.h"
31 #include "chrome/browser/extensions/extension_service.h" 30 #include "chrome/browser/extensions/extension_service.h"
32 #include "chrome/browser/extensions/extension_tab_helper.h" 31 #include "chrome/browser/extensions/extension_tab_helper.h"
33 #include "chrome/browser/extensions/extension_tab_util.h" 32 #include "chrome/browser/extensions/extension_tab_util.h"
33 #include "chrome/browser/extensions/location_bar_controller.h"
34 #include "chrome/browser/favicon/favicon_tab_helper.h" 34 #include "chrome/browser/favicon/favicon_tab_helper.h"
35 #include "chrome/browser/instant/instant_controller.h" 35 #include "chrome/browser/instant/instant_controller.h"
36 #include "chrome/browser/profiles/profile.h" 36 #include "chrome/browser/profiles/profile.h"
37 #include "chrome/browser/search_engines/template_url.h" 37 #include "chrome/browser/search_engines/template_url.h"
38 #include "chrome/browser/search_engines/template_url_service.h" 38 #include "chrome/browser/search_engines/template_url_service.h"
39 #include "chrome/browser/search_engines/template_url_service_factory.h" 39 #include "chrome/browser/search_engines/template_url_service_factory.h"
40 #include "chrome/browser/ui/browser.h" 40 #include "chrome/browser/ui/browser.h"
41 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" 41 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h"
42 #include "chrome/browser/ui/browser_list.h" 42 #include "chrome/browser/ui/browser_list.h"
43 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" 43 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "ui/base/resource/resource_bundle.h" 77 #include "ui/base/resource/resource_bundle.h"
78 #include "ui/gfx/canvas_skia_paint.h" 78 #include "ui/gfx/canvas_skia_paint.h"
79 #include "ui/gfx/font.h" 79 #include "ui/gfx/font.h"
80 #include "ui/gfx/gtk_util.h" 80 #include "ui/gfx/gtk_util.h"
81 #include "ui/gfx/image/image.h" 81 #include "ui/gfx/image/image.h"
82 #include "webkit/glue/window_open_disposition.h" 82 #include "webkit/glue/window_open_disposition.h"
83 83
84 using content::NavigationEntry; 84 using content::NavigationEntry;
85 using content::OpenURLParams; 85 using content::OpenURLParams;
86 using content::WebContents; 86 using content::WebContents;
87 using extensions::ActionBoxController; 87 using extensions::LocationBarController;
88 using extensions::Extension; 88 using extensions::Extension;
89 89
90 namespace { 90 namespace {
91 91
92 // We are positioned with a little bit of extra space that we don't use now. 92 // We are positioned with a little bit of extra space that we don't use now.
93 const int kTopMargin = 1; 93 const int kTopMargin = 1;
94 const int kBottomMargin = 1; 94 const int kBottomMargin = 1;
95 const int kLeftMargin = 1; 95 const int kLeftMargin = 1;
96 const int kRightMargin = 1; 96 const int kRightMargin = 1;
97 // We draw a border on the top and bottom (but not on left or right). 97 // We draw a border on the top and bottom (but not on left or right).
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 // If there are no visible content things, hide the top level box so it 687 // If there are no visible content things, hide the top level box so it
688 // doesn't mess with padding. 688 // doesn't mess with padding.
689 gtk_widget_set_visible(content_setting_hbox_.get(), any_visible); 689 gtk_widget_set_visible(content_setting_hbox_.get(), any_visible);
690 } 690 }
691 691
692 void LocationBarViewGtk::UpdatePageActions() { 692 void LocationBarViewGtk::UpdatePageActions() {
693 std::vector<ExtensionAction*> page_actions; 693 std::vector<ExtensionAction*> page_actions;
694 694
695 TabContentsWrapper* tab_contents = GetTabContentsWrapper(); 695 TabContentsWrapper* tab_contents = GetTabContentsWrapper();
696 if (tab_contents) { 696 if (tab_contents) {
697 ActionBoxController* controller = 697 LocationBarController* controller =
698 tab_contents->extension_tab_helper()->action_box_controller(); 698 tab_contents->extension_tab_helper()->location_bar_controller();
699 page_actions.swap(*controller->GetCurrentActions()); 699 page_actions.swap(*controller->GetCurrentActions());
700 } 700 }
701 701
702 // Initialize on the first call, or re-inialize if more extensions have been 702 // Initialize on the first call, or re-inialize if more extensions have been
703 // loaded or added after startup. 703 // loaded or added after startup.
704 if (page_actions.size() != page_action_views_.size()) { 704 if (page_actions.size() != page_action_views_.size()) {
705 page_action_views_.reset(); // Delete the old views (if any). 705 page_action_views_.reset(); // Delete the old views (if any).
706 706
707 for (size_t i = 0; i < page_actions.size(); ++i) { 707 for (size_t i = 0; i < page_actions.size(); ++i) {
708 page_action_views_.push_back( 708 page_action_views_.push_back(
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 ExtensionService* extension_service = 1757 ExtensionService* extension_service =
1758 owner_->browser()->profile()->GetExtensionService(); 1758 owner_->browser()->profile()->GetExtensionService();
1759 if (!extension_service) 1759 if (!extension_service)
1760 return TRUE; 1760 return TRUE;
1761 1761
1762 const Extension* extension = 1762 const Extension* extension =
1763 extension_service->extensions()->GetByID(page_action()->extension_id()); 1763 extension_service->extensions()->GetByID(page_action()->extension_id());
1764 if (!extension) 1764 if (!extension)
1765 return TRUE; 1765 return TRUE;
1766 1766
1767 ActionBoxController* controller = 1767 LocationBarController* controller =
1768 tab_contents->extension_tab_helper()->action_box_controller(); 1768 tab_contents->extension_tab_helper()->location_bar_controller();
1769 1769
1770 switch (controller->OnClicked(extension->id(), event->button)) { 1770 switch (controller->OnClicked(extension->id(), event->button)) {
1771 case ActionBoxController::ACTION_NONE: 1771 case LocationBarController::ACTION_NONE:
1772 break; 1772 break;
1773 1773
1774 case ActionBoxController::ACTION_SHOW_POPUP: 1774 case LocationBarController::ACTION_SHOW_POPUP:
1775 ExtensionPopupGtk::Show( 1775 ExtensionPopupGtk::Show(
1776 page_action_->GetPopupUrl(current_tab_id_), 1776 page_action_->GetPopupUrl(current_tab_id_),
1777 owner_->browser_, 1777 owner_->browser_,
1778 event_box_.get()); 1778 event_box_.get());
1779 break; 1779 break;
1780 1780
1781 case ActionBoxController::ACTION_SHOW_CONTEXT_MENU: 1781 case LocationBarController::ACTION_SHOW_CONTEXT_MENU:
1782 context_menu_model_ = 1782 context_menu_model_ =
1783 new ExtensionContextMenuModel(extension, owner_->browser_); 1783 new ExtensionContextMenuModel(extension, owner_->browser_);
1784 context_menu_.reset( 1784 context_menu_.reset(
1785 new MenuGtk(NULL, context_menu_model_.get())); 1785 new MenuGtk(NULL, context_menu_model_.get()));
1786 context_menu_->PopupForWidget(sender, event->button, event->time); 1786 context_menu_->PopupForWidget(sender, event->button, event->time);
1787 break; 1787 break;
1788 } 1788 }
1789 1789
1790 return TRUE; 1790 return TRUE;
1791 } 1791 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 GdkModifierType modifier, 1825 GdkModifierType modifier,
1826 void* user_data) { 1826 void* user_data) {
1827 PageActionViewGtk* view = static_cast<PageActionViewGtk*>(user_data); 1827 PageActionViewGtk* view = static_cast<PageActionViewGtk*>(user_data);
1828 if (!gtk_widget_get_visible(view->widget())) 1828 if (!gtk_widget_get_visible(view->widget()))
1829 return FALSE; 1829 return FALSE;
1830 1830
1831 GdkEventButton event = {}; 1831 GdkEventButton event = {};
1832 event.button = 1; 1832 event.button = 1;
1833 return view->OnButtonPressed(view->widget(), &event); 1833 return view->OnButtonPressed(view->widget(), &event);
1834 } 1834 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698