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

Side by Side Diff: chrome/browser/ui/views/location_bar/page_action_image_view.cc

Issue 9968076: Remove Inspect Popup command from browser actions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Views compile failure 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
« no previous file with comments | « chrome/browser/ui/views/location_bar/page_action_image_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/views/location_bar/page_action_image_view.h" 5 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_browser_event_router.h" 8 #include "chrome/browser/extensions/extension_browser_event_router.h"
9 #include "chrome/browser/extensions/extension_context_menu_model.h"
9 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_tab_util.h" 11 #include "chrome/browser/extensions/extension_tab_util.h"
11 #include "chrome/browser/platform_util.h" 12 #include "chrome/browser/platform_util.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser_list.h" 14 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/views/frame/browser_view.h" 15 #include "chrome/browser/ui/views/frame/browser_view.h"
15 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 16 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
16 #include "chrome/common/chrome_notification_types.h" 17 #include "chrome/common/chrome_notification_types.h"
17 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/extension.h"
18 #include "chrome/common/extensions/extension_action.h" 19 #include "chrome/common/extensions/extension_action.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 155 }
155 156
156 void PageActionImageView::ShowContextMenu(const gfx::Point& p, 157 void PageActionImageView::ShowContextMenu(const gfx::Point& p,
157 bool is_mouse_gesture) { 158 bool is_mouse_gesture) {
158 const Extension* extension = owner_->profile()->GetExtensionService()-> 159 const Extension* extension = owner_->profile()->GetExtensionService()->
159 GetExtensionById(page_action()->extension_id(), false); 160 GetExtensionById(page_action()->extension_id(), false);
160 if (!extension->ShowConfigureContextMenus()) 161 if (!extension->ShowConfigureContextMenus())
161 return; 162 return;
162 163
163 scoped_refptr<ExtensionContextMenuModel> context_menu_model( 164 scoped_refptr<ExtensionContextMenuModel> context_menu_model(
164 new ExtensionContextMenuModel(extension, browser_, this)); 165 new ExtensionContextMenuModel(extension, browser_));
165 views::MenuModelAdapter menu_model_adapter(context_menu_model.get()); 166 views::MenuModelAdapter menu_model_adapter(context_menu_model.get());
166 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu())); 167 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu()));
167 gfx::Point screen_loc; 168 gfx::Point screen_loc;
168 views::View::ConvertPointToScreen(this, &screen_loc); 169 views::View::ConvertPointToScreen(this, &screen_loc);
169 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(screen_loc, size()), 170 if (menu_runner_->RunMenuAt(GetWidget(), NULL, gfx::Rect(screen_loc, size()),
170 views::MenuItemView::TOPLEFT, views::MenuRunner::HAS_MNEMONICS) == 171 views::MenuItemView::TOPLEFT, views::MenuRunner::HAS_MNEMONICS) ==
171 views::MenuRunner::MENU_DELETED) 172 views::MenuRunner::MENU_DELETED)
172 return; 173 return;
173 } 174 }
174 175
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 if (iter != page_action_icons_.end()) 252 if (iter != page_action_icons_.end())
252 icon = iter->second; 253 icon = iter->second;
253 } 254 }
254 } 255 }
255 if (!icon.isNull()) 256 if (!icon.isNull())
256 SetImage(&icon); 257 SetImage(&icon);
257 258
258 SetVisible(true); 259 SetVisible(true);
259 } 260 }
260 261
261 void PageActionImageView::InspectPopup(ExtensionAction* action) {
262 ExecuteAction(1, // Left-click.
263 true); // |inspect_with_devtools|.
264 }
265
266 void PageActionImageView::OnWidgetClosing(views::Widget* widget) { 262 void PageActionImageView::OnWidgetClosing(views::Widget* widget) {
267 DCHECK_EQ(popup_->GetWidget(), widget); 263 DCHECK_EQ(popup_->GetWidget(), widget);
268 popup_->GetWidget()->RemoveObserver(this); 264 popup_->GetWidget()->RemoveObserver(this);
269 popup_ = NULL; 265 popup_ = NULL;
270 } 266 }
271 267
272 void PageActionImageView::Observe(int type, 268 void PageActionImageView::Observe(int type,
273 const content::NotificationSource& source, 269 const content::NotificationSource& source,
274 const content::NotificationDetails& details) { 270 const content::NotificationDetails& details) {
275 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type); 271 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type);
276 const Extension* unloaded_extension = 272 const Extension* unloaded_extension =
277 content::Details<UnloadedExtensionInfo>(details)->extension; 273 content::Details<UnloadedExtensionInfo>(details)->extension;
278 if (page_action_ == unloaded_extension ->page_action()) 274 if (page_action_ == unloaded_extension ->page_action())
279 owner_->UpdatePageActions(); 275 owner_->UpdatePageActions();
280 } 276 }
281 277
282 void PageActionImageView::HidePopup() { 278 void PageActionImageView::HidePopup() {
283 if (popup_) 279 if (popup_)
284 popup_->GetWidget()->Close(); 280 popup_->GetWidget()->Close();
285 } 281 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/page_action_image_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698