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

Side by Side Diff: chrome/browser/sync/profile_sync_service.h

Issue 10656033: [sync] Automatic bootstrapping of Sync on Win 8 from cached credentials (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "" Created 8 years, 5 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 | Annotate | Revision Log
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 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/ref_counted.h"
17 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
18 #include "base/observer_list.h" 19 #include "base/observer_list.h"
19 #include "base/string16.h" 20 #include "base/string16.h"
20 #include "base/time.h" 21 #include "base/time.h"
21 #include "base/timer.h" 22 #include "base/timer.h"
22 #include "chrome/browser/profiles/profile_keyed_service.h" 23 #include "chrome/browser/profiles/profile_keyed_service.h"
23 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" 24 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h"
24 #include "chrome/browser/sync/failed_datatypes_handler.h" 25 #include "chrome/browser/sync/failed_datatypes_handler.h"
25 #include "chrome/browser/sync/glue/data_type_controller.h" 26 #include "chrome/browser/sync/glue/data_type_controller.h"
26 #include "chrome/browser/sync/glue/data_type_manager.h" 27 #include "chrome/browser/sync/glue/data_type_manager.h"
(...skipping 21 matching lines...) Expand all
48 class BackendMigrator; 49 class BackendMigrator;
49 class ChangeProcessor; 50 class ChangeProcessor;
50 class DataTypeManager; 51 class DataTypeManager;
51 class JsController; 52 class JsController;
52 class SessionModelAssociator; 53 class SessionModelAssociator;
53 namespace sessions { class SyncSessionSnapshot; } 54 namespace sessions { class SyncSessionSnapshot; }
54 } 55 }
55 56
56 namespace csync { 57 namespace csync {
57 class BaseTransaction; 58 class BaseTransaction;
59 #if defined(OS_WIN)
60 class CredentialCache;
61 #endif
58 struct SyncCredentials; 62 struct SyncCredentials;
59 struct UserShare; 63 struct UserShare;
60 } 64 }
61 65
62 namespace sync_pb { 66 namespace sync_pb {
63 class EncryptedData; 67 class EncryptedData;
64 } // namespace sync_pb 68 } // namespace sync_pb
65 69
66 // ProfileSyncService is the layer between browser subsystems like bookmarks, 70 // ProfileSyncService is the layer between browser subsystems like bookmarks,
67 // and the sync backend. Each subsystem is logically thought of as being 71 // and the sync backend. Each subsystem is logically thought of as being
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 }; 602 };
599 friend class ProfileSyncServicePasswordTest; 603 friend class ProfileSyncServicePasswordTest;
600 friend class SyncTest; 604 friend class SyncTest;
601 friend class TestProfileSyncService; 605 friend class TestProfileSyncService;
602 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState); 606 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState);
603 607
604 // Starts up sync if it is not suppressed and preconditions are met. 608 // Starts up sync if it is not suppressed and preconditions are met.
605 // Called from Initialize() and UnsuppressAndStart(). 609 // Called from Initialize() and UnsuppressAndStart().
606 void TryStart(); 610 void TryStart();
607 611
612 #if defined(OS_WIN)
613 // Returns true if the user is not signed in to sync, but cached credentials
614 // are available for bootstrapping sync. Returns false otherwise.
615 // Used on Windows 8 by Metro / Desktop Chrome, to prevent the user from
616 // having to sign in twice with the same account.
617 bool ShouldSigninUsingCachedCredentials();
618
619 // Attempts to load cached sync credentials from the alternate Windows 8
620 // profile in order to automatically bootstrap sync. For example, if PSS is
621 // starting up for the first time on Desktop, and the user has already signed
622 // in to sync on Metro, we look for the presence of cached credentials from
623 // the corresponding profile directory on Metro. Must be called only when
624 // ShouldSigninUsingCachedCredentials returns true.
625 void TryLoadingCachedCredentials();
626
627 // Automatically bootstraps sync using cached credentials that were
628 // successfully loaded from the alternate profile directory on Windows 8.
629 void OnLoadedCachedCredentials(
630 scoped_refptr<csync::CredentialCache> credentials);
631 #endif
632
608 // Puts the backend's sync scheduler into NORMAL mode. 633 // Puts the backend's sync scheduler into NORMAL mode.
609 // Called when configuration is complete. 634 // Called when configuration is complete.
610 void StartSyncingWithServer(); 635 void StartSyncingWithServer();
611 636
612 // Called when we've determined that we don't need a passphrase (either 637 // Called when we've determined that we don't need a passphrase (either
613 // because OnPassphraseAccepted() was called, or because we've gotten a 638 // because OnPassphraseAccepted() was called, or because we've gotten a
614 // OnPassphraseRequired() but no data types are enabled). 639 // OnPassphraseRequired() but no data types are enabled).
615 void ResolvePassphraseRequired(); 640 void ResolvePassphraseRequired();
616 641
617 // During initial signin, ProfileSyncService caches the user's signin 642 // During initial signin, ProfileSyncService caches the user's signin
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 802
778 scoped_ptr<browser_sync::BackendUnrecoverableErrorHandler> 803 scoped_ptr<browser_sync::BackendUnrecoverableErrorHandler>
779 backend_unrecoverable_error_handler_; 804 backend_unrecoverable_error_handler_;
780 805
781 browser_sync::DataTypeManager::ConfigureStatus configure_status_; 806 browser_sync::DataTypeManager::ConfigureStatus configure_status_;
782 807
783 // If |true|, there is setup UI visible so we should not start downloading 808 // If |true|, there is setup UI visible so we should not start downloading
784 // data types. 809 // data types.
785 bool setup_in_progress_; 810 bool setup_in_progress_;
786 811
812 // If true, we are bootstrapping sync using cached credentials. Happens only
813 // on Windows 8 to avoid having to sign in manually on both Metro and Desktop.
814 bool setting_up_with_cached_credentials_;
815
787 // The set of currently enabled sync experiments. 816 // The set of currently enabled sync experiments.
788 csync::Experiments current_experiments; 817 csync::Experiments current_experiments;
789 818
790 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 819 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
791 }; 820 };
792 821
793 bool ShouldShowActionOnUI( 822 bool ShouldShowActionOnUI(
794 const csync::SyncProtocolError& error); 823 const csync::SyncProtocolError& error);
795 824
796 825
797 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 826 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698