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

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

Issue 1947263004: Introduces a new MHTML generation parameter specifying different behvaior for cache-control headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Work on compile. 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 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/extensions/extension_tab_util.h" 12 #include "chrome/browser/extensions/extension_tab_util.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "content/public/browser/child_process_security_policy.h" 14 #include "content/public/browser/child_process_security_policy.h"
15 #include "content/public/browser/notification_details.h" 15 #include "content/public/browser/notification_details.h"
16 #include "content/public/browser/notification_source.h" 16 #include "content/public/browser/notification_source.h"
17 #include "content/public/browser/notification_types.h" 17 #include "content/public/browser/notification_types.h"
18 #include "content/public/browser/render_frame_host.h" 18 #include "content/public/browser/render_frame_host.h"
19 #include "content/public/browser/render_process_host.h" 19 #include "content/public/browser/render_process_host.h"
20 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
21 #include "content/public/common/mhtml_generation.h"
21 #include "extensions/common/extension_messages.h" 22 #include "extensions/common/extension_messages.h"
22 23
23 using content::BrowserThread; 24 using content::BrowserThread;
24 using content::ChildProcessSecurityPolicy; 25 using content::ChildProcessSecurityPolicy;
25 using content::WebContents; 26 using content::WebContents;
26 using extensions::PageCaptureSaveAsMHTMLFunction; 27 using extensions::PageCaptureSaveAsMHTMLFunction;
27 using storage::ShareableFileReference; 28 using storage::ShareableFileReference;
28 29
29 namespace SaveAsMHTML = extensions::api::page_capture::SaveAsMHTML; 30 namespace SaveAsMHTML = extensions::api::page_capture::SaveAsMHTML;
30 31
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (test_delegate_) 126 if (test_delegate_)
126 test_delegate_->OnTemporaryFileCreated(mhtml_path_); 127 test_delegate_->OnTemporaryFileCreated(mhtml_path_);
127 128
128 WebContents* web_contents = GetWebContents(); 129 WebContents* web_contents = GetWebContents();
129 if (!web_contents) { 130 if (!web_contents) {
130 ReturnFailure(kTabClosedError); 131 ReturnFailure(kTabClosedError);
131 return; 132 return;
132 } 133 }
133 134
134 web_contents->GenerateMHTML( 135 web_contents->GenerateMHTML(
135 mhtml_path_, 136 content::MHTMLGenerationParams(mhtml_path_),
136 false /* use_binary_encoding */,
137 base::Bind(&PageCaptureSaveAsMHTMLFunction::MHTMLGenerated, this)); 137 base::Bind(&PageCaptureSaveAsMHTMLFunction::MHTMLGenerated, this));
138 } 138 }
139 139
140 void PageCaptureSaveAsMHTMLFunction::MHTMLGenerated(int64_t mhtml_file_size) { 140 void PageCaptureSaveAsMHTMLFunction::MHTMLGenerated(int64_t mhtml_file_size) {
141 if (mhtml_file_size <= 0) { 141 if (mhtml_file_size <= 0) {
142 ReturnFailure(kMHTMLGenerationFailedError); 142 ReturnFailure(kMHTMLGenerationFailedError);
143 return; 143 return;
144 } 144 }
145 145
146 if (mhtml_file_size > std::numeric_limits<int>::max()) { 146 if (mhtml_file_size > std::numeric_limits<int>::max()) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 GetProfile(), 194 GetProfile(),
195 include_incognito(), 195 include_incognito(),
196 &browser, 196 &browser,
197 NULL, 197 NULL,
198 &web_contents, 198 &web_contents,
199 NULL)) { 199 NULL)) {
200 return NULL; 200 return NULL;
201 } 201 }
202 return web_contents; 202 return web_contents;
203 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698