OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/gfx/canvas_paint.h" | 9 #include "app/gfx/canvas_paint.h" |
10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 gtk_button_set_image(GTK_BUTTON(button_.get()), | 181 gtk_button_set_image(GTK_BUTTON(button_.get()), |
182 gtk_image_new_from_pixbuf(image)); | 182 gtk_image_new_from_pixbuf(image)); |
183 } | 183 } |
184 | 184 |
185 static gboolean OnButtonPress(GtkWidget* widget, | 185 static gboolean OnButtonPress(GtkWidget* widget, |
186 GdkEvent* event, | 186 GdkEvent* event, |
187 BrowserActionButton* action) { | 187 BrowserActionButton* action) { |
188 if (event->button.button != 3) | 188 if (event->button.button != 3) |
189 return FALSE; | 189 return FALSE; |
190 | 190 |
| 191 // TODO(rafaelw): support inspecting popups. |
191 if (!action->context_menu_model_.get()) { | 192 if (!action->context_menu_model_.get()) { |
192 action->context_menu_model_.reset( | 193 action->context_menu_model_.reset( |
193 new ExtensionActionContextMenuModel(action->extension_)); | 194 new ExtensionActionContextMenuModel(action->extension_, |
| 195 action->extension_->browser_action(), |
| 196 action->toolbar_->browser()->profile()->GetPrefs(), NULL)); |
194 } | 197 } |
195 | 198 |
196 action->context_menu_.reset( | 199 action->context_menu_.reset( |
197 new MenuGtk(NULL, action->context_menu_model_.get())); | 200 new MenuGtk(NULL, action->context_menu_model_.get())); |
198 | 201 |
199 action->context_menu_->Popup(widget, event); | 202 action->context_menu_->Popup(widget, event); |
200 return TRUE; | 203 return TRUE; |
201 } | 204 } |
202 | 205 |
203 static void OnClicked(GtkWidget* widget, BrowserActionButton* action) { | 206 static void OnClicked(GtkWidget* widget, BrowserActionButton* action) { |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 | 741 |
739 // TODO(estade): set the menu item's tooltip. | 742 // TODO(estade): set the menu item's tooltip. |
740 } | 743 } |
741 | 744 |
742 gtk_chrome_button_set_paint_state(GTK_CHROME_BUTTON(overflow), | 745 gtk_chrome_button_set_paint_state(GTK_CHROME_BUTTON(overflow), |
743 GTK_STATE_ACTIVE); | 746 GTK_STATE_ACTIVE); |
744 overflow_menu_->PopupAsFromKeyEvent(overflow); | 747 overflow_menu_->PopupAsFromKeyEvent(overflow); |
745 | 748 |
746 return FALSE; | 749 return FALSE; |
747 } | 750 } |
OLD | NEW |