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

Side by Side Diff: chrome/browser/sync/test/integration/sync_app_helper.cc

Issue 9706017: Remove Ordinals Setters and Getters from ExtensionService (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 months 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
OLDNEW
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/sync/test/integration/sync_app_helper.h" 5 #include "chrome/browser/sync/test/integration/sync_app_helper.h"
6 6
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_sorting.h" 8 #include "chrome/browser/extensions/extension_sorting.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sync/test/integration/extensions_helper.h" 10 #include "chrome/browser/sync/test/integration/extensions_helper.h"
(...skipping 25 matching lines...) Expand all
36 36
37 bool AppState::Equals(const AppState& other) const { 37 bool AppState::Equals(const AppState& other) const {
38 return app_launch_ordinal.Equal(other.app_launch_ordinal) && 38 return app_launch_ordinal.Equal(other.app_launch_ordinal) &&
39 page_ordinal.Equal(other.page_ordinal); 39 page_ordinal.Equal(other.page_ordinal);
40 } 40 }
41 41
42 // Load all the app specific values for |id| into |app_state|. 42 // Load all the app specific values for |id| into |app_state|.
43 void LoadApp(ExtensionService* extension_service, 43 void LoadApp(ExtensionService* extension_service,
44 const std::string& id, 44 const std::string& id,
45 AppState* app_state) { 45 AppState* app_state) {
46 app_state->app_launch_ordinal = extension_service->GetAppLaunchOrdinal(id); 46 app_state->app_launch_ordinal = extension_service->extension_prefs()->
47 app_state->page_ordinal = extension_service->GetPageOrdinal(id); 47 extension_sorting()->GetAppLaunchOrdinal(id);
48 app_state->page_ordinal = extension_service->extension_prefs()->
49 extension_sorting()->GetPageOrdinal(id);
48 } 50 }
49 51
50 // Returns a map from |profile|'s installed extensions to their state. 52 // Returns a map from |profile|'s installed extensions to their state.
51 AppStateMap GetAppStates(Profile* profile) { 53 AppStateMap GetAppStates(Profile* profile) {
52 AppStateMap app_state_map; 54 AppStateMap app_state_map;
53 55
54 ExtensionService* extension_service = profile->GetExtensionService(); 56 ExtensionService* extension_service = profile->GetExtensionService();
55 57
56 scoped_ptr<const ExtensionSet> extensions( 58 scoped_ptr<const ExtensionSet> extensions(
57 extension_service->GenerateInstalledExtensionsSet()); 59 extension_service->GenerateInstalledExtensionsSet());
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 134 }
133 ++it1; 135 ++it1;
134 ++it2; 136 ++it2;
135 } 137 }
136 138
137 return true; 139 return true;
138 } 140 }
139 141
140 StringOrdinal SyncAppHelper::GetPageOrdinalForApp(Profile* profile, 142 StringOrdinal SyncAppHelper::GetPageOrdinalForApp(Profile* profile,
141 const std::string& name) { 143 const std::string& name) {
142 return profile->GetExtensionService()->GetPageOrdinal( 144 return profile->GetExtensionService()->extension_prefs()->
143 SyncExtensionHelper::NameToId(name)); 145 extension_sorting()->GetPageOrdinal(SyncExtensionHelper::NameToId(name));
144 } 146 }
145 147
146 void SyncAppHelper::SetPageOrdinalForApp(Profile* profile, 148 void SyncAppHelper::SetPageOrdinalForApp(Profile* profile,
147 const std::string& name, 149 const std::string& name,
148 const StringOrdinal& page_ordinal) { 150 const StringOrdinal& page_ordinal) {
149 profile->GetExtensionService()->SetPageOrdinal( 151 profile->GetExtensionService()->extension_prefs()->extension_sorting()->
150 SyncExtensionHelper::NameToId(name), page_ordinal); 152 SetPageOrdinal(SyncExtensionHelper::NameToId(name), page_ordinal);
151 } 153 }
152 154
153 StringOrdinal SyncAppHelper::GetAppLaunchOrdinalForApp( 155 StringOrdinal SyncAppHelper::GetAppLaunchOrdinalForApp(
154 Profile* profile, 156 Profile* profile,
155 const std::string& name) { 157 const std::string& name) {
156 return profile->GetExtensionService()->GetAppLaunchOrdinal( 158 return profile->GetExtensionService()->extension_prefs()->
157 SyncExtensionHelper::NameToId(name)); 159 extension_sorting()->GetAppLaunchOrdinal(
160 SyncExtensionHelper::NameToId(name));
158 } 161 }
159 162
160 void SyncAppHelper::SetAppLaunchOrdinalForApp( 163 void SyncAppHelper::SetAppLaunchOrdinalForApp(
161 Profile* profile, 164 Profile* profile,
162 const std::string& name, 165 const std::string& name,
163 const StringOrdinal& app_launch_ordinal) { 166 const StringOrdinal& app_launch_ordinal) {
164 profile->GetExtensionService()->SetAppLaunchOrdinal( 167 profile->GetExtensionService()->extension_prefs()->extension_sorting()->
165 SyncExtensionHelper::NameToId(name), 168 SetAppLaunchOrdinal(SyncExtensionHelper::NameToId(name),
166 app_launch_ordinal); 169 app_launch_ordinal);
167 } 170 }
168 171
169 void SyncAppHelper::FixNTPOrdinalCollisions(Profile* profile) { 172 void SyncAppHelper::FixNTPOrdinalCollisions(Profile* profile) {
170 profile->GetExtensionService()->extension_prefs()-> 173 profile->GetExtensionService()->extension_prefs()->extension_sorting()->
171 extension_sorting()->FixNTPOrdinalCollisions(); 174 FixNTPOrdinalCollisions();
172 } 175 }
173 176
174 SyncAppHelper::SyncAppHelper() : setup_completed_(false) {} 177 SyncAppHelper::SyncAppHelper() : setup_completed_(false) {}
175 178
176 SyncAppHelper::~SyncAppHelper() {} 179 SyncAppHelper::~SyncAppHelper() {}
OLDNEW
« no previous file with comments | « chrome/browser/extensions/test_extension_service.cc ('k') | chrome/browser/sync/test/integration/two_client_apps_sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698