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

Side by Side Diff: chrome/browser/profiles/profile_downloader.cc

Issue 1339943003: Revert "Report data usage UMA for Chrome services" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/spellchecker/feedback_sender.cc » ('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/profiles/profile_downloader.h" 5 #include "chrome/browser/profiles/profile_downloader.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/strings/string_split.h" 13 #include "base/strings/string_split.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/profiles/profile_downloader_delegate.h" 19 #include "chrome/browser/profiles/profile_downloader_delegate.h"
20 #include "chrome/browser/profiles/profile_manager.h" 20 #include "chrome/browser/profiles/profile_manager.h"
21 #include "chrome/browser/signin/account_fetcher_service_factory.h" 21 #include "chrome/browser/signin/account_fetcher_service_factory.h"
22 #include "chrome/browser/signin/account_tracker_service_factory.h" 22 #include "chrome/browser/signin/account_tracker_service_factory.h"
23 #include "chrome/browser/signin/chrome_signin_client_factory.h" 23 #include "chrome/browser/signin/chrome_signin_client_factory.h"
24 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 24 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
25 #include "chrome/browser/signin/signin_manager_factory.h" 25 #include "chrome/browser/signin/signin_manager_factory.h"
26 #include "components/data_use_measurement/core/data_use_user_data.h"
27 #include "components/signin/core/browser/account_fetcher_service.h" 26 #include "components/signin/core/browser/account_fetcher_service.h"
28 #include "components/signin/core/browser/profile_oauth2_token_service.h" 27 #include "components/signin/core/browser/profile_oauth2_token_service.h"
29 #include "components/signin/core/browser/signin_client.h" 28 #include "components/signin/core/browser/signin_client.h"
30 #include "components/signin/core/browser/signin_manager.h" 29 #include "components/signin/core/browser/signin_manager.h"
31 #include "components/signin/core/common/profile_management_switches.h" 30 #include "components/signin/core/common/profile_management_switches.h"
32 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
33 #include "google_apis/gaia/gaia_constants.h" 32 #include "google_apis/gaia/gaia_constants.h"
34 #include "net/base/load_flags.h" 33 #include "net/base/load_flags.h"
35 #include "net/url_request/url_fetcher.h" 34 #include "net/url_request/url_fetcher.h"
36 #include "net/url_request/url_request_status.h" 35 #include "net/url_request/url_request_status.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 image_url_with_size == delegate_->GetCachedPictureURL()) { 278 image_url_with_size == delegate_->GetCachedPictureURL()) {
280 VLOG(1) << "Picture URL matches cached picture URL"; 279 VLOG(1) << "Picture URL matches cached picture URL";
281 picture_status_ = PICTURE_CACHED; 280 picture_status_ = PICTURE_CACHED;
282 delegate_->OnProfileDownloadSuccess(this); 281 delegate_->OnProfileDownloadSuccess(this);
283 return; 282 return;
284 } 283 }
285 284
286 VLOG(1) << "Fetching profile image from " << image_url_with_size; 285 VLOG(1) << "Fetching profile image from " << image_url_with_size;
287 profile_image_fetcher_ = net::URLFetcher::Create( 286 profile_image_fetcher_ = net::URLFetcher::Create(
288 GURL(image_url_with_size), net::URLFetcher::GET, this); 287 GURL(image_url_with_size), net::URLFetcher::GET, this);
289 data_use_measurement::DataUseUserData::AttachToFetcher(
290 profile_image_fetcher_.get(),
291 data_use_measurement::DataUseUserData::PROFILE_DOWNLOADER);
292 profile_image_fetcher_->SetRequestContext( 288 profile_image_fetcher_->SetRequestContext(
293 delegate_->GetBrowserProfile()->GetRequestContext()); 289 delegate_->GetBrowserProfile()->GetRequestContext());
294 profile_image_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 290 profile_image_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
295 net::LOAD_DO_NOT_SAVE_COOKIES); 291 net::LOAD_DO_NOT_SAVE_COOKIES);
296 292
297 if (!auth_token_.empty()) { 293 if (!auth_token_.empty()) {
298 profile_image_fetcher_->SetExtraRequestHeaders( 294 profile_image_fetcher_->SetExtraRequestHeaders(
299 base::StringPrintf(kAuthorizationHeader, auth_token_.c_str())); 295 base::StringPrintf(kAuthorizationHeader, auth_token_.c_str()));
300 } 296 }
301 297
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 account_info_ = info; 384 account_info_ = info;
389 385
390 // If the StartFetchingImage was called before we had valid info, the 386 // If the StartFetchingImage was called before we had valid info, the
391 // downloader has been waiting so we need to fetch the image data now. 387 // downloader has been waiting so we need to fetch the image data now.
392 if (waiting_for_account_info_) { 388 if (waiting_for_account_info_) {
393 FetchImageData(); 389 FetchImageData();
394 waiting_for_account_info_ = false; 390 waiting_for_account_info_ = false;
395 } 391 }
396 } 392 }
397 } 393 }
OLDNEW
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/spellchecker/feedback_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698