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

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

Issue 8733004: 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
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 (size_t i = 0; i < service_->extensions()->size(); ++i) { 184 for (ExtensionSet::const_iterator it = service_->extensions()->begin();
185 const Extension* extension = service_->extensions()->at(i); 185 it != service_->extensions()->end(); ++it) {
186 const Extension* extension = *it;
186 if (!extension->browser_action()) 187 if (!extension->browser_action())
187 continue; 188 continue;
188 if (!service_->GetBrowserActionVisibility(extension)) 189 if (!service_->GetBrowserActionVisibility(extension))
189 continue; 190 continue;
190 191
191 std::vector<std::string>::iterator pos = 192 std::vector<std::string>::iterator pos =
192 std::find(pref_order.begin(), pref_order.end(), extension->id()); 193 std::find(pref_order.begin(), pref_order.end(), extension->id());
193 if (pos != pref_order.end()) { 194 if (pos != pref_order.end()) {
194 int index = std::distance(pref_order.begin(), pos); 195 int index = std::distance(pref_order.begin(), pos);
195 sorted[index] = extension; 196 sorted[index] = extension;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 int incognito_index = 0, i = 0; 252 int incognito_index = 0, i = 0;
252 for (ExtensionList::iterator iter = begin(); iter != end(); 253 for (ExtensionList::iterator iter = begin(); iter != end();
253 ++iter, ++i) { 254 ++iter, ++i) {
254 if (original_index == i) 255 if (original_index == i)
255 break; 256 break;
256 if (service_->IsIncognitoEnabled((*iter)->id())) 257 if (service_->IsIncognitoEnabled((*iter)->id()))
257 ++incognito_index; 258 ++incognito_index;
258 } 259 }
259 return incognito_index; 260 return incognito_index;
260 } 261 }
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