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

Side by Side Diff: chrome/browser/ui/views/browser_actions_container.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/views/browser_actions_container.h" 5 #include "chrome/browser/ui/views/browser_actions_container.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 void BrowserActionButton::ShowContextMenu(const gfx::Point& p, 266 void BrowserActionButton::ShowContextMenu(const gfx::Point& p,
267 bool is_mouse_gesture) { 267 bool is_mouse_gesture) {
268 if (!extension()->ShowConfigureContextMenus()) 268 if (!extension()->ShowConfigureContextMenus())
269 return; 269 return;
270 270
271 SetButtonPushed(); 271 SetButtonPushed();
272 272
273 // Reconstructs the menu every time because the menu's contents are dynamic. 273 // Reconstructs the menu every time because the menu's contents are dynamic.
274 scoped_refptr<ExtensionContextMenuModel> context_menu_contents_( 274 scoped_refptr<ExtensionContextMenuModel> context_menu_contents_(
275 new ExtensionContextMenuModel(extension(), panel_->browser(), panel_)); 275 new ExtensionContextMenuModel(extension(), panel_->browser()));
276 views::MenuModelAdapter menu_model_adapter(context_menu_contents_.get()); 276 views::MenuModelAdapter menu_model_adapter(context_menu_contents_.get());
277 views::MenuRunner menu_runner(menu_model_adapter.CreateMenu()); 277 views::MenuRunner menu_runner(menu_model_adapter.CreateMenu());
278 278
279 context_menu_ = menu_runner.GetMenu(); 279 context_menu_ = menu_runner.GetMenu();
280 gfx::Point screen_loc; 280 gfx::Point screen_loc;
281 views::View::ConvertPointToScreen(this, &screen_loc); 281 views::View::ConvertPointToScreen(this, &screen_loc);
282 if (menu_runner.RunMenuAt(GetWidget(), NULL, gfx::Rect(screen_loc, size()), 282 if (menu_runner.RunMenuAt(GetWidget(), NULL, gfx::Rect(screen_loc, size()),
283 views::MenuItemView::TOPLEFT, views::MenuRunner::HAS_MNEMONICS) == 283 views::MenuItemView::TOPLEFT, views::MenuRunner::HAS_MNEMONICS) ==
284 views::MenuRunner::MENU_DELETED) 284 views::MenuRunner::MENU_DELETED)
285 return; 285 return;
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 OnBrowserActionVisibilityChanged(); 801 OnBrowserActionVisibilityChanged();
802 suppress_chevron_ = false; 802 suppress_chevron_ = false;
803 } 803 }
804 804
805 void BrowserActionsContainer::NotifyMenuDeleted( 805 void BrowserActionsContainer::NotifyMenuDeleted(
806 BrowserActionOverflowMenuController* controller) { 806 BrowserActionOverflowMenuController* controller) {
807 DCHECK(controller == overflow_menu_); 807 DCHECK(controller == overflow_menu_);
808 overflow_menu_ = NULL; 808 overflow_menu_ = NULL;
809 } 809 }
810 810
811 void BrowserActionsContainer::InspectPopup(ExtensionAction* action) {
812 OnBrowserActionExecuted(GetBrowserActionView(action)->button(), true);
813 }
814
815 void BrowserActionsContainer::OnWidgetClosing(views::Widget* widget) { 811 void BrowserActionsContainer::OnWidgetClosing(views::Widget* widget) {
816 DCHECK_EQ(popup_->GetWidget(), widget); 812 DCHECK_EQ(popup_->GetWidget(), widget);
817 popup_->GetWidget()->RemoveObserver(this); 813 popup_->GetWidget()->RemoveObserver(this);
818 popup_ = NULL; 814 popup_ = NULL;
819 // |popup_button_| is NULL if the extension has been removed. 815 // |popup_button_| is NULL if the extension has been removed.
820 if (popup_button_) { 816 if (popup_button_) {
821 popup_button_->SetButtonNotPushed(); 817 popup_button_->SetButtonNotPushed();
822 popup_button_ = NULL; 818 popup_button_ = NULL;
823 } 819 }
824 } 820 }
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 } 1122 }
1127 } 1123 }
1128 1124
1129 bool BrowserActionsContainer::ShouldDisplayBrowserAction( 1125 bool BrowserActionsContainer::ShouldDisplayBrowserAction(
1130 const Extension* extension) { 1126 const Extension* extension) {
1131 // Only display incognito-enabled extensions while in incognito mode. 1127 // Only display incognito-enabled extensions while in incognito mode.
1132 return 1128 return
1133 (!profile_->IsOffTheRecord() || 1129 (!profile_->IsOffTheRecord() ||
1134 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); 1130 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id()));
1135 } 1131 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698