| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_PUBLIC_COMMON_MANIFEST_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_MANIFEST_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_MANIFEST_H_ | 6 #define CONTENT_PUBLIC_COMMON_MANIFEST_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/optional.h" |
| 13 #include "base/strings/nullable_string16.h" | 14 #include "base/strings/nullable_string16.h" |
| 14 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 15 #include "third_party/WebKit/public/platform/WebDisplayMode.h" | 16 #include "third_party/WebKit/public/platform/WebDisplayMode.h" |
| 16 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree
nOrientationLockType.h" | 17 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree
nOrientationLockType.h" |
| 18 #include "third_party/skia/include/core/SkColor.h" |
| 17 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
| 18 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 19 | 21 |
| 20 namespace content { | 22 namespace content { |
| 21 | 23 |
| 22 // The Manifest structure is an internal representation of the Manifest file | 24 // The Manifest structure is an internal representation of the Manifest file |
| 23 // described in the "Manifest for Web Application" document: | 25 // described in the "Manifest for Web Application" document: |
| 24 // http://w3c.github.io/manifest/ | 26 // http://w3c.github.io/manifest/ |
| 25 struct CONTENT_EXPORT Manifest { | 27 struct CONTENT_EXPORT Manifest { |
| 26 // Structure representing an icon as per the Manifest specification, see: | 28 // Structure representing an icon as per the Manifest specification, see: |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // Empty if the parsing failed, the field was not present, empty or all the | 101 // Empty if the parsing failed, the field was not present, empty or all the |
| 100 // applications inside the array were invalid. The order of the array | 102 // applications inside the array were invalid. The order of the array |
| 101 // indicates the priority of the application to use. | 103 // indicates the priority of the application to use. |
| 102 std::vector<RelatedApplication> related_applications; | 104 std::vector<RelatedApplication> related_applications; |
| 103 | 105 |
| 104 // A boolean that is used as a hint for the user agent to say that related | 106 // A boolean that is used as a hint for the user agent to say that related |
| 105 // applications should be preferred over the web application. False if missing | 107 // applications should be preferred over the web application. False if missing |
| 106 // or there is a parsing failure. | 108 // or there is a parsing failure. |
| 107 bool prefer_related_applications; | 109 bool prefer_related_applications; |
| 108 | 110 |
| 109 // This is a 64 bit integer because we need to represent an error state. The | 111 // The Optional is empty if no value was present or if it was invalid. It is |
| 110 // color itself should only be 32 bits long if the value is not | 112 // a valid SkColor otherwise. |
| 111 // kInvalidOrMissingColor and can be safely cast to SkColor if is valid. | 113 base::Optional<SkColor> theme_color; |
| 112 // Set to kInvalidOrMissingColor if parsing failed or field is not | |
| 113 // present. | |
| 114 int64_t theme_color; | |
| 115 | 114 |
| 116 // This is a 64 bit integer because we need to represent an error state. The | 115 // The Optional is empty if no value was present or if it was invalid. It is |
| 117 // color itself should only be 32 bits long if the value is not | 116 // a valid SkColor otherwise. |
| 118 // kInvalidOrMissingColor and can be safely cast to SkColor if is valid. | 117 base::Optional<SkColor> background_color; |
| 119 // Set to kInvalidOrMissingColor if parsing failed or field is not | |
| 120 // present. | |
| 121 int64_t background_color; | |
| 122 | 118 |
| 123 // This is a proprietary extension of the web Manifest, double-check that it | 119 // This is a proprietary extension of the web Manifest, double-check that it |
| 124 // is okay to use this entry. | 120 // is okay to use this entry. |
| 125 // Null if parsing failed or the field was not present. | 121 // Null if parsing failed or the field was not present. |
| 126 base::NullableString16 gcm_sender_id; | 122 base::NullableString16 gcm_sender_id; |
| 127 | 123 |
| 128 // Empty if the parsing failed or the field was not present. | 124 // Empty if the parsing failed or the field was not present. |
| 129 GURL scope; | 125 GURL scope; |
| 130 | 126 |
| 131 // Maximum length for all the strings inside the Manifest when it is sent over | 127 // Maximum length for all the strings inside the Manifest when it is sent over |
| 132 // IPC. The renderer process should truncate the strings before sending the | 128 // IPC. The renderer process should truncate the strings before sending the |
| 133 // Manifest and the browser process must do the same when receiving it. | 129 // Manifest and the browser process must do the same when receiving it. |
| 134 static const size_t kMaxIPCStringLength; | 130 static const size_t kMaxIPCStringLength; |
| 135 | |
| 136 // Constant representing an invalid color. Set to a value outside the | |
| 137 // range of a 32-bit integer. | |
| 138 static const int64_t kInvalidOrMissingColor; | |
| 139 }; | 131 }; |
| 140 | 132 |
| 141 } // namespace content | 133 } // namespace content |
| 142 | 134 |
| 143 #endif // CONTENT_PUBLIC_COMMON_MANIFEST_H_ | 135 #endif // CONTENT_PUBLIC_COMMON_MANIFEST_H_ |
| OLD | NEW |