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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 12380006: Build a new TokenCacheService so I can stop using TokenService for something it wasn't designed for. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/sync/glue/sync_backend_host.h" 7 #include "chrome/browser/sync/glue/sync_backend_host.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/file_util.h" 16 #include "base/file_util.h"
17 #include "base/location.h" 17 #include "base/location.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "base/threading/thread_restrictions.h" 19 #include "base/threading/thread_restrictions.h"
20 #include "base/timer.h" 20 #include "base/timer.h"
21 #include "base/tracked_objects.h" 21 #include "base/tracked_objects.h"
22 #include "base/utf_string_conversions.h" 22 #include "base/utf_string_conversions.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/signin/token_service.h" 25 #include "chrome/browser/signin/token_service.h"
26 #include "chrome/browser/signin/token_service_factory.h"
27 #include "chrome/browser/sync/glue/android_invalidator_bridge.h" 26 #include "chrome/browser/sync/glue/android_invalidator_bridge.h"
28 #include "chrome/browser/sync/glue/android_invalidator_bridge_proxy.h" 27 #include "chrome/browser/sync/glue/android_invalidator_bridge_proxy.h"
29 #include "chrome/browser/sync/glue/change_processor.h" 28 #include "chrome/browser/sync/glue/change_processor.h"
30 #include "chrome/browser/sync/glue/chrome_encryptor.h" 29 #include "chrome/browser/sync/glue/chrome_encryptor.h"
31 #include "chrome/browser/sync/glue/device_info.h" 30 #include "chrome/browser/sync/glue/device_info.h"
32 #include "chrome/browser/sync/glue/sync_backend_registrar.h" 31 #include "chrome/browser/sync/glue/sync_backend_registrar.h"
33 #include "chrome/browser/sync/glue/synced_device_tracker.h" 32 #include "chrome/browser/sync/glue/synced_device_tracker.h"
34 #include "chrome/browser/sync/invalidations/invalidator_storage.h" 33 #include "chrome/browser/sync/invalidations/invalidator_storage.h"
35 #include "chrome/browser/sync/sync_prefs.h" 34 #include "chrome/browser/sync/sync_prefs.h"
35 #include "chrome/browser/token_cache/token_cache.h"
36 #include "chrome/browser/token_cache/token_cache_factory.h"
36 #include "chrome/common/chrome_notification_types.h" 37 #include "chrome/common/chrome_notification_types.h"
37 #include "chrome/common/chrome_notification_types.h" 38 #include "chrome/common/chrome_notification_types.h"
38 #include "chrome/common/chrome_switches.h" 39 #include "chrome/common/chrome_switches.h"
39 #include "chrome/common/chrome_version_info.h" 40 #include "chrome/common/chrome_version_info.h"
40 #include "content/public/browser/browser_thread.h" 41 #include "content/public/browser/browser_thread.h"
41 #include "content/public/browser/notification_details.h" 42 #include "content/public/browser/notification_details.h"
42 #include "content/public/browser/notification_service.h" 43 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/notification_source.h" 44 #include "content/public/browser/notification_source.h"
44 #include "content/public/common/content_client.h" 45 #include "content/public/common/content_client.h"
45 #include "google_apis/gaia/gaia_constants.h" 46 #include "google_apis/gaia/gaia_constants.h"
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 1576
1576 // Clear our cache of the cryptographer's pending keys. 1577 // Clear our cache of the cryptographer's pending keys.
1577 cached_pending_keys_.clear_blob(); 1578 cached_pending_keys_.clear_blob();
1578 frontend_->OnPassphraseAccepted(); 1579 frontend_->OnPassphraseAccepted();
1579 } 1580 }
1580 1581
1581 void SyncBackendHost::NotifyUpdatedToken(const std::string& token) { 1582 void SyncBackendHost::NotifyUpdatedToken(const std::string& token) {
1582 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1583 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1583 TokenAvailableDetails details(GaiaConstants::kSyncService, token); 1584 TokenAvailableDetails details(GaiaConstants::kSyncService, token);
1584 1585
1585 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); 1586 TokenCacheService* token_cache = TokenCacheServiceFactory::GetForProfile(
1586 CHECK(token_service); 1587 profile_);
1587 token_service->AddAuthTokenManually(details.service(), details.token()); 1588 CHECK(token_cache);
1589 token_cache->StoreToken(GaiaConstants::kObfuscatedGaiaId, details.token(),
Andrew T Wilson (Slow) 2013/03/01 17:50:54 Should we really be writing the sync token as the
Pete Williamson 2013/03/04 18:32:53 Good catch, reverted.
1590 GaiaConstants::kObfuscatedGaiaIdTimeout);
1588 } 1591 }
1589 1592
1590 void SyncBackendHost::NotifyEncryptedTypesChanged( 1593 void SyncBackendHost::NotifyEncryptedTypesChanged(
1591 syncer::ModelTypeSet encrypted_types, 1594 syncer::ModelTypeSet encrypted_types,
1592 bool encrypt_everything) { 1595 bool encrypt_everything) {
1593 if (!frontend_) 1596 if (!frontend_)
1594 return; 1597 return;
1595 1598
1596 DCHECK_EQ(MessageLoop::current(), frontend_loop_); 1599 DCHECK_EQ(MessageLoop::current(), frontend_loop_);
1597 frontend_->OnEncryptedTypesChanged( 1600 frontend_->OnEncryptedTypesChanged(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 DVLOG(1) << "Connection status changed: " 1635 DVLOG(1) << "Connection status changed: "
1633 << syncer::ConnectionStatusToString(status); 1636 << syncer::ConnectionStatusToString(status);
1634 frontend_->OnConnectionStatusChange(status); 1637 frontend_->OnConnectionStatusChange(status);
1635 } 1638 }
1636 1639
1637 #undef SDVLOG 1640 #undef SDVLOG
1638 1641
1639 #undef SLOG 1642 #undef SLOG
1640 1643
1641 } // namespace browser_sync 1644 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698