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

Side by Side Diff: chrome/browser/invalidation/ticl_profile_settings_provider.cc

Issue 1127393005: remove rollback to xmpp when GCM disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update unittest Created 5 years, 7 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 | « no previous file | chrome/browser/invalidation/ticl_profile_settings_provider_unittest.cc » ('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 "chrome/browser/invalidation/ticl_profile_settings_provider.h" 5 #include "chrome/browser/invalidation/ticl_profile_settings_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 15 matching lines...) Expand all
26 registrar_.Add( 26 registrar_.Add(
27 gcm::prefs::kGCMChannelStatus, 27 gcm::prefs::kGCMChannelStatus,
28 base::Bind(&TiclProfileSettingsProvider::FireOnUseGCMChannelChanged, 28 base::Bind(&TiclProfileSettingsProvider::FireOnUseGCMChannelChanged,
29 base::Unretained(this))); 29 base::Unretained(this)));
30 } 30 }
31 31
32 TiclProfileSettingsProvider::~TiclProfileSettingsProvider() { 32 TiclProfileSettingsProvider::~TiclProfileSettingsProvider() {
33 } 33 }
34 34
35 bool TiclProfileSettingsProvider::UseGCMChannel() const { 35 bool TiclProfileSettingsProvider::UseGCMChannel() const {
36 if (!gcm::GCMProfileService::IsGCMEnabled(profile_)) {
37 // Do not try to use GCM channel if GCM is disabled.
38 return false;
39 }
40
41 if (profile_->GetPrefs()->GetBoolean( 36 if (profile_->GetPrefs()->GetBoolean(
42 prefs::kInvalidationServiceUseGCMChannel)) { 37 prefs::kInvalidationServiceUseGCMChannel)) {
43 // Use GCM channel if it was enabled via prefs. 38 // Use GCM channel if it was enabled via prefs.
44 return true; 39 return true;
45 } 40 }
46 41
47 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 42 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
48 switches::kInvalidationUseGCMChannel)) { 43 switches::kInvalidationUseGCMChannel)) {
49 // Use GCM channel if it was enabled via a command-line switch. 44 // Use GCM channel if it was enabled via a command-line switch.
50 return true; 45 return true;
51 } 46 }
52 47
53 // By default, do not use GCM channel. 48 // By default, do not use GCM channel.
54 return false; 49 return false;
55 } 50 }
56 51
57 } // namespace invalidation 52 } // namespace invalidation
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/invalidation/ticl_profile_settings_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698