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

Side by Side Diff: chrome/browser/ui/views/browser_actions_container.cc

Issue 6354021: Disable context menu for page_action and infobars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gtk version fixed Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/stl_util-inl.h" 7 #include "base/stl_util-inl.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/browser_window.h" 10 #include "chrome/browser/browser_window.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 void BrowserActionButton::OnMouseExited(const views::MouseEvent& e) { 245 void BrowserActionButton::OnMouseExited(const views::MouseEvent& e) {
246 if (IsPopup() || showing_context_menu_) 246 if (IsPopup() || showing_context_menu_)
247 MenuButton::OnMouseExited(e); 247 MenuButton::OnMouseExited(e);
248 else 248 else
249 TextButton::OnMouseExited(e); 249 TextButton::OnMouseExited(e);
250 } 250 }
251 251
252 void BrowserActionButton::ShowContextMenu(const gfx::Point& p, 252 void BrowserActionButton::ShowContextMenu(const gfx::Point& p,
253 bool is_mouse_gesture) { 253 bool is_mouse_gesture) {
254 // There is nothing in context menu that has sense to show for 254 if (!extension()->ShowConfigureContextMenus())
255 // component extensions so just ignore the request.
256 if (extension()->location() == Extension::COMPONENT)
257 return; 255 return;
258 256
259 showing_context_menu_ = true; 257 showing_context_menu_ = true;
260 SetButtonPushed(); 258 SetButtonPushed();
261 259
262 // Reconstructs the menu every time because the menu's contents are dynamic. 260 // Reconstructs the menu every time because the menu's contents are dynamic.
263 context_menu_contents_ = 261 context_menu_contents_ =
264 new ExtensionContextMenuModel(extension(), panel_->browser(), panel_); 262 new ExtensionContextMenuModel(extension(), panel_->browser(), panel_);
265 context_menu_menu_.reset(new views::Menu2(context_menu_contents_.get())); 263 context_menu_menu_.reset(new views::Menu2(context_menu_contents_.get()));
266 context_menu_menu_->RunContextMenuAt(p); 264 context_menu_menu_->RunContextMenuAt(p);
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 AnimationEnded(resize_animation_.get()); 1097 AnimationEnded(resize_animation_.get());
1100 } 1098 }
1101 } 1099 }
1102 1100
1103 bool BrowserActionsContainer::ShouldDisplayBrowserAction( 1101 bool BrowserActionsContainer::ShouldDisplayBrowserAction(
1104 const Extension* extension) { 1102 const Extension* extension) {
1105 // Only display incognito-enabled extensions while in incognito mode. 1103 // Only display incognito-enabled extensions while in incognito mode.
1106 return (!profile_->IsOffTheRecord() || 1104 return (!profile_->IsOffTheRecord() ||
1107 profile_->GetExtensionService()->IsIncognitoEnabled(extension)); 1105 profile_->GetExtensionService()->IsIncognitoEnabled(extension));
1108 } 1106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698