OLD | NEW |
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 Loading... |
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 |
| 255 // component extensions so just ignore the request. |
| 256 if (extension()->location() == Extension::COMPONENT) |
| 257 return; |
| 258 |
254 showing_context_menu_ = true; | 259 showing_context_menu_ = true; |
255 SetButtonPushed(); | 260 SetButtonPushed(); |
256 | 261 |
257 // Reconstructs the menu every time because the menu's contents are dynamic. | 262 // Reconstructs the menu every time because the menu's contents are dynamic. |
258 context_menu_contents_ = | 263 context_menu_contents_ = |
259 new ExtensionContextMenuModel(extension(), panel_->browser(), panel_); | 264 new ExtensionContextMenuModel(extension(), panel_->browser(), panel_); |
260 context_menu_menu_.reset(new views::Menu2(context_menu_contents_.get())); | 265 context_menu_menu_.reset(new views::Menu2(context_menu_contents_.get())); |
261 context_menu_menu_->RunContextMenuAt(p); | 266 context_menu_menu_->RunContextMenuAt(p); |
262 | 267 |
263 SetButtonNotPushed(); | 268 SetButtonNotPushed(); |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 AnimationEnded(resize_animation_.get()); | 1099 AnimationEnded(resize_animation_.get()); |
1095 } | 1100 } |
1096 } | 1101 } |
1097 | 1102 |
1098 bool BrowserActionsContainer::ShouldDisplayBrowserAction( | 1103 bool BrowserActionsContainer::ShouldDisplayBrowserAction( |
1099 const Extension* extension) { | 1104 const Extension* extension) { |
1100 // Only display incognito-enabled extensions while in incognito mode. | 1105 // Only display incognito-enabled extensions while in incognito mode. |
1101 return (!profile_->IsOffTheRecord() || | 1106 return (!profile_->IsOffTheRecord() || |
1102 profile_->GetExtensionService()->IsIncognitoEnabled(extension)); | 1107 profile_->GetExtensionService()->IsIncognitoEnabled(extension)); |
1103 } | 1108 } |
OLD | NEW |