| 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 } | 476 } |
| 477 | 477 |
| 478 void BrowserActionsContainer::OnBrowserActionExecuted( | 478 void BrowserActionsContainer::OnBrowserActionExecuted( |
| 479 BrowserActionButton* button, | 479 BrowserActionButton* button, |
| 480 bool inspect_with_devtools) { | 480 bool inspect_with_devtools) { |
| 481 ExtensionAction* browser_action = button->browser_action(); | 481 ExtensionAction* browser_action = button->browser_action(); |
| 482 | 482 |
| 483 // Popups just display. No notification to the extension. | 483 // Popups just display. No notification to the extension. |
| 484 // TODO(erikkay): should there be? | 484 // TODO(erikkay): should there be? |
| 485 if (!button->IsPopup()) { | 485 if (!button->IsPopup()) { |
| 486 ExtensionBrowserEventRouter::GetInstance()->BrowserActionExecuted( | 486 ExtensionService* service = profile_->GetExtensionService(); |
| 487 service->browser_event_router()->BrowserActionExecuted( |
| 487 profile_, browser_action->extension_id(), browser_); | 488 profile_, browser_action->extension_id(), browser_); |
| 488 return; | 489 return; |
| 489 } | 490 } |
| 490 | 491 |
| 491 // If we're showing the same popup, just hide it and return. | 492 // If we're showing the same popup, just hide it and return. |
| 492 bool same_showing = popup_ && button == popup_button_; | 493 bool same_showing = popup_ && button == popup_button_; |
| 493 | 494 |
| 494 // Always hide the current popup, even if it's not the same. | 495 // Always hide the current popup, even if it's not the same. |
| 495 // Only one popup should be visible at a time. | 496 // Only one popup should be visible at a time. |
| 496 HidePopup(); | 497 HidePopup(); |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 AnimationEnded(resize_animation_.get()); | 1094 AnimationEnded(resize_animation_.get()); |
| 1094 } | 1095 } |
| 1095 } | 1096 } |
| 1096 | 1097 |
| 1097 bool BrowserActionsContainer::ShouldDisplayBrowserAction( | 1098 bool BrowserActionsContainer::ShouldDisplayBrowserAction( |
| 1098 const Extension* extension) { | 1099 const Extension* extension) { |
| 1099 // Only display incognito-enabled extensions while in incognito mode. | 1100 // Only display incognito-enabled extensions while in incognito mode. |
| 1100 return (!profile_->IsOffTheRecord() || | 1101 return (!profile_->IsOffTheRecord() || |
| 1101 profile_->GetExtensionService()->IsIncognitoEnabled(extension)); | 1102 profile_->GetExtensionService()->IsIncognitoEnabled(extension)); |
| 1102 } | 1103 } |
| OLD | NEW |