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

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: Ready for initial review. 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 void PageCaptureSaveAsMHTMLFunction::ReturnSuccess(int64 file_size) { 147 void PageCaptureSaveAsMHTMLFunction::ReturnSuccess(int64 file_size) {
148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
149 149
150 WebContents* web_contents = GetWebContents(); 150 WebContents* web_contents = GetWebContents();
151 if (!web_contents || !render_view_host()) { 151 if (!web_contents || !render_view_host()) {
152 ReturnFailure(kTabClosedError); 152 ReturnFailure(kTabClosedError);
153 return; 153 return;
154 } 154 }
155 155
156 int child_id = render_view_host()->process()->GetID(); 156 int child_id = render_view_host()->GetProcess()->GetID();
157 ChildProcessSecurityPolicy::GetInstance()->GrantReadFile( 157 ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(
158 child_id, mhtml_path_); 158 child_id, mhtml_path_);
159 159
160 DictionaryValue* dict = new DictionaryValue(); 160 DictionaryValue* dict = new DictionaryValue();
161 result_.reset(dict); 161 result_.reset(dict);
162 dict->SetString("mhtmlFilePath", mhtml_path_.value()); 162 dict->SetString("mhtmlFilePath", mhtml_path_.value());
163 dict->SetInteger("mhtmlFileLength", file_size); 163 dict->SetInteger("mhtmlFileLength", file_size);
164 164
165 SendResponse(true); 165 SendResponse(true);
166 166
167 // Note that we'll wait for a response ack message received in 167 // Note that we'll wait for a response ack message received in
168 // OnMessageReceivedFromRenderView before we call Release() (to prevent the 168 // OnMessageReceivedFromRenderView before we call Release() (to prevent the
169 // blob file from being deleted). 169 // blob file from being deleted).
170 } 170 }
171 171
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698