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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
104 // once it is no longer used. | 104 // once it is no longer used. |
105 mhtml_file_ = ShareableFileReference::GetOrCreate( | 105 mhtml_file_ = ShareableFileReference::GetOrCreate( |
106 mhtml_path_, ShareableFileReference::DELETE_ON_FINAL_RELEASE, | 106 mhtml_path_, |
107 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 107 ShareableFileReference::DELETE_ON_FINAL_RELEASE, |
| 108 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) |
| 109 .get()); |
108 } | 110 } |
109 BrowserThread::PostTask( | 111 BrowserThread::PostTask( |
110 BrowserThread::UI, FROM_HERE, | 112 BrowserThread::UI, FROM_HERE, |
111 base::Bind(&PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated, this, | 113 base::Bind(&PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated, this, |
112 success)); | 114 success)); |
113 return; | 115 return; |
114 } | 116 } |
115 | 117 |
116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
117 if (!success) { | 119 if (!success) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 Browser* browser = NULL; | 191 Browser* browser = NULL; |
190 content::WebContents* web_contents = NULL; | 192 content::WebContents* web_contents = NULL; |
191 | 193 |
192 if (!ExtensionTabUtil::GetTabById(params_->details.tab_id, profile(), | 194 if (!ExtensionTabUtil::GetTabById(params_->details.tab_id, profile(), |
193 include_incognito(), &browser, NULL, | 195 include_incognito(), &browser, NULL, |
194 &web_contents, NULL)) { | 196 &web_contents, NULL)) { |
195 return NULL; | 197 return NULL; |
196 } | 198 } |
197 return web_contents; | 199 return web_contents; |
198 } | 200 } |
OLD | NEW |