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

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

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR, fix a weird runtime issue. Created 8 years, 9 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 | Annotate | Revision Log
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 void PageCaptureSaveAsMHTMLFunction::ReturnSuccess(int64 file_size) { 163 void PageCaptureSaveAsMHTMLFunction::ReturnSuccess(int64 file_size) {
164 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 164 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
165 165
166 WebContents* web_contents = GetWebContents(); 166 WebContents* web_contents = GetWebContents();
167 if (!web_contents || !render_view_host()) { 167 if (!web_contents || !render_view_host()) {
168 ReturnFailure(kTabClosedError); 168 ReturnFailure(kTabClosedError);
169 return; 169 return;
170 } 170 }
171 171
172 int child_id = render_view_host()->process()->GetID(); 172 int child_id = render_view_host()->GetProcess()->GetID();
173 ChildProcessSecurityPolicy::GetInstance()->GrantReadFile( 173 ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(
174 child_id, mhtml_path_); 174 child_id, mhtml_path_);
175 175
176 DictionaryValue* dict = new DictionaryValue(); 176 DictionaryValue* dict = new DictionaryValue();
177 result_.reset(dict); 177 result_.reset(dict);
178 dict->SetString("mhtmlFilePath", mhtml_path_.value()); 178 dict->SetString("mhtmlFilePath", mhtml_path_.value());
179 dict->SetInteger("mhtmlFileLength", file_size); 179 dict->SetInteger("mhtmlFileLength", file_size);
180 180
181 SendResponse(true); 181 SendResponse(true);
182 182
183 // Note that we'll wait for a response ack message received in 183 // Note that we'll wait for a response ack message received in
184 // OnMessageReceivedFromRenderView before we call Release() (to prevent the 184 // OnMessageReceivedFromRenderView before we call Release() (to prevent the
185 // blob file from being deleted). 185 // blob file from being deleted).
186 } 186 }
187 187
188 WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() { 188 WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() {
189 Browser* browser = NULL; 189 Browser* browser = NULL;
190 TabContentsWrapper* tab_contents_wrapper = NULL; 190 TabContentsWrapper* tab_contents_wrapper = NULL;
191 191
192 if (!ExtensionTabUtil::GetTabById(tab_id_, profile(), include_incognito(), 192 if (!ExtensionTabUtil::GetTabById(tab_id_, profile(), include_incognito(),
193 &browser, NULL, &tab_contents_wrapper, NULL)) { 193 &browser, NULL, &tab_contents_wrapper, NULL)) {
194 return NULL; 194 return NULL;
195 } 195 }
196 return tab_contents_wrapper->web_contents(); 196 return tab_contents_wrapper->web_contents();
197 } 197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698