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

Side by Side Diff: chrome/browser/extensions/api/image_writer_private/write_from_url_operation.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "base/files/file_util.h" 5 #include "base/files/file_util.h"
6 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" 6 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h"
7 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h " 7 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h "
8 #include "chrome/browser/extensions/api/image_writer_private/write_from_url_oper ation.h" 8 #include "chrome/browser/extensions/api/image_writer_private/write_from_url_oper ation.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "net/url_request/url_fetcher.h" 10 #include "net/url_request/url_fetcher.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 if (IsCancelled()) { 77 if (IsCancelled()) {
78 return; 78 return;
79 } 79 }
80 80
81 download_continuation_ = continuation; 81 download_continuation_ = continuation;
82 82
83 SetStage(image_writer_api::STAGE_DOWNLOAD); 83 SetStage(image_writer_api::STAGE_DOWNLOAD);
84 84
85 // Store the URL fetcher on this object so that it is destroyed before this 85 // Store the URL fetcher on this object so that it is destroyed before this
86 // object is. 86 // object is.
87 url_fetcher_.reset(net::URLFetcher::Create(url_, net::URLFetcher::GET, this)); 87 url_fetcher_ = net::URLFetcher::Create(url_, net::URLFetcher::GET, this);
88 88
89 url_fetcher_->SetRequestContext(request_context_); 89 url_fetcher_->SetRequestContext(request_context_);
90 url_fetcher_->SaveResponseToFileAtPath( 90 url_fetcher_->SaveResponseToFileAtPath(
91 image_path_, 91 image_path_,
92 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 92 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
93 93
94 AddCleanUpFunction( 94 AddCleanUpFunction(
95 base::Bind(&WriteFromUrlOperation::DestroyUrlFetcher, this)); 95 base::Bind(&WriteFromUrlOperation::DestroyUrlFetcher, this));
96 96
97 url_fetcher_->Start(); 97 url_fetcher_->Start();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 if (IsCancelled()) { 182 if (IsCancelled()) {
183 return; 183 return;
184 } 184 }
185 185
186 SetProgress(kProgressComplete); 186 SetProgress(kProgressComplete);
187 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, continuation); 187 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, continuation);
188 } 188 }
189 189
190 } // namespace image_writer 190 } // namespace image_writer
191 } // namespace extensions 191 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_ui_bindings.cc ('k') | chrome/browser/extensions/blacklist_state_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698