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_auth_provider.h" | 11 #include "chrome/browser/invalidation/invalidation_auth_provider.h" |
12 #include "chrome/browser/invalidation/invalidation_logger.h" | 12 #include "chrome/browser/invalidation/invalidation_logger.h" |
13 #include "chrome/browser/invalidation/invalidation_service_util.h" | 13 #include "chrome/browser/invalidation/invalidation_service_util.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 15 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
16 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 16 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
17 #include "chrome/browser/services/gcm/gcm_service.h" | |
17 #include "chrome/common/chrome_content_client.h" | 18 #include "chrome/common/chrome_content_client.h" |
18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
20 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 21 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
21 #include "google_apis/gaia/gaia_constants.h" | 22 #include "google_apis/gaia/gaia_constants.h" |
22 #include "net/url_request/url_request_context_getter.h" | 23 #include "net/url_request/url_request_context_getter.h" |
23 #include "sync/notifier/gcm_network_channel_delegate.h" | 24 #include "sync/notifier/gcm_network_channel_delegate.h" |
24 #include "sync/notifier/invalidation_util.h" | 25 #include "sync/notifier/invalidation_util.h" |
25 #include "sync/notifier/invalidator.h" | 26 #include "sync/notifier/invalidator.h" |
26 #include "sync/notifier/invalidator_state.h" | 27 #include "sync/notifier/invalidator_state.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
394 network_channel_options_.SetString("Options.HostPort", | 395 network_channel_options_.SetString("Options.HostPort", |
395 options.xmpp_host_port.ToString()); | 396 options.xmpp_host_port.ToString()); |
396 network_channel_options_.SetString("Options.AuthMechanism", | 397 network_channel_options_.SetString("Options.AuthMechanism", |
397 options.auth_mechanism); | 398 options.auth_mechanism); |
398 DCHECK_EQ(notifier::NOTIFICATION_SERVER, options.notification_method); | 399 DCHECK_EQ(notifier::NOTIFICATION_SERVER, options.notification_method); |
399 network_channel_creator = | 400 network_channel_creator = |
400 syncer::NonBlockingInvalidator::MakePushClientChannelCreator(options); | 401 syncer::NonBlockingInvalidator::MakePushClientChannelCreator(options); |
401 break; | 402 break; |
402 } | 403 } |
403 case GCM_NETWORK_CHANNEL: { | 404 case GCM_NETWORK_CHANNEL: { |
404 gcm::GCMProfileService* gcm_profile_service = | 405 gcm::GCMService* gcm_service = |
jianli
2014/04/10 20:39:56
ditto
bartfab (slow)
2014/04/11 16:58:52
This is the core of my work - I am removing the Pr
| |
405 gcm::GCMProfileServiceFactory::GetForProfile(profile_); | 406 gcm::GCMProfileServiceFactory::GetForProfile(profile_); |
406 gcm_invalidation_bridge_.reset( | 407 gcm_invalidation_bridge_.reset( |
407 new GCMInvalidationBridge(gcm_profile_service, auth_provider_.get())); | 408 new GCMInvalidationBridge(gcm_service, auth_provider_.get())); |
408 network_channel_creator = | 409 network_channel_creator = |
409 syncer::NonBlockingInvalidator::MakeGCMNetworkChannelCreator( | 410 syncer::NonBlockingInvalidator::MakeGCMNetworkChannelCreator( |
410 request_context_, | 411 request_context_, |
411 gcm_invalidation_bridge_->CreateDelegate().Pass()); | 412 gcm_invalidation_bridge_->CreateDelegate().Pass()); |
412 break; | 413 break; |
413 } | 414 } |
414 default: { | 415 default: { |
415 NOTREACHED(); | 416 NOTREACHED(); |
416 return; | 417 return; |
417 } | 418 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
463 } | 464 } |
464 | 465 |
465 void TiclInvalidationService::StopInvalidator() { | 466 void TiclInvalidationService::StopInvalidator() { |
466 DCHECK(invalidator_); | 467 DCHECK(invalidator_); |
467 gcm_invalidation_bridge_.reset(); | 468 gcm_invalidation_bridge_.reset(); |
468 invalidator_->UnregisterHandler(this); | 469 invalidator_->UnregisterHandler(this); |
469 invalidator_.reset(); | 470 invalidator_.reset(); |
470 } | 471 } |
471 | 472 |
472 } // namespace invalidation | 473 } // namespace invalidation |
OLD | NEW |