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/extension_page_capture_api.h" | 5 #include "chrome/browser/extensions/extension_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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 base::Bind(&PageCaptureSaveAsMHTMLFunction::CreateTemporaryFile, this)); | 59 base::Bind(&PageCaptureSaveAsMHTMLFunction::CreateTemporaryFile, this)); |
60 return true; | 60 return true; |
61 } | 61 } |
62 | 62 |
63 bool PageCaptureSaveAsMHTMLFunction::OnMessageReceivedFromRenderView( | 63 bool PageCaptureSaveAsMHTMLFunction::OnMessageReceivedFromRenderView( |
64 const IPC::Message& message) { | 64 const IPC::Message& message) { |
65 if (message.type() != ExtensionHostMsg_ResponseAck::ID) | 65 if (message.type() != ExtensionHostMsg_ResponseAck::ID) |
66 return false; | 66 return false; |
67 | 67 |
68 int message_request_id; | 68 int message_request_id; |
69 void* iter = NULL; | 69 PickleReader iter(message); |
70 if (!message.ReadInt(&iter, &message_request_id)) { | 70 if (!message.ReadInt(&iter, &message_request_id)) { |
71 NOTREACHED() << "malformed extension message"; | 71 NOTREACHED() << "malformed extension message"; |
72 return true; | 72 return true; |
73 } | 73 } |
74 | 74 |
75 if (message_request_id != request_id()) | 75 if (message_request_id != request_id()) |
76 return false; | 76 return false; |
77 | 77 |
78 // The extension process has processed the response and has created a | 78 // The extension process has processed the response and has created a |
79 // reference to the blob, it is safe for us to go away. | 79 // reference to the blob, it is safe for us to go away. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() { | 172 WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() { |
173 Browser* browser = NULL; | 173 Browser* browser = NULL; |
174 TabContentsWrapper* tab_contents_wrapper = NULL; | 174 TabContentsWrapper* tab_contents_wrapper = NULL; |
175 | 175 |
176 if (!ExtensionTabUtil::GetTabById(tab_id_, profile(), include_incognito(), | 176 if (!ExtensionTabUtil::GetTabById(tab_id_, profile(), include_incognito(), |
177 &browser, NULL, &tab_contents_wrapper, NULL)) { | 177 &browser, NULL, &tab_contents_wrapper, NULL)) { |
178 return NULL; | 178 return NULL; |
179 } | 179 } |
180 return tab_contents_wrapper->web_contents(); | 180 return tab_contents_wrapper->web_contents(); |
181 } | 181 } |
OLD | NEW |