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

Side by Side Diff: components/suggestions/suggestions_service.cc

Issue 2494873003: [Sync] Allow sync start without sign-in if the local sync backend is on. (Closed)
Patch Set: Merge pref changes from https://codereview.chromium.org/2528163002/. Created 4 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/suggestions/suggestions_service.h" 5 #include "components/suggestions/suggestions_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Behavior: Update suggestions from the server. Serve from cache on timeout. 59 // Behavior: Update suggestions from the server. Serve from cache on timeout.
60 INITIALIZED_ENABLED_HISTORY, 60 INITIALIZED_ENABLED_HISTORY,
61 61
62 // State: Sync service is disabled or history sync is disabled. 62 // State: Sync service is disabled or history sync is disabled.
63 // Behavior: Do not issue a server request. Clear the cache. Serve empty 63 // Behavior: Do not issue a server request. Clear the cache. Serve empty
64 // suggestions. 64 // suggestions.
65 SYNC_OR_HISTORY_SYNC_DISABLED, 65 SYNC_OR_HISTORY_SYNC_DISABLED,
66 }; 66 };
67 67
68 SyncState GetSyncState(syncer::SyncService* sync) { 68 SyncState GetSyncState(syncer::SyncService* sync) {
69 if (!sync || !sync->CanSyncStart()) 69 if (!sync || !sync->CanSyncStart() || sync->IsLocalSyncEnabled())
70 return SYNC_OR_HISTORY_SYNC_DISABLED; 70 return SYNC_OR_HISTORY_SYNC_DISABLED;
71 if (!sync->IsSyncActive() || !sync->ConfigurationDone()) 71 if (!sync->IsSyncActive() || !sync->ConfigurationDone())
72 return NOT_INITIALIZED_ENABLED; 72 return NOT_INITIALIZED_ENABLED;
73 return sync->GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES) 73 return sync->GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES)
74 ? INITIALIZED_ENABLED_HISTORY 74 ? INITIALIZED_ENABLED_HISTORY
75 : SYNC_OR_HISTORY_SYNC_DISABLED; 75 : SYNC_OR_HISTORY_SYNC_DISABLED;
76 } 76 }
77 77
78 // Used to UMA log the state of the last response from the server. 78 // Used to UMA log the state of the last response from the server.
79 enum SuggestionsResponseState { 79 enum SuggestionsResponseState {
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); 549 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec);
550 } else { 550 } else {
551 TimeDelta candidate_delay = 551 TimeDelta candidate_delay =
552 scheduling_delay_ * kSchedulingBackoffMultiplier; 552 scheduling_delay_ * kSchedulingBackoffMultiplier;
553 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) 553 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec))
554 scheduling_delay_ = candidate_delay; 554 scheduling_delay_ = candidate_delay;
555 } 555 }
556 } 556 }
557 557
558 } // namespace suggestions 558 } // namespace suggestions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698