Chromium Code Reviews| Index: content/public/common/mhtml_generation.h |
| diff --git a/content/public/common/mhtml_generation.h b/content/public/common/mhtml_generation.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8085fcf241bd90ccbd16ddf174660253a7d5816f |
| --- /dev/null |
| +++ b/content/public/common/mhtml_generation.h |
| @@ -0,0 +1,70 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_PUBLIC_COMMON_MHTML_GENERATION_H_ |
| +#define CONTENT_PUBLIC_COMMON_MHTML_GENERATION_H_ |
| + |
| +#include "base/files/file_path.h" |
| +#include "content/common/content_export.h" |
| +#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.
|
| + |
| +namespace content { |
| + |
| +using WebFrameSerializer = blink::WebFrameSerializer; |
| + |
| +// Options for changing serialization behavior based on the CacheControl header |
| +// of each subresource. |
| +enum class MHTMLCacheControlPolicy { |
| + IGNORE = WebFrameSerializer::CacheControlPolicyIgnore, |
| + FAIL_FOR_NO_STORE_MAIN_FRAME = |
| + WebFrameSerializer::CacheControlPolicyFailForNoStoreMainFrame, |
| + |
| + // |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.
|
| + // IPC_ENUM_TRAITS_MAX_VALUE macro. Keep the value up to date. Otherwise |
| + // a new value can not be passed to the renderer. |
| + LAST = FAIL_FOR_NO_STORE_MAIN_FRAME |
| +}; |
| + |
| +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.
|
| + OK, |
| + FILE_WRITE_FAILED_IN_HEADER, |
| + FILE_WRITE_FAILED_IN_PARTS_GEN, |
| + 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.
|
| + NO_STORE_MAIN_FRAME, |
| + |
| + // |LAST| is used in content/common/media/midi_messages.h with |
| + // IPC_ENUM_TRAITS_MAX_VALUE macro. Keep the value up to date. Otherwise |
| + // a new value can not be passed to the renderer. |
| + LAST = NO_STORE_MAIN_FRAME |
| +}; |
| + |
| +struct CONTENT_EXPORT MHTMLGenerationParams { |
| + MHTMLGenerationParams(const base::FilePath& file_path); |
| + ~MHTMLGenerationParams() = default; |
| + |
| + // The file that will contain the generated MHTML. |
| + base::FilePath file_path; |
| + |
| + // Uses Content-Transfer-Encoding: binary when encoding. See |
| + // https://tools.ietf.org/html/rfc2045 for details about |
| + // Content-Transfer-Encoding. |
| + bool use_binary_encoding = false; |
| + |
| + // By default, MHTML includes all subresources. This flag can be used to |
| + // cause the generator to fail or silently ignore resources if the |
| + // Cache-Control header is used. |
| + MHTMLCacheControlPolicy cache_control_policy = |
| + MHTMLCacheControlPolicy::IGNORE; |
| +}; |
| + |
| +namespace mhtml { |
| + |
| +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.
|
| + MHTMLCacheControlPolicy mhtml_policy); |
| + |
| +} // namespace mhtml |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_PUBLIC_COMMON_MHTML_GENERATION__ |