OLD | NEW |
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/launch_util.h" | 8 #include "chrome/browser/extensions/launch_util.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" |
11 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 11 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
12 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" | 12 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" |
13 #include "chrome/common/extensions/extension_constants.h" | 13 #include "chrome/common/extensions/extension_constants.h" |
14 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 14 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
15 #include "chrome/common/extensions/sync_helper.h" | 15 #include "chrome/common/extensions/sync_helper.h" |
| 16 #include "components/crx_file/id_util.h" |
16 #include "extensions/browser/app_sorting.h" | 17 #include "extensions/browser/app_sorting.h" |
17 #include "extensions/browser/extension_prefs.h" | 18 #include "extensions/browser/extension_prefs.h" |
18 #include "extensions/browser/extension_registry.h" | 19 #include "extensions/browser/extension_registry.h" |
19 #include "extensions/browser/extension_system.h" | 20 #include "extensions/browser/extension_system.h" |
20 #include "extensions/common/extension.h" | |
21 #include "extensions/common/extension_set.h" | 21 #include "extensions/common/extension_set.h" |
22 #include "extensions/common/id_util.h" | |
23 | 22 |
24 using extensions::ExtensionPrefs; | 23 using extensions::ExtensionPrefs; |
25 | 24 |
26 namespace { | 25 namespace { |
27 | 26 |
28 struct AppState { | 27 struct AppState { |
29 AppState(); | 28 AppState(); |
30 ~AppState(); | 29 ~AppState(); |
31 bool IsValid() const; | 30 bool IsValid() const; |
32 bool Equals(const AppState& other) const; | 31 bool Equals(const AppState& other) const; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 ++it2; | 166 ++it2; |
168 } | 167 } |
169 | 168 |
170 return true; | 169 return true; |
171 } | 170 } |
172 | 171 |
173 syncer::StringOrdinal SyncAppHelper::GetPageOrdinalForApp( | 172 syncer::StringOrdinal SyncAppHelper::GetPageOrdinalForApp( |
174 Profile* profile, | 173 Profile* profile, |
175 const std::string& name) { | 174 const std::string& name) { |
176 return ExtensionPrefs::Get(profile)->app_sorting()->GetPageOrdinal( | 175 return ExtensionPrefs::Get(profile)->app_sorting()->GetPageOrdinal( |
177 extensions::id_util::GenerateId(name)); | 176 crx_file::id_util::GenerateId(name)); |
178 } | 177 } |
179 | 178 |
180 void SyncAppHelper::SetPageOrdinalForApp( | 179 void SyncAppHelper::SetPageOrdinalForApp( |
181 Profile* profile, | 180 Profile* profile, |
182 const std::string& name, | 181 const std::string& name, |
183 const syncer::StringOrdinal& page_ordinal) { | 182 const syncer::StringOrdinal& page_ordinal) { |
184 ExtensionPrefs::Get(profile)->app_sorting()->SetPageOrdinal( | 183 ExtensionPrefs::Get(profile)->app_sorting()->SetPageOrdinal( |
185 extensions::id_util::GenerateId(name), page_ordinal); | 184 crx_file::id_util::GenerateId(name), page_ordinal); |
186 } | 185 } |
187 | 186 |
188 syncer::StringOrdinal SyncAppHelper::GetAppLaunchOrdinalForApp( | 187 syncer::StringOrdinal SyncAppHelper::GetAppLaunchOrdinalForApp( |
189 Profile* profile, | 188 Profile* profile, |
190 const std::string& name) { | 189 const std::string& name) { |
191 return ExtensionPrefs::Get(profile)->app_sorting()->GetAppLaunchOrdinal( | 190 return ExtensionPrefs::Get(profile)->app_sorting()->GetAppLaunchOrdinal( |
192 extensions::id_util::GenerateId(name)); | 191 crx_file::id_util::GenerateId(name)); |
193 } | 192 } |
194 | 193 |
195 void SyncAppHelper::SetAppLaunchOrdinalForApp( | 194 void SyncAppHelper::SetAppLaunchOrdinalForApp( |
196 Profile* profile, | 195 Profile* profile, |
197 const std::string& name, | 196 const std::string& name, |
198 const syncer::StringOrdinal& app_launch_ordinal) { | 197 const syncer::StringOrdinal& app_launch_ordinal) { |
199 ExtensionPrefs::Get(profile)->app_sorting()->SetAppLaunchOrdinal( | 198 ExtensionPrefs::Get(profile)->app_sorting()->SetAppLaunchOrdinal( |
200 extensions::id_util::GenerateId(name), app_launch_ordinal); | 199 crx_file::id_util::GenerateId(name), app_launch_ordinal); |
201 } | 200 } |
202 | 201 |
203 void SyncAppHelper::FixNTPOrdinalCollisions(Profile* profile) { | 202 void SyncAppHelper::FixNTPOrdinalCollisions(Profile* profile) { |
204 ExtensionPrefs::Get(profile)->app_sorting()->FixNTPOrdinalCollisions(); | 203 ExtensionPrefs::Get(profile)->app_sorting()->FixNTPOrdinalCollisions(); |
205 } | 204 } |
206 | 205 |
207 SyncAppHelper::SyncAppHelper() : setup_completed_(false) {} | 206 SyncAppHelper::SyncAppHelper() : setup_completed_(false) {} |
208 | 207 |
209 SyncAppHelper::~SyncAppHelper() {} | 208 SyncAppHelper::~SyncAppHelper() {} |
OLD | NEW |