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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 base::Bind(&PageCaptureSaveAsMHTMLFunction::CreateTemporaryFile, this)); | 65 base::Bind(&PageCaptureSaveAsMHTMLFunction::CreateTemporaryFile, this)); |
66 return true; | 66 return true; |
67 } | 67 } |
68 | 68 |
69 bool PageCaptureSaveAsMHTMLFunction::OnMessageReceivedFromRenderView( | 69 bool PageCaptureSaveAsMHTMLFunction::OnMessageReceivedFromRenderView( |
70 const IPC::Message& message) { | 70 const IPC::Message& message) { |
71 if (message.type() != ExtensionHostMsg_ResponseAck::ID) | 71 if (message.type() != ExtensionHostMsg_ResponseAck::ID) |
72 return false; | 72 return false; |
73 | 73 |
74 int message_request_id; | 74 int message_request_id; |
75 void* iter = NULL; | 75 PickleIterator iter(message); |
76 if (!message.ReadInt(&iter, &message_request_id)) { | 76 if (!message.ReadInt(&iter, &message_request_id)) { |
77 NOTREACHED() << "malformed extension message"; | 77 NOTREACHED() << "malformed extension message"; |
78 return true; | 78 return true; |
79 } | 79 } |
80 | 80 |
81 if (message_request_id != request_id()) | 81 if (message_request_id != request_id()) |
82 return false; | 82 return false; |
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. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() { | 187 WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() { |
188 Browser* browser = NULL; | 188 Browser* browser = NULL; |
189 TabContentsWrapper* tab_contents_wrapper = NULL; | 189 TabContentsWrapper* tab_contents_wrapper = NULL; |
190 | 190 |
191 if (!ExtensionTabUtil::GetTabById(tab_id_, profile(), include_incognito(), | 191 if (!ExtensionTabUtil::GetTabById(tab_id_, profile(), include_incognito(), |
192 &browser, NULL, &tab_contents_wrapper, NULL)) { | 192 &browser, NULL, &tab_contents_wrapper, NULL)) { |
193 return NULL; | 193 return NULL; |
194 } | 194 } |
195 return tab_contents_wrapper->web_contents(); | 195 return tab_contents_wrapper->web_contents(); |
196 } | 196 } |
OLD | NEW |