Chromium Code Reviews| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/extensions/extension_tab_util.h" | 10 #include "chrome/browser/extensions/extension_tab_util.h" |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 static PageCaptureSaveAsMHTMLFunction::TestDelegate* test_delegate_ = NULL; | 40 static PageCaptureSaveAsMHTMLFunction::TestDelegate* test_delegate_ = NULL; |
| 41 | 41 |
| 42 PageCaptureSaveAsMHTMLFunction::PageCaptureSaveAsMHTMLFunction() { | 42 PageCaptureSaveAsMHTMLFunction::PageCaptureSaveAsMHTMLFunction() { |
| 43 } | 43 } |
| 44 | 44 |
| 45 PageCaptureSaveAsMHTMLFunction::~PageCaptureSaveAsMHTMLFunction() { | 45 PageCaptureSaveAsMHTMLFunction::~PageCaptureSaveAsMHTMLFunction() { |
| 46 if (mhtml_file_.get()) { | 46 if (mhtml_file_.get()) { |
| 47 mhtml_file_->AddRef(); | |
| 47 BrowserThread::ReleaseSoon(BrowserThread::IO, FROM_HERE, | 48 BrowserThread::ReleaseSoon(BrowserThread::IO, FROM_HERE, |
| 48 mhtml_file_.release()); | 49 mhtml_file_.get()); |
|
michaeln
2012/12/06 00:26:12
This pattern is buggy.
You should also clear out
piman
2012/12/06 04:56:27
You're right, done. I verified that the other chan
| |
| 49 } | 50 } |
| 50 } | 51 } |
| 51 | 52 |
| 52 void PageCaptureSaveAsMHTMLFunction::SetTestDelegate(TestDelegate* delegate) { | 53 void PageCaptureSaveAsMHTMLFunction::SetTestDelegate(TestDelegate* delegate) { |
| 53 test_delegate_ = delegate; | 54 test_delegate_ = delegate; |
| 54 } | 55 } |
| 55 | 56 |
| 56 bool PageCaptureSaveAsMHTMLFunction::RunImpl() { | 57 bool PageCaptureSaveAsMHTMLFunction::RunImpl() { |
| 57 params_ = SaveAsMHTML::Params::Create(*args_); | 58 params_ = SaveAsMHTML::Params::Create(*args_); |
| 58 EXTENSION_FUNCTION_VALIDATE(params_.get()); | 59 EXTENSION_FUNCTION_VALIDATE(params_.get()); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 Browser* browser = NULL; | 188 Browser* browser = NULL; |
| 188 content::WebContents* web_contents = NULL; | 189 content::WebContents* web_contents = NULL; |
| 189 | 190 |
| 190 if (!ExtensionTabUtil::GetTabById(params_->details.tab_id, profile(), | 191 if (!ExtensionTabUtil::GetTabById(params_->details.tab_id, profile(), |
| 191 include_incognito(), &browser, NULL, | 192 include_incognito(), &browser, NULL, |
| 192 &web_contents, NULL)) { | 193 &web_contents, NULL)) { |
| 193 return NULL; | 194 return NULL; |
| 194 } | 195 } |
| 195 return web_contents; | 196 return web_contents; |
| 196 } | 197 } |
| OLD | NEW |