Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: chrome/browser/extensions/extension_page_capture_api.cc

Issue 10694106: Added support for multiple parameters to Extension API callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Synced. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 if (!web_contents || !render_view_host()) { 166 if (!web_contents || !render_view_host()) {
167 ReturnFailure(kTabClosedError); 167 ReturnFailure(kTabClosedError);
168 return; 168 return;
169 } 169 }
170 170
171 int child_id = render_view_host()->GetProcess()->GetID(); 171 int child_id = render_view_host()->GetProcess()->GetID();
172 ChildProcessSecurityPolicy::GetInstance()->GrantReadFile( 172 ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(
173 child_id, mhtml_path_); 173 child_id, mhtml_path_);
174 174
175 DictionaryValue* dict = new DictionaryValue(); 175 DictionaryValue* dict = new DictionaryValue();
176 result_.reset(dict); 176 SetResult(dict);
177 dict->SetString("mhtmlFilePath", mhtml_path_.value()); 177 dict->SetString("mhtmlFilePath", mhtml_path_.value());
178 dict->SetInteger("mhtmlFileLength", file_size); 178 dict->SetInteger("mhtmlFileLength", file_size);
179 179
180 SendResponse(true); 180 SendResponse(true);
181 181
182 // Note that we'll wait for a response ack message received in 182 // Note that we'll wait for a response ack message received in
183 // OnMessageReceivedFromRenderView before we call Release() (to prevent the 183 // OnMessageReceivedFromRenderView before we call Release() (to prevent the
184 // blob file from being deleted). 184 // blob file from being deleted).
185 } 185 }
186 186
187 WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() { 187 WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() {
188 Browser* browser = NULL; 188 Browser* browser = NULL;
189 TabContents* tab_contents = NULL; 189 TabContents* tab_contents = 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, NULL)) { 192 &browser, NULL, &tab_contents, NULL)) {
193 return NULL; 193 return NULL;
194 } 194 }
195 return tab_contents->web_contents(); 195 return tab_contents->web_contents();
196 } 196 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698