| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_sync_service.h" | 5 #include "chrome/browser/extensions/extension_sync_service.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "chrome/browser/extensions/bookmark_app_helper.h" | 10 #include "chrome/browser/extensions/bookmark_app_helper.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } // namespace | 90 } // namespace |
| 91 | 91 |
| 92 ExtensionSyncService::ExtensionSyncService(Profile* profile, | 92 ExtensionSyncService::ExtensionSyncService(Profile* profile, |
| 93 ExtensionPrefs* extension_prefs, | 93 ExtensionPrefs* extension_prefs, |
| 94 ExtensionService* extension_service) | 94 ExtensionService* extension_service) |
| 95 : profile_(profile), | 95 : profile_(profile), |
| 96 extension_prefs_(extension_prefs), | 96 extension_prefs_(extension_prefs), |
| 97 extension_service_(extension_service) { | 97 extension_service_(extension_service) { |
| 98 SetSyncStartFlare(sync_start_util::GetFlareForSyncableService( | 98 SetSyncStartFlare(sync_start_util::GetFlareForSyncableService( |
| 99 profile_->GetPath())); | 99 profile_->GetPath())); |
| 100 | |
| 101 extension_prefs_->app_sorting()->SetExtensionSyncService(this); | |
| 102 } | 100 } |
| 103 | 101 |
| 104 ExtensionSyncService::~ExtensionSyncService() {} | 102 ExtensionSyncService::~ExtensionSyncService() {} |
| 105 | 103 |
| 106 // static | 104 // static |
| 107 ExtensionSyncService* ExtensionSyncService::Get( | 105 ExtensionSyncService* ExtensionSyncService::Get( |
| 108 content::BrowserContext* context) { | 106 content::BrowserContext* context) { |
| 109 return ExtensionSyncServiceFactory::GetForBrowserContext(context); | 107 return ExtensionSyncServiceFactory::GetForBrowserContext(context); |
| 110 } | 108 } |
| 111 | 109 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 CreateOrUpdateBookmarkApp(extension_service_, &web_app_info); | 334 CreateOrUpdateBookmarkApp(extension_service_, &web_app_info); |
| 337 } else { | 335 } else { |
| 338 GetWebApplicationInfoFromApp(profile_, | 336 GetWebApplicationInfoFromApp(profile_, |
| 339 extension, | 337 extension, |
| 340 base::Bind(&OnWebApplicationInfoLoaded, | 338 base::Bind(&OnWebApplicationInfoLoaded, |
| 341 web_app_info, | 339 web_app_info, |
| 342 extension_service_->AsWeakPtr())); | 340 extension_service_->AsWeakPtr())); |
| 343 } | 341 } |
| 344 } | 342 } |
| 345 | 343 |
| 346 void ExtensionSyncService::SyncOrderingChange(const std::string& extension_id) { | |
| 347 const Extension* ext = | |
| 348 extension_service_->GetInstalledExtension(extension_id); | |
| 349 | |
| 350 if (ext) | |
| 351 SyncExtensionChangeIfNeeded(*ext); | |
| 352 } | |
| 353 | |
| 354 void ExtensionSyncService::SetSyncStartFlare( | 344 void ExtensionSyncService::SetSyncStartFlare( |
| 355 const syncer::SyncableService::StartSyncFlare& flare) { | 345 const syncer::SyncableService::StartSyncFlare& flare) { |
| 356 flare_ = flare; | 346 flare_ = flare; |
| 357 } | 347 } |
| 358 | 348 |
| 359 SyncBundle* ExtensionSyncService::GetSyncBundle(syncer::ModelType type) { | 349 SyncBundle* ExtensionSyncService::GetSyncBundle(syncer::ModelType type) { |
| 360 return const_cast<SyncBundle*>( | 350 return const_cast<SyncBundle*>( |
| 361 const_cast<const ExtensionSyncService&>(*this).GetSyncBundle(type)); | 351 const_cast<const ExtensionSyncService&>(*this).GetSyncBundle(type)); |
| 362 } | 352 } |
| 363 | 353 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 // non-INTERNAL location. Add to pending_sync_data, even though it will | 510 // non-INTERNAL location. Add to pending_sync_data, even though it will |
| 521 // never be removed (we'll never install a syncable version of the | 511 // never be removed (we'll never install a syncable version of the |
| 522 // extension), so that GetAllSyncData() continues to send it. | 512 // extension), so that GetAllSyncData() continues to send it. |
| 523 } | 513 } |
| 524 // Track pending extensions so that we can return them in GetAllSyncData(). | 514 // Track pending extensions so that we can return them in GetAllSyncData(). |
| 525 return false; | 515 return false; |
| 526 } | 516 } |
| 527 | 517 |
| 528 return true; | 518 return true; |
| 529 } | 519 } |
| OLD | NEW |