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 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 base::Bind(&PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated, this, | 99 base::Bind(&PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated, this, |
100 success)); | 100 success)); |
101 } | 101 } |
102 | 102 |
103 void PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated(bool success) { | 103 void PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated(bool success) { |
104 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 104 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
105 if (success) { | 105 if (success) { |
106 // Setup a ShareableFileReference so the temporary file gets deleted | 106 // Setup a ShareableFileReference so the temporary file gets deleted |
107 // once it is no longer used. | 107 // once it is no longer used. |
108 mhtml_file_ = ShareableFileReference::GetOrCreate( | 108 mhtml_file_ = ShareableFileReference::GetOrCreate( |
109 mhtml_path_, | 109 mhtml_path_, ShareableFileReference::DELETE_ON_FINAL_RELEASE, |
110 ShareableFileReference::DELETE_ON_FINAL_RELEASE, | 110 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get()); |
111 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) | |
112 .get()); | |
113 } | 111 } |
114 BrowserThread::PostTask( | 112 BrowserThread::PostTask( |
115 BrowserThread::UI, FROM_HERE, | 113 BrowserThread::UI, FROM_HERE, |
116 base::Bind(&PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated, this, | 114 base::Bind(&PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated, this, |
117 success)); | 115 success)); |
118 return; | 116 return; |
119 } | 117 } |
120 | 118 |
121 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 119 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
122 if (!success) { | 120 if (!success) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 GetProfile(), | 193 GetProfile(), |
196 include_incognito(), | 194 include_incognito(), |
197 &browser, | 195 &browser, |
198 NULL, | 196 NULL, |
199 &web_contents, | 197 &web_contents, |
200 NULL)) { | 198 NULL)) { |
201 return NULL; | 199 return NULL; |
202 } | 200 } |
203 return web_contents; | 201 return web_contents; |
204 } | 202 } |
OLD | NEW |