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

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

Issue 1001002: Initial support for inspecting extension popups. (Closed)
Patch Set: pre submit Created 10 years, 9 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) 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/location_bar_view_gtk.h" 5 #include "chrome/browser/gtk/location_bar_view_gtk.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/gfx/canvas_paint.h" 9 #include "app/gfx/canvas_paint.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 page_action_->extension_id(), 1210 page_action_->extension_id(),
1211 page_action_->id(), 1211 page_action_->id(),
1212 current_tab_id_, 1212 current_tab_id_,
1213 current_url_.spec(), 1213 current_url_.spec(),
1214 event->button.button); 1214 event->button.button);
1215 } 1215 }
1216 } else { 1216 } else {
1217 Extension* extension = profile_->GetExtensionsService()->GetExtensionById( 1217 Extension* extension = profile_->GetExtensionsService()->GetExtensionById(
1218 page_action()->extension_id(), false); 1218 page_action()->extension_id(), false);
1219 1219
1220 // TODO(rafaelw): support inspecting popups.
1220 if (!context_menu_model_.get()) 1221 if (!context_menu_model_.get())
1221 context_menu_model_.reset(new ExtensionActionContextMenuModel(extension)); 1222 context_menu_model_.reset(new ExtensionActionContextMenuModel(extension,
1223 page_action_, profile_->GetPrefs(), NULL));
1222 1224
1223 context_menu_.reset( 1225 context_menu_.reset(
1224 new MenuGtk(NULL, context_menu_model_.get())); 1226 new MenuGtk(NULL, context_menu_model_.get()));
1225 context_menu_->Popup(sender, event); 1227 context_menu_->Popup(sender, event);
1226 } 1228 }
1227 1229
1228 return TRUE; 1230 return TRUE;
1229 } 1231 }
1230 1232
1231 gboolean LocationBarViewGtk::PageActionViewGtk::OnExposeEvent( 1233 gboolean LocationBarViewGtk::PageActionViewGtk::OnExposeEvent(
1232 GtkWidget* widget, GdkEventExpose* event) { 1234 GtkWidget* widget, GdkEventExpose* event) {
1233 TabContents* contents = owner_->GetTabContents(); 1235 TabContents* contents = owner_->GetTabContents();
1234 if (!contents) 1236 if (!contents)
1235 return FALSE; 1237 return FALSE;
1236 1238
1237 int tab_id = ExtensionTabUtil::GetTabId(contents); 1239 int tab_id = ExtensionTabUtil::GetTabId(contents);
1238 if (tab_id < 0) 1240 if (tab_id < 0)
1239 return FALSE; 1241 return FALSE;
1240 1242
1241 std::string badge_text = page_action_->GetBadgeText(tab_id); 1243 std::string badge_text = page_action_->GetBadgeText(tab_id);
1242 if (badge_text.empty()) 1244 if (badge_text.empty())
1243 return FALSE; 1245 return FALSE;
1244 1246
1245 gfx::CanvasPaint canvas(event, false); 1247 gfx::CanvasPaint canvas(event, false);
1246 gfx::Rect bounding_rect(widget->allocation); 1248 gfx::Rect bounding_rect(widget->allocation);
1247 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); 1249 page_action_->PaintBadge(&canvas, bounding_rect, tab_id);
1248 return FALSE; 1250 return FALSE;
1249 } 1251 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/browser_actions_toolbar_gtk.cc ('k') | chrome/browser/views/browser_actions_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698