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

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

Issue 2494873003: [Sync] Allow sync start without sign-in if the local sync backend is on. (Closed)
Patch Set: Remove ifdefs around include. Created 3 years, 12 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
« no previous file with comments | « components/precache/content/precache_manager.cc ('k') | components/sync/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_impl.h" 5 #include "components/suggestions/suggestions_service_impl.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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); 558 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec);
559 } else { 559 } else {
560 TimeDelta candidate_delay = 560 TimeDelta candidate_delay =
561 scheduling_delay_ * kSchedulingBackoffMultiplier; 561 scheduling_delay_ * kSchedulingBackoffMultiplier;
562 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) 562 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec))
563 scheduling_delay_ = candidate_delay; 563 scheduling_delay_ = candidate_delay;
564 } 564 }
565 } 565 }
566 566
567 } // namespace suggestions 567 } // namespace suggestions
OLDNEW
« no previous file with comments | « components/precache/content/precache_manager.cc ('k') | components/sync/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698