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

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

Issue 9968076: Remove Inspect Popup command from browser actions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Woopsies Created 8 years, 8 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
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/browser_actions_toolbar_gtk.h" 5 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 return std::max((kButtonWidth + kButtonPadding) * icon_count - kButtonPadding, 82 return std::max((kButtonWidth + kButtonPadding) * icon_count - kButtonPadding,
83 0); 83 0);
84 } 84 }
85 85
86 } // namespace 86 } // namespace
87 87
88 using ui::SimpleMenuModel; 88 using ui::SimpleMenuModel;
89 89
90 class BrowserActionButton : public content::NotificationObserver, 90 class BrowserActionButton : public content::NotificationObserver,
91 public ImageLoadingTracker::Observer, 91 public ImageLoadingTracker::Observer,
92 public ExtensionContextMenuModel::PopupDelegate,
93 public MenuGtk::Delegate { 92 public MenuGtk::Delegate {
94 public: 93 public:
95 BrowserActionButton(BrowserActionsToolbarGtk* toolbar, 94 BrowserActionButton(BrowserActionsToolbarGtk* toolbar,
96 const Extension* extension, 95 const Extension* extension,
97 ThemeServiceGtk* theme_provider) 96 ThemeServiceGtk* theme_provider)
98 : toolbar_(toolbar), 97 : toolbar_(toolbar),
99 extension_(extension), 98 extension_(extension),
100 image_(NULL), 99 image_(NULL),
101 tracker_(this), 100 tracker_(this),
102 tab_specific_icon_(NULL), 101 tab_specific_icon_(NULL),
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } else { 233 } else {
235 return default_skbitmap_; 234 return default_skbitmap_;
236 } 235 }
237 } 236 }
238 237
239 MenuGtk* GetContextMenu() { 238 MenuGtk* GetContextMenu() {
240 if (!extension_->ShowConfigureContextMenus()) 239 if (!extension_->ShowConfigureContextMenus())
241 return NULL; 240 return NULL;
242 241
243 context_menu_model_ = 242 context_menu_model_ =
244 new ExtensionContextMenuModel(extension_, toolbar_->browser(), this); 243 new ExtensionContextMenuModel(extension_, toolbar_->browser());
245 context_menu_.reset( 244 context_menu_.reset(
246 new MenuGtk(this, context_menu_model_.get())); 245 new MenuGtk(this, context_menu_model_.get()));
247 return context_menu_.get(); 246 return context_menu_.get();
248 } 247 }
249 248
250 private: 249 private:
251 // MenuGtk::Delegate implementation. 250 // MenuGtk::Delegate implementation.
252 virtual void StoppedShowing() { 251 virtual void StoppedShowing() {
253 button_->UnsetPaintOverride(); 252 button_->UnsetPaintOverride();
254 253
(...skipping 24 matching lines...) Expand all
279 if (browser_action->HasPopup(tab_id)) { 278 if (browser_action->HasPopup(tab_id)) {
280 ExtensionPopupGtk::Show( 279 ExtensionPopupGtk::Show(
281 browser_action->GetPopupUrl(tab_id), toolbar_->browser(), 280 browser_action->GetPopupUrl(tab_id), toolbar_->browser(),
282 widget(), devtools); 281 widget(), devtools);
283 return true; 282 return true;
284 } 283 }
285 284
286 return false; 285 return false;
287 } 286 }
288 287
289 // ExtensionContextMenuModel::PopupDelegate implementation.
290 virtual void InspectPopup(ExtensionAction* action) {
291 ShowPopup(true);
292 }
293
294 void SetImage(GdkPixbuf* image) { 288 void SetImage(GdkPixbuf* image) {
295 if (!image_) { 289 if (!image_) {
296 image_ = gtk_image_new_from_pixbuf(image); 290 image_ = gtk_image_new_from_pixbuf(image);
297 gtk_button_set_image(GTK_BUTTON(button()), image_); 291 gtk_button_set_image(GTK_BUTTON(button()), image_);
298 } else { 292 } else {
299 gtk_image_set_from_pixbuf(GTK_IMAGE(image_), image); 293 gtk_image_set_from_pixbuf(GTK_IMAGE(image_), image);
300 } 294 }
301 } 295 }
302 296
303 static gboolean OnButtonPress(GtkWidget* widget, 297 static gboolean OnButtonPress(GtkWidget* widget,
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 1072
1079 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), 1073 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root),
1080 event->time); 1074 event->time);
1081 return TRUE; 1075 return TRUE;
1082 } 1076 }
1083 1077
1084 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { 1078 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) {
1085 if (!resize_animation_.is_animating()) 1079 if (!resize_animation_.is_animating())
1086 UpdateChevronVisibility(); 1080 UpdateChevronVisibility();
1087 } 1081 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698