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

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

Issue 6125003: Make ExtensionBrowserEventRouter owned by ExtensionService.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gtk/browser_actions_toolbar_gtk.h" 5 #include "chrome/browser/gtk/browser_actions_toolbar_gtk.h"
6 6
7 #include <algorithm>
7 #include <vector> 8 #include <vector>
8 9
9 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
10 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/extensions/extension_browser_event_router.h" 12 #include "chrome/browser/extensions/extension_browser_event_router.h"
12 #include "chrome/browser/extensions/extension_context_menu_model.h" 13 #include "chrome/browser/extensions/extension_context_menu_model.h"
13 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/image_loading_tracker.h" 15 #include "chrome/browser/extensions/image_loading_tracker.h"
15 #include "chrome/browser/gtk/cairo_cached_surface.h" 16 #include "chrome/browser/gtk/cairo_cached_surface.h"
16 #include "chrome/browser/gtk/extension_popup_gtk.h" 17 #include "chrome/browser/gtk/extension_popup_gtk.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 action->button_->SetPaintOverride(GTK_STATE_ACTIVE); 271 action->button_->SetPaintOverride(GTK_STATE_ACTIVE);
271 action->GetContextMenu()->Popup(widget, event); 272 action->GetContextMenu()->Popup(widget, event);
272 273
273 return TRUE; 274 return TRUE;
274 } 275 }
275 276
276 static void OnClicked(GtkWidget* widget, BrowserActionButton* action) { 277 static void OnClicked(GtkWidget* widget, BrowserActionButton* action) {
277 if (action->ShowPopup(false)) 278 if (action->ShowPopup(false))
278 return; 279 return;
279 280
280 ExtensionBrowserEventRouter::GetInstance()->BrowserActionExecuted( 281 ExtensionService* service =
282 action->toolbar_->browser()->profile()->GetExtensionService();
283 service->browser_event_router()->BrowserActionExecuted(
281 action->toolbar_->browser()->profile(), action->extension_->id(), 284 action->toolbar_->browser()->profile(), action->extension_->id(),
282 action->toolbar_->browser()); 285 action->toolbar_->browser());
283 } 286 }
284 287
285 static gboolean OnExposeEvent(GtkWidget* widget, 288 static gboolean OnExposeEvent(GtkWidget* widget,
286 GdkEventExpose* event, 289 GdkEventExpose* event,
287 BrowserActionButton* button) { 290 BrowserActionButton* button) {
288 int tab_id = button->toolbar_->GetCurrentTabId(); 291 int tab_id = button->toolbar_->GetCurrentTabId();
289 if (tab_id < 0) 292 if (tab_id < 0)
290 return FALSE; 293 return FALSE;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 drop_index_(-1), 364 drop_index_(-1),
362 resize_animation_(this), 365 resize_animation_(this),
363 desired_width_(0), 366 desired_width_(0),
364 start_width_(0), 367 start_width_(0),
365 method_factory_(this) { 368 method_factory_(this) {
366 ExtensionService* extension_service = profile_->GetExtensionService(); 369 ExtensionService* extension_service = profile_->GetExtensionService();
367 // The |extension_service| can be NULL in Incognito. 370 // The |extension_service| can be NULL in Incognito.
368 if (!extension_service) 371 if (!extension_service)
369 return; 372 return;
370 373
371 overflow_button_.reset(new CustomDrawButton( 374 overflow_button_.reset(new CustomDrawButton(
372 theme_provider_, 375 theme_provider_,
373 IDR_BROWSER_ACTIONS_OVERFLOW, 376 IDR_BROWSER_ACTIONS_OVERFLOW,
374 IDR_BROWSER_ACTIONS_OVERFLOW_P, 377 IDR_BROWSER_ACTIONS_OVERFLOW_P,
375 IDR_BROWSER_ACTIONS_OVERFLOW_H, 378 IDR_BROWSER_ACTIONS_OVERFLOW_H,
376 0, 379 0,
377 gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE))); 380 gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE)));
378 381
379 GtkWidget* gripper = gtk_button_new(); 382 GtkWidget* gripper = gtk_button_new();
380 gtk_widget_set_size_request(gripper, kResizeGripperWidth, -1); 383 gtk_widget_set_size_request(gripper, kResizeGripperWidth, -1);
381 GTK_WIDGET_UNSET_FLAGS(gripper, GTK_CAN_FOCUS); 384 GTK_WIDGET_UNSET_FLAGS(gripper, GTK_CAN_FOCUS);
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 NOTREACHED() << "No current tab."; 676 NOTREACHED() << "No current tab.";
674 return; 677 return;
675 } 678 }
676 679
677 if (browser_action->HasPopup(tab_id)) { 680 if (browser_action->HasPopup(tab_id)) {
678 ExtensionPopupGtk::Show( 681 ExtensionPopupGtk::Show(
679 browser_action->GetPopupUrl(tab_id), browser(), 682 browser_action->GetPopupUrl(tab_id), browser(),
680 chevron(), 683 chevron(),
681 false); 684 false);
682 } else { 685 } else {
683 ExtensionBrowserEventRouter::GetInstance()->BrowserActionExecuted( 686 ExtensionService* service = browser()->profile()->GetExtensionService();
687 service->browser_event_router()->BrowserActionExecuted(
684 browser()->profile(), extension->id(), browser()); 688 browser()->profile(), extension->id(), browser());
685 } 689 }
686 } 690 }
687 691
688 void BrowserActionsToolbarGtk::StoppedShowing() { 692 void BrowserActionsToolbarGtk::StoppedShowing() {
689 overflow_button_->UnsetPaintOverride(); 693 overflow_button_->UnsetPaintOverride();
690 } 694 }
691 695
692 bool BrowserActionsToolbarGtk::AlwaysShowIconForCmd(int command_id) const { 696 bool BrowserActionsToolbarGtk::AlwaysShowIconForCmd(int command_id) const {
693 return true; 697 return true;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 } 940 }
937 941
938 it->second.get()->GetContextMenu()->PopupAsContext(event->time); 942 it->second.get()->GetContextMenu()->PopupAsContext(event->time);
939 return TRUE; 943 return TRUE;
940 } 944 }
941 945
942 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { 946 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) {
943 if (!resize_animation_.is_animating()) 947 if (!resize_animation_.is_animating())
944 UpdateChevronVisibility(); 948 UpdateChevronVisibility();
945 } 949 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm ('k') | chrome/browser/ui/gtk/location_bar_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698