OLD | NEW |
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" |
11 #include "chrome/browser/invalidation/invalidation_service_util.h" | 11 #include "chrome/browser/invalidation/invalidation_service_util.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 13 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
14 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 14 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 15 #include "chrome/browser/services/gcm/gcm_service.h" |
15 #include "chrome/common/chrome_content_client.h" | 16 #include "chrome/common/chrome_content_client.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
18 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 19 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
19 #include "google_apis/gaia/gaia_constants.h" | 20 #include "google_apis/gaia/gaia_constants.h" |
20 #include "net/url_request/url_request_context_getter.h" | 21 #include "net/url_request/url_request_context_getter.h" |
21 #include "sync/notifier/gcm_network_channel_delegate.h" | 22 #include "sync/notifier/gcm_network_channel_delegate.h" |
22 #include "sync/notifier/invalidation_util.h" | 23 #include "sync/notifier/invalidation_util.h" |
23 #include "sync/notifier/invalidator.h" | 24 #include "sync/notifier/invalidator.h" |
24 #include "sync/notifier/invalidator_state.h" | 25 #include "sync/notifier/invalidator_state.h" |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 network_channel_options_.SetString("Options.HostPort", | 384 network_channel_options_.SetString("Options.HostPort", |
384 options.xmpp_host_port.ToString()); | 385 options.xmpp_host_port.ToString()); |
385 network_channel_options_.SetString("Options.AuthMechanism", | 386 network_channel_options_.SetString("Options.AuthMechanism", |
386 options.auth_mechanism); | 387 options.auth_mechanism); |
387 DCHECK_EQ(notifier::NOTIFICATION_SERVER, options.notification_method); | 388 DCHECK_EQ(notifier::NOTIFICATION_SERVER, options.notification_method); |
388 network_channel_creator = | 389 network_channel_creator = |
389 syncer::NonBlockingInvalidator::MakePushClientChannelCreator(options); | 390 syncer::NonBlockingInvalidator::MakePushClientChannelCreator(options); |
390 break; | 391 break; |
391 } | 392 } |
392 case GCM_NETWORK_CHANNEL: { | 393 case GCM_NETWORK_CHANNEL: { |
393 gcm::GCMProfileService* gcm_profile_service = | 394 gcm::GCMService* gcm_service = |
394 gcm::GCMProfileServiceFactory::GetForProfile(profile_); | 395 gcm::GCMProfileServiceFactory::GetForProfile(profile_); |
395 gcm_invalidation_bridge_.reset(new GCMInvalidationBridge( | 396 gcm_invalidation_bridge_.reset(new GCMInvalidationBridge( |
396 gcm_profile_service, identity_provider_.get())); | 397 gcm_service, identity_provider_.get())); |
397 network_channel_creator = | 398 network_channel_creator = |
398 syncer::NonBlockingInvalidator::MakeGCMNetworkChannelCreator( | 399 syncer::NonBlockingInvalidator::MakeGCMNetworkChannelCreator( |
399 request_context_, | 400 request_context_, |
400 gcm_invalidation_bridge_->CreateDelegate().Pass()); | 401 gcm_invalidation_bridge_->CreateDelegate().Pass()); |
401 break; | 402 break; |
402 } | 403 } |
403 default: { | 404 default: { |
404 NOTREACHED(); | 405 NOTREACHED(); |
405 return; | 406 return; |
406 } | 407 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 } | 452 } |
452 | 453 |
453 void TiclInvalidationService::StopInvalidator() { | 454 void TiclInvalidationService::StopInvalidator() { |
454 DCHECK(invalidator_); | 455 DCHECK(invalidator_); |
455 gcm_invalidation_bridge_.reset(); | 456 gcm_invalidation_bridge_.reset(); |
456 invalidator_->UnregisterHandler(this); | 457 invalidator_->UnregisterHandler(this); |
457 invalidator_.reset(); | 458 invalidator_.reset(); |
458 } | 459 } |
459 | 460 |
460 } // namespace invalidation | 461 } // namespace invalidation |
OLD | NEW |