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

Side by Side Diff: content/public/common/mhtml_generation.h

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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PUBLIC_COMMON_MHTML_GENERATION_H_
6 #define CONTENT_PUBLIC_COMMON_MHTML_GENERATION_H_
7
8 #include "base/files/file_path.h"
9 #include "content/common/content_export.h"
10 #include "third_party/WebKit/public/web/WebFrameSerializer.h"
Łukasz Anforowicz 2016/05/12 18:56:49 content/common/DEPS says: No inclusion of WebKit f
dewittj 2016/05/12 22:58:01 I actually did both. WDYT about how this looks?
Łukasz Anforowicz 2016/05/12 23:56:27 Looks good - thanks.
11
12 namespace content {
13
14 using WebFrameSerializer = blink::WebFrameSerializer;
15
16 // Options for changing serialization behavior based on the CacheControl header
17 // of each subresource.
18 enum class MHTMLCacheControlPolicy {
19 IGNORE = WebFrameSerializer::CacheControlPolicyIgnore,
20 FAIL_FOR_NO_STORE_MAIN_FRAME =
21 WebFrameSerializer::CacheControlPolicyFailForNoStoreMainFrame,
22
23 // |LAST| is used in content/common/media/midi_messages.h with
Łukasz Anforowicz 2016/05/12 18:56:49 Copy&paste issue - did you mean content/public/com
dewittj 2016/05/12 22:58:01 Done.
24 // IPC_ENUM_TRAITS_MAX_VALUE macro. Keep the value up to date. Otherwise
25 // a new value can not be passed to the renderer.
26 LAST = FAIL_FOR_NO_STORE_MAIN_FRAME
27 };
28
29 enum class MHTMLSerializationResult {
Łukasz Anforowicz 2016/05/12 18:56:49 I didn't see a place where this enum is used in //
dewittj 2016/05/12 22:58:01 I just got rid of the result since we are not usin
Łukasz Anforowicz 2016/05/12 23:56:27 Acknowledged.
30 OK,
31 FILE_WRITE_FAILED_IN_HEADER,
32 FILE_WRITE_FAILED_IN_PARTS_GEN,
33 FILE_WRITE_FAILED_IN_FOOTER,
Łukasz Anforowicz 2016/05/12 18:56:49 Is there an existing code that needs to distinguis
dewittj 2016/05/12 22:58:01 obsolete.
Łukasz Anforowicz 2016/05/12 23:56:27 Acknowledged.
34 NO_STORE_MAIN_FRAME,
35
36 // |LAST| is used in content/common/media/midi_messages.h with
37 // IPC_ENUM_TRAITS_MAX_VALUE macro. Keep the value up to date. Otherwise
38 // a new value can not be passed to the renderer.
39 LAST = NO_STORE_MAIN_FRAME
40 };
41
42 struct CONTENT_EXPORT MHTMLGenerationParams {
43 MHTMLGenerationParams(const base::FilePath& file_path);
44 ~MHTMLGenerationParams() = default;
45
46 // The file that will contain the generated MHTML.
47 base::FilePath file_path;
48
49 // Uses Content-Transfer-Encoding: binary when encoding. See
50 // https://tools.ietf.org/html/rfc2045 for details about
51 // Content-Transfer-Encoding.
52 bool use_binary_encoding = false;
53
54 // By default, MHTML includes all subresources. This flag can be used to
55 // cause the generator to fail or silently ignore resources if the
56 // Cache-Control header is used.
57 MHTMLCacheControlPolicy cache_control_policy =
58 MHTMLCacheControlPolicy::IGNORE;
59 };
60
61 namespace mhtml {
62
63 blink::WebFrameSerializer::CacheControlPolicy toCacheControlPolicy(
Łukasz Anforowicz 2016/05/12 18:56:49 Can this be hidden away from //content's public AP
dewittj 2016/05/12 22:58:01 Done.
64 MHTMLCacheControlPolicy mhtml_policy);
65
66 } // namespace mhtml
67
68 } // namespace content
69
70 #endif // CONTENT_PUBLIC_COMMON_MHTML_GENERATION__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698