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

Side by Side Diff: chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc

Issue 2314363002: extensions: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Comment addressed Created 4 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 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 void WriteFromUrlOperation::GetDownloadTarget( 53 void WriteFromUrlOperation::GetDownloadTarget(
54 const base::Closure& continuation) { 54 const base::Closure& continuation) {
55 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 55 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
56 if (IsCancelled()) { 56 if (IsCancelled()) {
57 return; 57 return;
58 } 58 }
59 59
60 if (url_.ExtractFileName().empty()) { 60 if (url_.ExtractFileName().empty()) {
61 if (!base::CreateTemporaryFileInDir(temp_dir_.path(), &image_path_)) { 61 if (!base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &image_path_)) {
62 Error(error::kTempFileError); 62 Error(error::kTempFileError);
63 return; 63 return;
64 } 64 }
65 } else { 65 } else {
66 base::FilePath file_name = 66 base::FilePath file_name =
67 base::FilePath::FromUTF8Unsafe(url_.ExtractFileName()); 67 base::FilePath::FromUTF8Unsafe(url_.ExtractFileName());
68 image_path_ = temp_dir_.path().Append(file_name); 68 image_path_ = temp_dir_.GetPath().Append(file_name);
69 } 69 }
70 70
71 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, continuation); 71 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, continuation);
72 } 72 }
73 73
74 void WriteFromUrlOperation::Download(const base::Closure& continuation) { 74 void WriteFromUrlOperation::Download(const base::Closure& continuation) {
75 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 75 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
76 76
77 if (IsCancelled()) { 77 if (IsCancelled()) {
78 return; 78 return;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (IsCancelled()) { 181 if (IsCancelled()) {
182 return; 182 return;
183 } 183 }
184 184
185 SetProgress(kProgressComplete); 185 SetProgress(kProgressComplete);
186 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, continuation); 186 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, continuation);
187 } 187 }
188 188
189 } // namespace image_writer 189 } // namespace image_writer
190 } // namespace extensions 190 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698