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

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

Issue 4132005: Kill Extension::RuntimeData and move its guts to ExtensionsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops Created 10 years, 1 month 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
« no previous file with comments | « chrome/browser/extensions/extensions_service.cc ('k') | chrome/common/extensions/extension.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/browser_actions_container.h" 5 #include "chrome/browser/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 "app/slide_animation.h" 9 #include "app/slide_animation.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 BrowserActionView* view = new BrowserActionView(extension, this); 908 BrowserActionView* view = new BrowserActionView(extension, this);
909 browser_action_views_.insert(browser_action_views_.begin() + index, view); 909 browser_action_views_.insert(browser_action_views_.begin() + index, view);
910 AddChildView(index, view); 910 AddChildView(index, view);
911 911
912 // If we are still initializing the container, don't bother animating. 912 // If we are still initializing the container, don't bother animating.
913 if (!model_->extensions_initialized()) 913 if (!model_->extensions_initialized())
914 return; 914 return;
915 915
916 // Enlarge the container if it was already at maximum size and we're not in 916 // Enlarge the container if it was already at maximum size and we're not in
917 // the middle of upgrading. 917 // the middle of upgrading.
918 if ((model_->GetVisibleIconCount() < 0) && !extension->being_upgraded()) { 918 if ((model_->GetVisibleIconCount() < 0) &&
919 !profile_->GetExtensionsService()->IsBeingUpgraded(extension)) {
919 suppress_chevron_ = true; 920 suppress_chevron_ = true;
920 SaveDesiredSizeAndAnimate(Tween::LINEAR, visible_actions + 1); 921 SaveDesiredSizeAndAnimate(Tween::LINEAR, visible_actions + 1);
921 } else { 922 } else {
922 // Just redraw the (possibly modified) visible icon set. 923 // Just redraw the (possibly modified) visible icon set.
923 OnBrowserActionVisibilityChanged(); 924 OnBrowserActionVisibilityChanged();
924 } 925 }
925 } 926 }
926 927
927 void BrowserActionsContainer::BrowserActionRemoved(const Extension* extension) { 928 void BrowserActionsContainer::BrowserActionRemoved(const Extension* extension) {
928 CloseOverflowMenu(); 929 CloseOverflowMenu();
929 930
930 if (popup_ && popup_->host()->extension() == extension) 931 if (popup_ && popup_->host()->extension() == extension)
931 HidePopup(); 932 HidePopup();
932 933
933 size_t visible_actions = VisibleBrowserActions(); 934 size_t visible_actions = VisibleBrowserActions();
934 for (BrowserActionViews::iterator iter = browser_action_views_.begin(); 935 for (BrowserActionViews::iterator iter = browser_action_views_.begin();
935 iter != browser_action_views_.end(); ++iter) { 936 iter != browser_action_views_.end(); ++iter) {
936 if ((*iter)->button()->extension() == extension) { 937 if ((*iter)->button()->extension() == extension) {
937 RemoveChildView(*iter); 938 RemoveChildView(*iter);
938 delete *iter; 939 delete *iter;
939 browser_action_views_.erase(iter); 940 browser_action_views_.erase(iter);
940 941
941 // If the extension is being upgraded we don't want the bar to shrink 942 // If the extension is being upgraded we don't want the bar to shrink
942 // because the icon is just going to get re-added to the same location. 943 // because the icon is just going to get re-added to the same location.
943 if (extension->being_upgraded()) 944 if (profile_->GetExtensionsService()->IsBeingUpgraded(extension))
944 return; 945 return;
945 946
946 if (browser_action_views_.size() > visible_actions) { 947 if (browser_action_views_.size() > visible_actions) {
947 // If we have more icons than we can show, then we must not be changing 948 // If we have more icons than we can show, then we must not be changing
948 // the container size (since we either removed an icon from the main 949 // the container size (since we either removed an icon from the main
949 // area and one from the overflow list will have shifted in, or we 950 // area and one from the overflow list will have shifted in, or we
950 // removed an entry directly from the overflow list). 951 // removed an entry directly from the overflow list).
951 OnBrowserActionVisibilityChanged(); 952 OnBrowserActionVisibilityChanged();
952 } else { 953 } else {
953 // Either we went from overflow to no-overflow, or we shrunk the no- 954 // Either we went from overflow to no-overflow, or we shrunk the no-
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 AnimationEnded(resize_animation_.get()); 1091 AnimationEnded(resize_animation_.get());
1091 } 1092 }
1092 } 1093 }
1093 1094
1094 bool BrowserActionsContainer::ShouldDisplayBrowserAction( 1095 bool BrowserActionsContainer::ShouldDisplayBrowserAction(
1095 const Extension* extension) { 1096 const Extension* extension) {
1096 // Only display incognito-enabled extensions while in incognito mode. 1097 // Only display incognito-enabled extensions while in incognito mode.
1097 return (!profile_->IsOffTheRecord() || 1098 return (!profile_->IsOffTheRecord() ||
1098 profile_->GetExtensionsService()->IsIncognitoEnabled(extension)); 1099 profile_->GetExtensionsService()->IsIncognitoEnabled(extension));
1099 } 1100 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_service.cc ('k') | chrome/common/extensions/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698