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

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

Issue 140513002: Client-to-server messages in GCMNetworkChannel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mac build error (for real) Created 6 years, 11 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 | sync/notifier/DEPS » ('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 "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/invalidation/invalidation_service_util.h" 10 #include "chrome/browser/invalidation/invalidation_service_util.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/signin/about_signin_internals.h" 12 #include "chrome/browser/signin/about_signin_internals.h"
13 #include "chrome/browser/signin/about_signin_internals_factory.h" 13 #include "chrome/browser/signin/about_signin_internals_factory.h"
14 #include "chrome/browser/signin/profile_oauth2_token_service.h" 14 #include "chrome/browser/signin/profile_oauth2_token_service.h"
15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
16 #include "chrome/browser/signin/signin_manager.h" 16 #include "chrome/browser/signin/signin_manager.h"
17 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
18 #include "google_apis/gaia/gaia_constants.h" 18 #include "google_apis/gaia/gaia_constants.h"
19 #include "sync/notifier/gcm_network_channel_delegate.h"
19 #include "sync/notifier/invalidator.h" 20 #include "sync/notifier/invalidator.h"
20 #include "sync/notifier/invalidator_state.h" 21 #include "sync/notifier/invalidator_state.h"
21 #include "sync/notifier/non_blocking_invalidator.h" 22 #include "sync/notifier/non_blocking_invalidator.h"
22 23
23 static const char* kOAuth2Scopes[] = { 24 static const char* kOAuth2Scopes[] = {
24 GaiaConstants::kGoogleTalkOAuth2Scope 25 GaiaConstants::kGoogleTalkOAuth2Scope
25 }; 26 };
26 27
27 static const net::BackoffEntry::Policy kRequestAccessTokenBackoffPolicy = { 28 static const net::BackoffEntry::Policy kRequestAccessTokenBackoffPolicy = {
28 // Number of initial errors (in sequence) to ignore before applying 29 // Number of initial errors (in sequence) to ignore before applying
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 notifier::NotifierOptions options = 336 notifier::NotifierOptions options =
336 ParseNotifierOptions(*CommandLine::ForCurrentProcess()); 337 ParseNotifierOptions(*CommandLine::ForCurrentProcess());
337 options.request_context_getter = profile_->GetRequestContext(); 338 options.request_context_getter = profile_->GetRequestContext();
338 options.auth_mechanism = "X-OAUTH2"; 339 options.auth_mechanism = "X-OAUTH2";
339 DCHECK_EQ(notifier::NOTIFICATION_SERVER, options.notification_method); 340 DCHECK_EQ(notifier::NOTIFICATION_SERVER, options.notification_method);
340 network_channel_creator = 341 network_channel_creator =
341 syncer::NonBlockingInvalidator::MakePushClientChannelCreator(options); 342 syncer::NonBlockingInvalidator::MakePushClientChannelCreator(options);
342 break; 343 break;
343 } 344 }
344 case GCM_NETWORK_CHANNEL: { 345 case GCM_NETWORK_CHANNEL: {
346 // TODO(pavely): Pass NULL pointer for now. When GCMNetworkChannelDelegate
347 // is implemented it will be instantiated and passed here.
348 scoped_ptr<syncer::GCMNetworkChannelDelegate> delegate;
345 network_channel_creator = 349 network_channel_creator =
346 syncer::NonBlockingInvalidator::MakeGCMNetworkChannelCreator(); 350 syncer::NonBlockingInvalidator::MakeGCMNetworkChannelCreator(
351 profile_->GetRequestContext(),
352 delegate.Pass());
347 break; 353 break;
348 } 354 }
349 default: { 355 default: {
350 NOTREACHED(); 356 NOTREACHED();
351 return; 357 return;
352 } 358 }
353 } 359 }
354 invalidator_.reset(new syncer::NonBlockingInvalidator( 360 invalidator_.reset(new syncer::NonBlockingInvalidator(
355 network_channel_creator, 361 network_channel_creator,
356 invalidator_storage_->GetInvalidatorClientId(), 362 invalidator_storage_->GetInvalidatorClientId(),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 399 }
394 400
395 // This service always expects to have a valid invalidator storage. 401 // This service always expects to have a valid invalidator storage.
396 // So we must not only clear the old one, but also start a new one. 402 // So we must not only clear the old one, but also start a new one.
397 invalidator_storage_->Clear(); 403 invalidator_storage_->Clear();
398 invalidator_storage_.reset(new InvalidatorStorage(profile_->GetPrefs())); 404 invalidator_storage_.reset(new InvalidatorStorage(profile_->GetPrefs()));
399 invalidator_storage_->SetInvalidatorClientId(GenerateInvalidatorClientId()); 405 invalidator_storage_->SetInvalidatorClientId(GenerateInvalidatorClientId());
400 } 406 }
401 407
402 } // namespace invalidation 408 } // namespace invalidation
OLDNEW
« no previous file with comments | « no previous file | sync/notifier/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698