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

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

Issue 12066003: Remove TabStripModel wrapper use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gtk Created 7 years, 10 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 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
(...skipping 25 matching lines...) Expand all
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_command_controller.h" 41 #include "chrome/browser/ui/browser_command_controller.h"
42 #include "chrome/browser/ui/browser_commands.h" 42 #include "chrome/browser/ui/browser_commands.h"
43 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" 43 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h"
44 #include "chrome/browser/ui/browser_instant_controller.h" 44 #include "chrome/browser/ui/browser_instant_controller.h"
45 #include "chrome/browser/ui/browser_list.h" 45 #include "chrome/browser/ui/browser_list.h"
46 #include "chrome/browser/ui/browser_tabstrip.h"
47 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" 46 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
48 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" 47 #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
49 #include "chrome/browser/ui/gtk/action_box_button_gtk.h" 48 #include "chrome/browser/ui/gtk/action_box_button_gtk.h"
50 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" 49 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h"
51 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" 50 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
52 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 51 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
53 #include "chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.h" 52 #include "chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.h"
54 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" 53 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h"
55 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" 54 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h"
56 #include "chrome/browser/ui/gtk/first_run_bubble.h" 55 #include "chrome/browser/ui/gtk/first_run_bubble.h"
57 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 56 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
58 #include "chrome/browser/ui/gtk/gtk_util.h" 57 #include "chrome/browser/ui/gtk/gtk_util.h"
59 #include "chrome/browser/ui/gtk/nine_box.h" 58 #include "chrome/browser/ui/gtk/nine_box.h"
60 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" 59 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h"
61 #include "chrome/browser/ui/gtk/rounded_window.h" 60 #include "chrome/browser/ui/gtk/rounded_window.h"
62 #include "chrome/browser/ui/gtk/script_bubble_gtk.h" 61 #include "chrome/browser/ui/gtk/script_bubble_gtk.h"
63 #include "chrome/browser/ui/gtk/view_id_util.h" 62 #include "chrome/browser/ui/gtk/view_id_util.h"
64 #include "chrome/browser/ui/gtk/zoom_bubble_gtk.h" 63 #include "chrome/browser/ui/gtk/zoom_bubble_gtk.h"
65 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" 64 #include "chrome/browser/ui/intents/web_intent_picker_controller.h"
66 #include "chrome/browser/ui/omnibox/alternate_nav_url_fetcher.h" 65 #include "chrome/browser/ui/omnibox/alternate_nav_url_fetcher.h"
67 #include "chrome/browser/ui/omnibox/location_bar_util.h" 66 #include "chrome/browser/ui/omnibox/location_bar_util.h"
68 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" 67 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
69 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" 68 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
69 #include "chrome/browser/ui/tabs/tab_strip_model.h"
70 #include "chrome/browser/ui/webui/extensions/extension_info_ui.h" 70 #include "chrome/browser/ui/webui/extensions/extension_info_ui.h"
71 #include "chrome/browser/ui/zoom/zoom_controller.h" 71 #include "chrome/browser/ui/zoom/zoom_controller.h"
72 #include "chrome/common/badge_util.h" 72 #include "chrome/common/badge_util.h"
73 #include "chrome/common/chrome_notification_types.h" 73 #include "chrome/common/chrome_notification_types.h"
74 #include "chrome/common/chrome_switches.h" 74 #include "chrome/common/chrome_switches.h"
75 #include "chrome/common/extensions/extension.h" 75 #include "chrome/common/extensions/extension.h"
76 #include "chrome/common/extensions/extension_manifest_constants.h" 76 #include "chrome/common/extensions/extension_manifest_constants.h"
77 #include "chrome/common/extensions/extension_resource.h" 77 #include "chrome/common/extensions/extension_resource.h"
78 #include "chrome/common/extensions/feature_switch.h" 78 #include "chrome/common/extensions/feature_switch.h"
79 #include "chrome/common/pref_names.h" 79 #include "chrome/common/pref_names.h"
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 695
696 gtk_drag_source_set(site_type_event_box_, GDK_BUTTON1_MASK, 696 gtk_drag_source_set(site_type_event_box_, GDK_BUTTON1_MASK,
697 NULL, 0, GDK_ACTION_COPY); 697 NULL, 0, GDK_ACTION_COPY);
698 ui::SetSourceTargetListFromCodeMask(site_type_event_box_, 698 ui::SetSourceTargetListFromCodeMask(site_type_event_box_,
699 ui::TEXT_PLAIN | 699 ui::TEXT_PLAIN |
700 ui::TEXT_URI_LIST | 700 ui::TEXT_URI_LIST |
701 ui::CHROME_NAMED_URL); 701 ui::CHROME_NAMED_URL);
702 } 702 }
703 703
704 WebContents* LocationBarViewGtk::GetWebContents() const { 704 WebContents* LocationBarViewGtk::GetWebContents() const {
705 return chrome::GetActiveWebContents(browser_); 705 return browser_->tab_strip_model()->GetActiveWebContents();
706 } 706 }
707 707
708 void LocationBarViewGtk::SetPreviewEnabledPageAction( 708 void LocationBarViewGtk::SetPreviewEnabledPageAction(
709 ExtensionAction* page_action, 709 ExtensionAction* page_action,
710 bool preview_enabled) { 710 bool preview_enabled) {
711 DCHECK(page_action); 711 DCHECK(page_action);
712 for (ScopedVector<PageActionViewGtk>::iterator iter = 712 for (ScopedVector<PageActionViewGtk>::iterator iter =
713 page_action_views_.begin(); iter != page_action_views_.end(); 713 page_action_views_.begin(); iter != page_action_views_.end();
714 ++iter) { 714 ++iter) {
715 if ((*iter)->page_action() == page_action) { 715 if ((*iter)->page_action() == page_action) {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 gtk_box_pack_end(GTK_BOX(page_action_hbox_.get()), 999 gtk_box_pack_end(GTK_BOX(page_action_hbox_.get()),
1000 page_action_views_[i]->widget(), FALSE, FALSE, 0); 1000 page_action_views_[i]->widget(), FALSE, FALSE, 0);
1001 } 1001 }
1002 content::NotificationService::current()->Notify( 1002 content::NotificationService::current()->Notify(
1003 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, 1003 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED,
1004 content::Source<LocationBar>(this), 1004 content::Source<LocationBar>(this),
1005 content::NotificationService::NoDetails()); 1005 content::NotificationService::NoDetails());
1006 } 1006 }
1007 1007
1008 if (!page_action_views_.empty() && contents) { 1008 if (!page_action_views_.empty() && contents) {
1009 GURL url = chrome::GetActiveWebContents(browser())->GetURL(); 1009 GURL url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL();
1010 1010
1011 for (size_t i = 0; i < page_action_views_.size(); i++) { 1011 for (size_t i = 0; i < page_action_views_.size(); i++) {
1012 page_action_views_[i]->UpdateVisibility( 1012 page_action_views_[i]->UpdateVisibility(
1013 toolbar_model_->GetInputInProgress() ? NULL : contents, url); 1013 toolbar_model_->GetInputInProgress() ? NULL : contents, url);
1014 } 1014 }
1015 gtk_widget_queue_draw(hbox_.get()); 1015 gtk_widget_queue_draw(hbox_.get());
1016 } 1016 }
1017 1017
1018 // If there are no visible page actions, hide the hbox too, so that it does 1018 // If there are no visible page actions, hide the hbox too, so that it does
1019 // not affect the padding in the location bar. 1019 // not affect the padding in the location bar.
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 } 2182 }
2183 2183
2184 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( 2184 void LocationBarViewGtk::PageActionViewGtk::InspectPopup(
2185 ExtensionAction* action) { 2185 ExtensionAction* action) {
2186 ExtensionPopupGtk::Show( 2186 ExtensionPopupGtk::Show(
2187 action->GetPopupUrl(current_tab_id_), 2187 action->GetPopupUrl(current_tab_id_),
2188 owner_->browser_, 2188 owner_->browser_,
2189 event_box_.get(), 2189 event_box_.get(),
2190 ExtensionPopupGtk::SHOW_AND_INSPECT); 2190 ExtensionPopupGtk::SHOW_AND_INSPECT);
2191 } 2191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698