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

Side by Side Diff: chrome/browser/history/web_history_service.cc

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates to AndroidPO2TS and removing the DCHECK(signin_manager) from GetPrimaryAccountId Created 7 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/history/web_history_service.h" 5 #include "chrome/browser/history/web_history_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 is_pending_(false) { 74 is_pending_(false) {
75 } 75 }
76 76
77 // Tells the request to do its thang. 77 // Tells the request to do its thang.
78 void Start() { 78 void Start() {
79 OAuth2TokenService::ScopeSet oauth_scopes; 79 OAuth2TokenService::ScopeSet oauth_scopes;
80 oauth_scopes.insert(kHistoryOAuthScope); 80 oauth_scopes.insert(kHistoryOAuthScope);
81 81
82 ProfileOAuth2TokenService* token_service = 82 ProfileOAuth2TokenService* token_service =
83 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); 83 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
84 token_request_ = token_service->StartRequest(oauth_scopes, this); 84 token_request_ = token_service->StartRequest(
85 token_service->GetPrimaryAccountId(), oauth_scopes, this);
85 is_pending_ = true; 86 is_pending_ = true;
86 } 87 }
87 88
88 // content::URLFetcherDelegate interface. 89 // content::URLFetcherDelegate interface.
89 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE { 90 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE {
90 DCHECK_EQ(source, url_fetcher_.get()); 91 DCHECK_EQ(source, url_fetcher_.get());
91 response_code_ = url_fetcher_->GetResponseCode(); 92 response_code_ = url_fetcher_->GetResponseCode();
92 93
93 UMA_HISTOGRAM_CUSTOM_ENUMERATION("WebHistory.OAuthTokenResponseCode", 94 UMA_HISTOGRAM_CUSTOM_ENUMERATION("WebHistory.OAuthTokenResponseCode",
94 net::HttpUtil::MapStatusCodeForHistogram(response_code_), 95 net::HttpUtil::MapStatusCodeForHistogram(response_code_),
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 scoped_ptr<DictionaryValue> response_value; 390 scoped_ptr<DictionaryValue> response_value;
390 if (success) { 391 if (success) {
391 response_value = ReadResponse(static_cast<RequestImpl*>(request)); 392 response_value = ReadResponse(static_cast<RequestImpl*>(request));
392 if (response_value) 393 if (response_value)
393 response_value->GetString("version_info", &server_version_info_); 394 response_value->GetString("version_info", &server_version_info_);
394 } 395 }
395 callback.Run(request, response_value.get() && success); 396 callback.Run(request, response_value.get() && success);
396 } 397 }
397 398
398 } // namespace history 399 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698