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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 network_channel_options_.SetString("Options.HostPort", | 388 network_channel_options_.SetString("Options.HostPort", |
388 options.xmpp_host_port.ToString()); | 389 options.xmpp_host_port.ToString()); |
389 network_channel_options_.SetString("Options.AuthMechanism", | 390 network_channel_options_.SetString("Options.AuthMechanism", |
390 options.auth_mechanism); | 391 options.auth_mechanism); |
391 DCHECK_EQ(notifier::NOTIFICATION_SERVER, options.notification_method); | 392 DCHECK_EQ(notifier::NOTIFICATION_SERVER, options.notification_method); |
392 network_channel_creator = | 393 network_channel_creator = |
393 syncer::NonBlockingInvalidator::MakePushClientChannelCreator(options); | 394 syncer::NonBlockingInvalidator::MakePushClientChannelCreator(options); |
394 break; | 395 break; |
395 } | 396 } |
396 case GCM_NETWORK_CHANNEL: { | 397 case GCM_NETWORK_CHANNEL: { |
397 gcm::GCMProfileService* gcm_profile_service = | 398 gcm::GCMService* gcm_service = |
398 gcm::GCMProfileServiceFactory::GetForProfile(profile_); | 399 gcm::GCMProfileServiceFactory::GetForProfile(profile_); |
399 gcm_invalidation_bridge_.reset(new GCMInvalidationBridge( | 400 gcm_invalidation_bridge_.reset(new GCMInvalidationBridge( |
400 gcm_profile_service, identity_provider_.get())); | 401 gcm_service, identity_provider_.get())); |
401 network_channel_creator = | 402 network_channel_creator = |
402 syncer::NonBlockingInvalidator::MakeGCMNetworkChannelCreator( | 403 syncer::NonBlockingInvalidator::MakeGCMNetworkChannelCreator( |
403 request_context_, | 404 request_context_, |
404 gcm_invalidation_bridge_->CreateDelegate().Pass()); | 405 gcm_invalidation_bridge_->CreateDelegate().Pass()); |
405 break; | 406 break; |
406 } | 407 } |
407 default: { | 408 default: { |
408 NOTREACHED(); | 409 NOTREACHED(); |
409 return; | 410 return; |
410 } | 411 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 } | 456 } |
456 | 457 |
457 void TiclInvalidationService::StopInvalidator() { | 458 void TiclInvalidationService::StopInvalidator() { |
458 DCHECK(invalidator_); | 459 DCHECK(invalidator_); |
459 gcm_invalidation_bridge_.reset(); | 460 gcm_invalidation_bridge_.reset(); |
460 invalidator_->UnregisterHandler(this); | 461 invalidator_->UnregisterHandler(this); |
461 invalidator_.reset(); | 462 invalidator_.reset(); |
462 } | 463 } |
463 | 464 |
464 } // namespace invalidation | 465 } // namespace invalidation |
OLD | NEW |