| OLD | NEW |
| 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/extensions/api/page_capture/page_capture_api.h" | 5 #include "chrome/browser/extensions/api/page_capture/page_capture_api.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 // The extension process has processed the response and has created a | 84 // The extension process has processed the response and has created a |
| 85 // reference to the blob, it is safe for us to go away. | 85 // reference to the blob, it is safe for us to go away. |
| 86 Release(); // Balanced in Run() | 86 Release(); // Balanced in Run() |
| 87 | 87 |
| 88 return true; | 88 return true; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void PageCaptureSaveAsMHTMLFunction::CreateTemporaryFile() { | 91 void PageCaptureSaveAsMHTMLFunction::CreateTemporaryFile() { |
| 92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 93 bool success = file_util::CreateTemporaryFile(&mhtml_path_); | 93 bool success = base::CreateTemporaryFile(&mhtml_path_); |
| 94 BrowserThread::PostTask( | 94 BrowserThread::PostTask( |
| 95 BrowserThread::IO, FROM_HERE, | 95 BrowserThread::IO, FROM_HERE, |
| 96 base::Bind(&PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated, this, | 96 base::Bind(&PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated, this, |
| 97 success)); | 97 success)); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated(bool success) { | 100 void PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated(bool success) { |
| 101 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 101 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 102 if (success) { | 102 if (success) { |
| 103 // Setup a ShareableFileReference so the temporary file gets deleted | 103 // Setup a ShareableFileReference so the temporary file gets deleted |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 GetProfile(), | 193 GetProfile(), |
| 194 include_incognito(), | 194 include_incognito(), |
| 195 &browser, | 195 &browser, |
| 196 NULL, | 196 NULL, |
| 197 &web_contents, | 197 &web_contents, |
| 198 NULL)) { | 198 NULL)) { |
| 199 return NULL; | 199 return NULL; |
| 200 } | 200 } |
| 201 return web_contents; | 201 return web_contents; |
| 202 } | 202 } |
| OLD | NEW |