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

Side by Side Diff: chrome/browser/sync/sync_stopped_reporter.cc

Issue 1117703002: Adjust URLFetcher::Create API so that object is returned as scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded Pass() calls Created 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/sync/sync_stopped_reporter.h" 5 #include "chrome/browser/sync/sync_stopped_reporter.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // Make the request proto with the GUID identifying this client. 49 // Make the request proto with the GUID identifying this client.
50 sync_pb::EventRequest event_request; 50 sync_pb::EventRequest event_request;
51 sync_pb::SyncDisabledEvent* sync_disabled_event = 51 sync_pb::SyncDisabledEvent* sync_disabled_event =
52 event_request.mutable_sync_disabled(); 52 event_request.mutable_sync_disabled();
53 sync_disabled_event->set_cache_guid(cache_guid); 53 sync_disabled_event->set_cache_guid(cache_guid);
54 sync_disabled_event->set_store_birthday(birthday); 54 sync_disabled_event->set_store_birthday(birthday);
55 55
56 std::string msg; 56 std::string msg;
57 event_request.SerializeToString(&msg); 57 event_request.SerializeToString(&msg);
58 58
59 fetcher_.reset(net::URLFetcher::Create( 59 fetcher_ =
60 sync_event_url_, net::URLFetcher::POST, this)); 60 net::URLFetcher::Create(sync_event_url_, net::URLFetcher::POST, this);
61 fetcher_->AddExtraRequestHeader(base::StringPrintf( 61 fetcher_->AddExtraRequestHeader(base::StringPrintf(
62 "%s: Bearer %s", net::HttpRequestHeaders::kAuthorization, 62 "%s: Bearer %s", net::HttpRequestHeaders::kAuthorization,
63 access_token.c_str())); 63 access_token.c_str()));
64 fetcher_->SetRequestContext(request_context_.get()); 64 fetcher_->SetRequestContext(request_context_.get());
65 fetcher_->SetUploadData("application/octet-stream", msg); 65 fetcher_->SetUploadData("application/octet-stream", msg);
66 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES); 66 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES);
67 fetcher_->Start(); 67 fetcher_->Start();
68 timer_.Start(FROM_HERE, kRequestTimeout, this, 68 timer_.Start(FROM_HERE, kRequestTimeout, this,
69 &SyncStoppedReporter::OnTimeout); 69 &SyncStoppedReporter::OnTimeout);
70 } 70 }
(...skipping 28 matching lines...) Expand all
99 replacements.SetPathStr(path); 99 replacements.SetPathStr(path);
100 return sync_service_url.ReplaceComponents(replacements); 100 return sync_service_url.ReplaceComponents(replacements);
101 } 101 }
102 102
103 void SyncStoppedReporter::SetTimerTaskRunnerForTest( 103 void SyncStoppedReporter::SetTimerTaskRunnerForTest(
104 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { 104 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
105 timer_.SetTaskRunner(task_runner); 105 timer_.SetTaskRunner(task_runner);
106 } 106 }
107 107
108 } // namespace browser_sync 108 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698