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

Side by Side Diff: chrome/browser/chrome_to_mobile_service.cc

Issue 10412050: Change most content::URLFetcher references to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS, address comments Created 8 years, 7 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 | Annotate | Revision Log
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/chrome_to_mobile_service.h" 5 #include "chrome/browser/chrome_to_mobile_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 342 }
343 } 343 }
344 344
345 net::URLFetcher* ChromeToMobileService::CreateRequest( 345 net::URLFetcher* ChromeToMobileService::CreateRequest(
346 const RequestData& data) { 346 const RequestData& data) {
347 bool get = data.type != SNAPSHOT; 347 bool get = data.type != SNAPSHOT;
348 GURL service_url(cloud_print_url_->GetCloudPrintServiceURL()); 348 GURL service_url(cloud_print_url_->GetCloudPrintServiceURL());
349 net::URLFetcher* request = content::URLFetcher::Create( 349 net::URLFetcher* request = content::URLFetcher::Create(
350 data.type == SEARCH ? GetSearchURL(service_url) : 350 data.type == SEARCH ? GetSearchURL(service_url) :
351 GetSubmitURL(service_url, data), 351 GetSubmitURL(service_url, data),
352 get ? content::URLFetcher::GET : content::URLFetcher::POST, this); 352 get ? net::URLFetcher::GET : net::URLFetcher::POST, this);
353 request->SetRequestContext(profile_->GetRequestContext()); 353 request->SetRequestContext(profile_->GetRequestContext());
354 request->SetMaxRetries(kMaxRetries); 354 request->SetMaxRetries(kMaxRetries);
355 request->SetExtraRequestHeaders("Authorization: OAuth " + 355 request->SetExtraRequestHeaders("Authorization: OAuth " +
356 access_token_ + "\r\n" + cloud_print::kChromeCloudPrintProxyHeader); 356 access_token_ + "\r\n" + cloud_print::kChromeCloudPrintProxyHeader);
357 request->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 357 request->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
358 net::LOAD_DO_NOT_SAVE_COOKIES); 358 net::LOAD_DO_NOT_SAVE_COOKIES);
359 return request; 359 return request;
360 } 360 }
361 361
362 void ChromeToMobileService::RefreshAccessToken() { 362 void ChromeToMobileService::RefreshAccessToken() {
(...skipping 27 matching lines...) Expand all
390 // blocked, access cloud print directly to list any potential devices. 390 // blocked, access cloud print directly to list any potential devices.
391 scoped_refptr<CookieSettings> cookie_settings = 391 scoped_refptr<CookieSettings> cookie_settings =
392 CookieSettings::Factory::GetForProfile(profile_); 392 CookieSettings::Factory::GetForProfile(profile_);
393 if (cookie_settings && !cookie_settings->IsReadingCookieAllowed(url, url)) { 393 if (cookie_settings && !cookie_settings->IsReadingCookieAllowed(url, url)) {
394 cloud_print_accessible_ = true; 394 cloud_print_accessible_ = true;
395 RequestMobileListUpdate(); 395 RequestMobileListUpdate();
396 return; 396 return;
397 } 397 }
398 398
399 account_info_request_.reset( 399 account_info_request_.reset(
400 content::URLFetcher::Create(url, content::URLFetcher::GET, this)); 400 content::URLFetcher::Create(url, net::URLFetcher::GET, this));
401 account_info_request_->SetRequestContext(profile_->GetRequestContext()); 401 account_info_request_->SetRequestContext(profile_->GetRequestContext());
402 account_info_request_->SetMaxRetries(kMaxRetries); 402 account_info_request_->SetMaxRetries(kMaxRetries);
403 // This request sends the user's cookie to check the cloud print service flag. 403 // This request sends the user's cookie to check the cloud print service flag.
404 account_info_request_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); 404 account_info_request_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES);
405 account_info_request_->Start(); 405 account_info_request_->Start();
406 } 406 }
407 407
408 void ChromeToMobileService::RequestSearch() { 408 void ChromeToMobileService::RequestSearch() {
409 DCHECK(!access_token_.empty()); 409 DCHECK(!access_token_.empty());
410 410
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 510
511 // Ensure a second response is not sent after reporting failure below. 511 // Ensure a second response is not sent after reporting failure below.
512 request_observer_map_.erase(other); 512 request_observer_map_.erase(other);
513 break; 513 break;
514 } 514 }
515 } 515 }
516 516
517 LogMetric(success ? SEND_SUCCESS : SEND_ERROR); 517 LogMetric(success ? SEND_SUCCESS : SEND_ERROR);
518 observer->OnSendComplete(success); 518 observer->OnSendComplete(success);
519 } 519 }
OLDNEW
« no previous file with comments | « chrome/browser/captive_portal/captive_portal_service_unittest.cc ('k') | chrome/browser/chromeos/customization_document.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698