OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/toolbar/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 StopShowFolderDropMenuTimer(); | 188 StopShowFolderDropMenuTimer(); |
189 HideActivePopup(); | 189 HideActivePopup(); |
190 DeleteBrowserActionViews(); | 190 DeleteBrowserActionViews(); |
191 } | 191 } |
192 | 192 |
193 void BrowserActionsContainer::Init() { | 193 void BrowserActionsContainer::Init() { |
194 LoadImages(); | 194 LoadImages(); |
195 | 195 |
196 // We wait to set the container width until now so that the chevron images | 196 // We wait to set the container width until now so that the chevron images |
197 // will be loaded. The width calculation needs to know the chevron size. | 197 // will be loaded. The width calculation needs to know the chevron size. |
198 if (model_ && | |
199 !profile_->GetPrefs()->HasPrefPath( | |
200 extensions::pref_names::kToolbarSize)) { | |
201 // Migration code to the new VisibleIconCount pref. | |
202 // TODO(mpcomplete): remove this after users are upgraded to 5.0. | |
203 int predefined_width = profile_->GetPrefs()->GetInteger( | |
204 extensions::pref_names::kBrowserActionContainerWidth); | |
205 if (predefined_width != 0) | |
206 model_->SetVisibleIconCount(WidthToIconCount(predefined_width)); | |
207 } | |
Peter Kasting
2014/08/12 19:04:49
Same comment.
Devlin
2014/08/12 19:18:19
Done.
| |
208 if (model_ && model_->extensions_initialized()) | 198 if (model_ && model_->extensions_initialized()) |
209 SetContainerWidth(); | 199 SetContainerWidth(); |
210 } | 200 } |
211 | 201 |
212 BrowserActionView* BrowserActionsContainer::GetBrowserActionView( | 202 BrowserActionView* BrowserActionsContainer::GetBrowserActionView( |
213 ExtensionAction* action) { | 203 ExtensionAction* action) { |
214 for (BrowserActionViews::iterator i(browser_action_views_.begin()); | 204 for (BrowserActionViews::iterator i(browser_action_views_.begin()); |
215 i != browser_action_views_.end(); ++i) { | 205 i != browser_action_views_.end(); ++i) { |
216 if ((*i)->button()->extension_action() == action) | 206 if ((*i)->button()->extension_action() == action) |
217 return *i; | 207 return *i; |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1045 | 1035 |
1046 for (BrowserActionViews::iterator iter = browser_action_views_.begin(); | 1036 for (BrowserActionViews::iterator iter = browser_action_views_.begin(); |
1047 iter != browser_action_views_.end(); ++iter) { | 1037 iter != browser_action_views_.end(); ++iter) { |
1048 BrowserActionButton* button = (*iter)->button(); | 1038 BrowserActionButton* button = (*iter)->button(); |
1049 if (button->extension() == extension) | 1039 if (button->extension() == extension) |
1050 return button->view_controller()->ExecuteAction( | 1040 return button->view_controller()->ExecuteAction( |
1051 ExtensionPopup::SHOW, grant_tab_permissions); | 1041 ExtensionPopup::SHOW, grant_tab_permissions); |
1052 } | 1042 } |
1053 return false; | 1043 return false; |
1054 } | 1044 } |
OLD | NEW |