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

Side by Side Diff: chrome/browser/extensions/extension_toolbar_model.cc

Issue 8789018: Revert 113047 - Make ExtensionService use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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
Property Changes:
Added: svn:mergeinfo
OLDNEW
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/extensions/extension_toolbar_model.h" 5 #include "chrome/browser/extensions/extension_toolbar_model.h"
6 6
7 #include "chrome/browser/extensions/extension_prefs.h" 7 #include "chrome/browser/extensions/extension_prefs.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 std::vector<std::string> pref_order = service_->extension_prefs()-> 175 std::vector<std::string> pref_order = service_->extension_prefs()->
176 GetToolbarOrder(); 176 GetToolbarOrder();
177 // Items that have a pref for their position. 177 // Items that have a pref for their position.
178 ExtensionList sorted; 178 ExtensionList sorted;
179 sorted.resize(pref_order.size(), NULL); 179 sorted.resize(pref_order.size(), NULL);
180 // The items that don't have a pref for their position. 180 // The items that don't have a pref for their position.
181 ExtensionList unsorted; 181 ExtensionList unsorted;
182 182
183 // Create the lists. 183 // Create the lists.
184 for (ExtensionSet::const_iterator it = service_->extensions()->begin(); 184 for (size_t i = 0; i < service_->extensions()->size(); ++i) {
185 it != service_->extensions()->end(); ++it) { 185 const Extension* extension = service_->extensions()->at(i);
186 const Extension* extension = *it;
187 if (!extension->browser_action()) 186 if (!extension->browser_action())
188 continue; 187 continue;
189 if (!service_->GetBrowserActionVisibility(extension)) 188 if (!service_->GetBrowserActionVisibility(extension))
190 continue; 189 continue;
191 190
192 std::vector<std::string>::iterator pos = 191 std::vector<std::string>::iterator pos =
193 std::find(pref_order.begin(), pref_order.end(), extension->id()); 192 std::find(pref_order.begin(), pref_order.end(), extension->id());
194 if (pos != pref_order.end()) { 193 if (pos != pref_order.end()) {
195 int index = std::distance(pref_order.begin(), pos); 194 int index = std::distance(pref_order.begin(), pos);
196 sorted[index] = extension; 195 sorted[index] = extension;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 int incognito_index = 0, i = 0; 251 int incognito_index = 0, i = 0;
253 for (ExtensionList::iterator iter = begin(); iter != end(); 252 for (ExtensionList::iterator iter = begin(); iter != end();
254 ++iter, ++i) { 253 ++iter, ++i) {
255 if (original_index == i) 254 if (original_index == i)
256 break; 255 break;
257 if (service_->IsIncognitoEnabled((*iter)->id())) 256 if (service_->IsIncognitoEnabled((*iter)->id()))
258 ++incognito_index; 257 ++incognito_index;
259 } 258 }
260 return incognito_index; 259 return incognito_index;
261 } 260 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tab_helper.cc ('k') | chrome/browser/extensions/extension_tts_engine_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698