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

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

Issue 211973003: [GCM] Cleanup for ios enabling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 9 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
« no previous file with comments | « build/all.gyp ('k') | chrome/browser/invalidation/ticl_invalidation_service_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 (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/invalidation/ticl_invalidation_service.h" 5 #include "chrome/browser/invalidation/ticl_invalidation_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/invalidation/gcm_invalidation_bridge.h" 10 #include "chrome/browser/invalidation/gcm_invalidation_bridge.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 UpdateInvalidatorCredentials(); 422 UpdateInvalidatorCredentials();
423 423
424 invalidator_->RegisterHandler(this); 424 invalidator_->RegisterHandler(this);
425 invalidator_->UpdateRegisteredIds( 425 invalidator_->UpdateRegisteredIds(
426 this, 426 this,
427 invalidator_registrar_->GetAllRegisteredIds()); 427 invalidator_registrar_->GetAllRegisteredIds());
428 } 428 }
429 429
430 void TiclInvalidationService::UpdateInvalidationNetworkChannel() { 430 void TiclInvalidationService::UpdateInvalidationNetworkChannel() {
431 InvalidationNetworkChannel network_channel_type = PUSH_CLIENT_CHANNEL; 431 InvalidationNetworkChannel network_channel_type = PUSH_CLIENT_CHANNEL;
432 // For now don't use GCM on iOS.
433 #if !defined(OS_IOS)
434 if (gcm::GCMProfileService::GetGCMEnabledState(profile_) == 432 if (gcm::GCMProfileService::GetGCMEnabledState(profile_) ==
435 gcm::GCMProfileService::ALWAYS_ENABLED && 433 gcm::GCMProfileService::ALWAYS_ENABLED &&
436 (profile_->GetPrefs()->GetBoolean( 434 (profile_->GetPrefs()->GetBoolean(
437 prefs::kInvalidationServiceUseGCMChannel) || 435 prefs::kInvalidationServiceUseGCMChannel) ||
438 CommandLine::ForCurrentProcess()->HasSwitch( 436 CommandLine::ForCurrentProcess()->HasSwitch(
439 switches::kInvalidationUseGCMChannel))) { 437 switches::kInvalidationUseGCMChannel))) {
440 network_channel_type = GCM_NETWORK_CHANNEL; 438 network_channel_type = GCM_NETWORK_CHANNEL;
441 } 439 }
442 #endif
443 if (network_channel_type_ == network_channel_type) 440 if (network_channel_type_ == network_channel_type)
444 return; 441 return;
445 network_channel_type_ = network_channel_type; 442 network_channel_type_ = network_channel_type;
446 if (IsStarted()) { 443 if (IsStarted()) {
447 StopInvalidator(); 444 StopInvalidator();
448 StartInvalidator(network_channel_type_); 445 StartInvalidator(network_channel_type_);
449 } 446 }
450 } 447 }
451 448
452 void TiclInvalidationService::UpdateInvalidatorCredentials() { 449 void TiclInvalidationService::UpdateInvalidatorCredentials() {
453 std::string email = auth_provider_->GetAccountId(); 450 std::string email = auth_provider_->GetAccountId();
454 451
455 DCHECK(!email.empty()) << "Expected user to be signed in."; 452 DCHECK(!email.empty()) << "Expected user to be signed in.";
456 453
457 DVLOG(2) << "UpdateCredentials: " << email; 454 DVLOG(2) << "UpdateCredentials: " << email;
458 invalidator_->UpdateCredentials(email, access_token_); 455 invalidator_->UpdateCredentials(email, access_token_);
459 } 456 }
460 457
461 void TiclInvalidationService::StopInvalidator() { 458 void TiclInvalidationService::StopInvalidator() {
462 DCHECK(invalidator_); 459 DCHECK(invalidator_);
463 gcm_invalidation_bridge_.reset(); 460 gcm_invalidation_bridge_.reset();
464 invalidator_->UnregisterHandler(this); 461 invalidator_->UnregisterHandler(this);
465 invalidator_.reset(); 462 invalidator_.reset();
466 } 463 }
467 464
468 } // namespace invalidation 465 } // namespace invalidation
OLDNEW
« no previous file with comments | « build/all.gyp ('k') | chrome/browser/invalidation/ticl_invalidation_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698