| OLD | NEW |
| 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_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 bundle = &app_sync_bundle_; | 1298 bundle = &app_sync_bundle_; |
| 1299 bundle->filter = IsSyncableApp; | 1299 bundle->filter = IsSyncableApp; |
| 1300 break; | 1300 break; |
| 1301 | 1301 |
| 1302 default: | 1302 default: |
| 1303 LOG(FATAL) << "Got " << type << " ModelType"; | 1303 LOG(FATAL) << "Got " << type << " ModelType"; |
| 1304 } | 1304 } |
| 1305 | 1305 |
| 1306 bundle->sync_processor = sync_processor; | 1306 bundle->sync_processor = sync_processor; |
| 1307 | 1307 |
| 1308 // Process extensions from sync. |
| 1308 for (SyncDataList::const_iterator i = initial_sync_data.begin(); | 1309 for (SyncDataList::const_iterator i = initial_sync_data.begin(); |
| 1309 i != initial_sync_data.end(); | 1310 i != initial_sync_data.end(); |
| 1310 ++i) { | 1311 ++i) { |
| 1311 ExtensionSyncData extension_sync_data = ExtensionSyncData(*i); | 1312 ExtensionSyncData extension_sync_data = ExtensionSyncData(*i); |
| 1312 bundle->synced_extensions.insert(extension_sync_data.id()); | 1313 bundle->synced_extensions.insert(extension_sync_data.id()); |
| 1313 ProcessExtensionSyncData(extension_sync_data, *bundle); | 1314 ProcessExtensionSyncData(extension_sync_data, *bundle); |
| 1314 } | 1315 } |
| 1315 | 1316 |
| 1317 // Process local extensions. |
| 1318 // TODO(yoz): Determine whether pending extensions should be considered too. |
| 1319 // See crbug.com/104399. |
| 1316 SyncDataList sync_data_list = GetAllSyncData(type); | 1320 SyncDataList sync_data_list = GetAllSyncData(type); |
| 1317 SyncChangeList sync_change_list; | 1321 SyncChangeList sync_change_list; |
| 1318 for (SyncDataList::const_iterator i = sync_data_list.begin(); | 1322 for (SyncDataList::const_iterator i = sync_data_list.begin(); |
| 1319 i != sync_data_list.end(); | 1323 i != sync_data_list.end(); |
| 1320 ++i) { | 1324 ++i) { |
| 1321 if (bundle->HasExtensionId(i->GetTag())) | 1325 if (bundle->HasExtensionId(i->GetTag())) { |
| 1322 sync_change_list.push_back(SyncChange(SyncChange::ACTION_UPDATE, *i)); | 1326 sync_change_list.push_back(SyncChange(SyncChange::ACTION_UPDATE, *i)); |
| 1323 else | 1327 } else { |
| 1328 bundle->synced_extensions.insert(i->GetTag()); |
| 1324 sync_change_list.push_back(SyncChange(SyncChange::ACTION_ADD, *i)); | 1329 sync_change_list.push_back(SyncChange(SyncChange::ACTION_ADD, *i)); |
| 1330 } |
| 1325 } | 1331 } |
| 1326 bundle->sync_processor->ProcessSyncChanges(FROM_HERE, sync_change_list); | 1332 bundle->sync_processor->ProcessSyncChanges(FROM_HERE, sync_change_list); |
| 1327 | 1333 |
| 1328 return SyncError(); | 1334 return SyncError(); |
| 1329 } | 1335 } |
| 1330 | 1336 |
| 1331 void ExtensionService::StopSyncing(syncable::ModelType type) { | 1337 void ExtensionService::StopSyncing(syncable::ModelType type) { |
| 1332 SyncBundle* bundle = GetSyncBundleForModelType(type); | 1338 SyncBundle* bundle = GetSyncBundleForModelType(type); |
| 1333 CHECK(bundle); | 1339 CHECK(bundle); |
| 1334 // This is the simplest way to clear out the bundle. | 1340 // This is the simplest way to clear out the bundle. |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2557 // | 2563 // |
| 2558 // To coexist with certain unit tests that don't have an IO thread message | 2564 // To coexist with certain unit tests that don't have an IO thread message |
| 2559 // loop available at ExtensionService shutdown, we lazy-initialize this | 2565 // loop available at ExtensionService shutdown, we lazy-initialize this |
| 2560 // object so that those cases neither create nor destroy a SocketController. | 2566 // object so that those cases neither create nor destroy a SocketController. |
| 2561 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2567 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 2562 if (!socket_controller_) { | 2568 if (!socket_controller_) { |
| 2563 socket_controller_ = new extensions::SocketController(); | 2569 socket_controller_ = new extensions::SocketController(); |
| 2564 } | 2570 } |
| 2565 return socket_controller_; | 2571 return socket_controller_; |
| 2566 } | 2572 } |
| OLD | NEW |