OLD | NEW |
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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 size_t new_index) { | 827 size_t new_index) { |
828 ExtensionService* service = profile_->GetExtensionService(); | 828 ExtensionService* service = profile_->GetExtensionService(); |
829 if (service) { | 829 if (service) { |
830 const Extension* extension = service->GetExtensionById(extension_id, false); | 830 const Extension* extension = service->GetExtensionById(extension_id, false); |
831 model_->MoveBrowserAction(extension, new_index); | 831 model_->MoveBrowserAction(extension, new_index); |
832 SchedulePaint(); | 832 SchedulePaint(); |
833 } | 833 } |
834 } | 834 } |
835 | 835 |
836 void BrowserActionsContainer::HidePopup() { | 836 void BrowserActionsContainer::HidePopup() { |
| 837 // Remove this as an observer and clear |popup_| and |popup_button_| here, |
| 838 // since we might change them before OnWidgetClosing() gets called. |
837 if (popup_) { | 839 if (popup_) { |
| 840 popup_->GetWidget()->RemoveObserver(this); |
838 popup_->GetWidget()->Close(); | 841 popup_->GetWidget()->Close(); |
839 // NULL out popup_button_ in case it's being deleted. | 842 popup_ = NULL; |
| 843 } |
| 844 if (popup_button_) { |
| 845 popup_button_->SetButtonNotPushed(); |
840 popup_button_ = NULL; | 846 popup_button_ = NULL; |
841 } | 847 } |
842 } | 848 } |
843 | 849 |
844 void BrowserActionsContainer::TestExecuteBrowserAction(int index) { | 850 void BrowserActionsContainer::TestExecuteBrowserAction(int index) { |
845 BrowserActionButton* button = browser_action_views_[index]->button(); | 851 BrowserActionButton* button = browser_action_views_[index]->button(); |
846 OnBrowserActionExecuted(button, false); | 852 OnBrowserActionExecuted(button, false); |
847 } | 853 } |
848 | 854 |
849 void BrowserActionsContainer::TestSetIconVisibilityCount(size_t icons) { | 855 void BrowserActionsContainer::TestSetIconVisibilityCount(size_t icons) { |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 } | 1126 } |
1121 } | 1127 } |
1122 | 1128 |
1123 bool BrowserActionsContainer::ShouldDisplayBrowserAction( | 1129 bool BrowserActionsContainer::ShouldDisplayBrowserAction( |
1124 const Extension* extension) { | 1130 const Extension* extension) { |
1125 // Only display incognito-enabled extensions while in incognito mode. | 1131 // Only display incognito-enabled extensions while in incognito mode. |
1126 return | 1132 return |
1127 (!profile_->IsOffTheRecord() || | 1133 (!profile_->IsOffTheRecord() || |
1128 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); | 1134 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); |
1129 } | 1135 } |
OLD | NEW |