| 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/extension_system.h" | 8 #include "chrome/browser/extensions/extension_system.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/sync_helper.h" | 13 #include "chrome/common/extensions/sync_helper.h" |
| 14 #include "extensions/browser/app_sorting.h" | 14 #include "extensions/browser/app_sorting.h" |
| 15 #include "extensions/common/extension.h" |
| 16 #include "extensions/common/extension_set.h" |
| 15 #include "extensions/common/id_util.h" | 17 #include "extensions/common/id_util.h" |
| 16 | 18 |
| 17 namespace { | 19 namespace { |
| 18 | 20 |
| 19 struct AppState { | 21 struct AppState { |
| 20 AppState(); | 22 AppState(); |
| 21 ~AppState(); | 23 ~AppState(); |
| 22 bool IsValid() const; | 24 bool IsValid() const; |
| 23 bool Equals(const AppState& other) const; | 25 bool Equals(const AppState& other) const; |
| 24 | 26 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 50 app_state->page_ordinal = extension_service->extension_prefs()-> | 52 app_state->page_ordinal = extension_service->extension_prefs()-> |
| 51 app_sorting()->GetPageOrdinal(id); | 53 app_sorting()->GetPageOrdinal(id); |
| 52 } | 54 } |
| 53 | 55 |
| 54 // Returns a map from |profile|'s installed extensions to their state. | 56 // Returns a map from |profile|'s installed extensions to their state. |
| 55 AppStateMap GetAppStates(Profile* profile) { | 57 AppStateMap GetAppStates(Profile* profile) { |
| 56 AppStateMap app_state_map; | 58 AppStateMap app_state_map; |
| 57 | 59 |
| 58 ExtensionService* extension_service = profile->GetExtensionService(); | 60 ExtensionService* extension_service = profile->GetExtensionService(); |
| 59 | 61 |
| 60 scoped_ptr<const ExtensionSet> extensions( | 62 scoped_ptr<const extensions::ExtensionSet> extensions( |
| 61 extension_service->GenerateInstalledExtensionsSet()); | 63 extension_service->GenerateInstalledExtensionsSet()); |
| 62 for (ExtensionSet::const_iterator it = extensions->begin(); | 64 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
| 63 it != extensions->end(); ++it) { | 65 it != extensions->end(); ++it) { |
| 64 if (extensions::sync_helper::IsSyncableApp(it->get())) { | 66 if (extensions::sync_helper::IsSyncableApp(it->get())) { |
| 65 const std::string& id = (*it)->id(); | 67 const std::string& id = (*it)->id(); |
| 66 LoadApp(extension_service, id, &(app_state_map[id])); | 68 LoadApp(extension_service, id, &(app_state_map[id])); |
| 67 } | 69 } |
| 68 } | 70 } |
| 69 | 71 |
| 70 const extensions::PendingExtensionManager* pending_extension_manager = | 72 const extensions::PendingExtensionManager* pending_extension_manager = |
| 71 extension_service->pending_extension_manager(); | 73 extension_service->pending_extension_manager(); |
| 72 | 74 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 177 } |
| 176 | 178 |
| 177 void SyncAppHelper::FixNTPOrdinalCollisions(Profile* profile) { | 179 void SyncAppHelper::FixNTPOrdinalCollisions(Profile* profile) { |
| 178 profile->GetExtensionService()->extension_prefs()->app_sorting()-> | 180 profile->GetExtensionService()->extension_prefs()->app_sorting()-> |
| 179 FixNTPOrdinalCollisions(); | 181 FixNTPOrdinalCollisions(); |
| 180 } | 182 } |
| 181 | 183 |
| 182 SyncAppHelper::SyncAppHelper() : setup_completed_(false) {} | 184 SyncAppHelper::SyncAppHelper() : setup_completed_(false) {} |
| 183 | 185 |
| 184 SyncAppHelper::~SyncAppHelper() {} | 186 SyncAppHelper::~SyncAppHelper() {} |
| OLD | NEW |