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

Side by Side Diff: chrome/browser/services/gcm/gcm_profile_service.cc

Issue 897793002: Remove gcm channel state supported by sync service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android builds Created 5 years, 10 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/services/gcm/gcm_profile_service.h" 5 #include "chrome/browser/services/gcm/gcm_profile_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/pref_names.h"
13 #include "components/gcm_driver/gcm_driver.h" 12 #include "components/gcm_driver/gcm_driver.h"
14 #include "components/pref_registry/pref_registry_syncable.h" 13 #include "components/pref_registry/pref_registry_syncable.h"
15 14
16 #if defined(OS_ANDROID) 15 #if defined(OS_ANDROID)
17 #include "components/gcm_driver/gcm_driver_android.h" 16 #include "components/gcm_driver/gcm_driver_android.h"
18 #else 17 #else
19 #include "base/bind.h" 18 #include "base/bind.h"
20 #include "base/files/file_path.h" 19 #include "base/files/file_path.h"
21 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
22 #include "chrome/browser/services/gcm/gcm_account_tracker.h" 21 #include "chrome/browser/services/gcm/gcm_account_tracker.h"
23 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" 22 #include "chrome/browser/services/gcm/gcm_desktop_utils.h"
24 #include "chrome/browser/signin/profile_identity_provider.h" 23 #include "chrome/browser/signin/profile_identity_provider.h"
25 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 24 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
26 #include "chrome/browser/signin/signin_manager_factory.h" 25 #include "chrome/browser/signin/signin_manager_factory.h"
27 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 26 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
28 #include "chrome/common/chrome_constants.h" 27 #include "chrome/common/chrome_constants.h"
28 #include "components/gcm_driver/gcm_channel_status_syncer.h"
29 #include "components/gcm_driver/gcm_client_factory.h" 29 #include "components/gcm_driver/gcm_client_factory.h"
30 #include "components/gcm_driver/gcm_driver_desktop.h" 30 #include "components/gcm_driver/gcm_driver_desktop.h"
31 #include "components/signin/core/browser/signin_manager.h" 31 #include "components/signin/core/browser/signin_manager.h"
32 #include "google_apis/gaia/account_tracker.h" 32 #include "google_apis/gaia/account_tracker.h"
33 #include "google_apis/gaia/identity_provider.h" 33 #include "google_apis/gaia/identity_provider.h"
34 #include "net/url_request/url_request_context_getter.h" 34 #include "net/url_request/url_request_context_getter.h"
35 #endif 35 #endif
36 36
37 namespace gcm { 37 namespace gcm {
38 38
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 gcm_account_tracker_.reset( 113 gcm_account_tracker_.reset(
114 new GCMAccountTracker(gaia_account_tracker.Pass(), driver_)); 114 new GCMAccountTracker(gaia_account_tracker.Pass(), driver_));
115 115
116 gcm_account_tracker_->Start(); 116 gcm_account_tracker_->Start();
117 } 117 }
118 118
119 #endif // !defined(OS_ANDROID) 119 #endif // !defined(OS_ANDROID)
120 120
121 // static 121 // static
122 bool GCMProfileService::IsGCMEnabled(Profile* profile) { 122 bool GCMProfileService::IsGCMEnabled(Profile* profile) {
123 return profile->GetPrefs()->GetBoolean(prefs::kGCMChannelEnabled); 123 #if defined(OS_ANDROID)
124 return true;
125 #else
126 return profile->GetPrefs()->GetBoolean(gcm::prefs::kGCMChannelStatus);
127 #endif // defined(OS_ANDROID)
124 } 128 }
125 129
126 // static 130 // static
127 void GCMProfileService::RegisterProfilePrefs( 131 void GCMProfileService::RegisterProfilePrefs(
128 user_prefs::PrefRegistrySyncable* registry) { 132 user_prefs::PrefRegistrySyncable* registry) {
129 registry->RegisterBooleanPref(
130 prefs::kGCMChannelEnabled,
131 true,
132 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
133 PushMessagingServiceImpl::RegisterProfilePrefs(registry); 133 PushMessagingServiceImpl::RegisterProfilePrefs(registry);
134 } 134 }
135 135
136 #if defined(OS_ANDROID) 136 #if defined(OS_ANDROID)
137 static GCMProfileService* debug_instance = nullptr; 137 static GCMProfileService* debug_instance = nullptr;
138 138
139 GCMProfileService::GCMProfileService(Profile* profile) 139 GCMProfileService::GCMProfileService(Profile* profile)
140 : profile_(profile), 140 : profile_(profile),
141 push_messaging_service_(this, profile) { 141 push_messaging_service_(this, profile) {
142 CHECK(!profile->IsOffTheRecord()); 142 CHECK(!profile->IsOffTheRecord());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { 204 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) {
205 driver_.reset(driver); 205 driver_.reset(driver);
206 #if !defined(OS_ANDROID) 206 #if !defined(OS_ANDROID)
207 if (identity_observer_) 207 if (identity_observer_)
208 identity_observer_.reset(new IdentityObserver(profile_, driver)); 208 identity_observer_.reset(new IdentityObserver(profile_, driver));
209 #endif // !defined(OS_ANDROID) 209 #endif // !defined(OS_ANDROID)
210 } 210 }
211 211
212 } // namespace gcm 212 } // namespace gcm
OLDNEW
« no previous file with comments | « chrome/browser/invalidation/ticl_profile_settings_provider_unittest.cc ('k') | chrome/browser/sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698