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

Side by Side Diff: chrome/browser/extensions/api/page_capture/page_capture_api.cc

Issue 1991083002: Remove ExtensionFunction::SetResult(T*) overload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU Created 4 years, 7 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/api/page_capture/page_capture_api.h" 5 #include "chrome/browser/extensions/api/page_capture/page_capture_api.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <memory>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
11 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/extensions/extension_tab_util.h" 13 #include "chrome/browser/extensions/extension_tab_util.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "content/public/browser/child_process_security_policy.h" 15 #include "content/public/browser/child_process_security_policy.h"
15 #include "content/public/browser/notification_details.h" 16 #include "content/public/browser/notification_details.h"
16 #include "content/public/browser/notification_source.h" 17 #include "content/public/browser/notification_source.h"
17 #include "content/public/browser/notification_types.h" 18 #include "content/public/browser/notification_types.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 WebContents* web_contents = GetWebContents(); 168 WebContents* web_contents = GetWebContents();
168 if (!web_contents || !render_frame_host()) { 169 if (!web_contents || !render_frame_host()) {
169 ReturnFailure(kTabClosedError); 170 ReturnFailure(kTabClosedError);
170 return; 171 return;
171 } 172 }
172 173
173 int child_id = render_frame_host()->GetProcess()->GetID(); 174 int child_id = render_frame_host()->GetProcess()->GetID();
174 ChildProcessSecurityPolicy::GetInstance()->GrantReadFile( 175 ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(
175 child_id, mhtml_path_); 176 child_id, mhtml_path_);
176 177
177 base::DictionaryValue* dict = new base::DictionaryValue(); 178 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
178 SetResult(dict);
179 dict->SetString("mhtmlFilePath", mhtml_path_.value()); 179 dict->SetString("mhtmlFilePath", mhtml_path_.value());
180 dict->SetInteger("mhtmlFileLength", file_size); 180 dict->SetInteger("mhtmlFileLength", file_size);
181 SetResult(std::move(dict));
181 182
182 SendResponse(true); 183 SendResponse(true);
183 184
184 // Note that we'll wait for a response ack message received in 185 // Note that we'll wait for a response ack message received in
185 // OnMessageReceived before we call Release() (to prevent the blob file from 186 // OnMessageReceived before we call Release() (to prevent the blob file from
186 // being deleted). 187 // being deleted).
187 } 188 }
188 189
189 WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() { 190 WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() {
190 Browser* browser = NULL; 191 Browser* browser = NULL;
191 content::WebContents* web_contents = NULL; 192 content::WebContents* web_contents = NULL;
192 193
193 if (!ExtensionTabUtil::GetTabById(params_->details.tab_id, 194 if (!ExtensionTabUtil::GetTabById(params_->details.tab_id,
194 GetProfile(), 195 GetProfile(),
195 include_incognito(), 196 include_incognito(),
196 &browser, 197 &browser,
197 NULL, 198 NULL,
198 &web_contents, 199 &web_contents,
199 NULL)) { 200 NULL)) {
200 return NULL; 201 return NULL;
201 } 202 }
202 return web_contents; 203 return web_contents;
203 } 204 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698