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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/nullable_string16.h" | 10 #include "base/strings/nullable_string16.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 double density; | 47 double density; |
48 | 48 |
49 // Empty if the parsing failed, the field was not present or empty. | 49 // Empty if the parsing failed, the field was not present or empty. |
50 // The special value "any" is represented by gfx::Size(0, 0). | 50 // The special value "any" is represented by gfx::Size(0, 0). |
51 std::vector<gfx::Size> sizes; | 51 std::vector<gfx::Size> sizes; |
52 | 52 |
53 // Default density. Set to 1.0. | 53 // Default density. Set to 1.0. |
54 static const double kDefaultDensity; | 54 static const double kDefaultDensity; |
55 }; | 55 }; |
56 | 56 |
| 57 // Structure representing a related application. |
| 58 struct CONTENT_EXPORT RelatedApplication { |
| 59 RelatedApplication(); |
| 60 ~RelatedApplication(); |
| 61 |
| 62 // The platform on which the application can be found. This can be any |
| 63 // string, and is interpreted by the consumer of the object. Empty if the |
| 64 // parsing failed. |
| 65 base::NullableString16 platform; |
| 66 |
| 67 // URL at which the application can be found. One of |url| and |id| must be |
| 68 // present. Empty if the parsing failed or the field was not present. |
| 69 GURL url; |
| 70 |
| 71 // An id which is used to represent the application on the platform. One of |
| 72 // |url| and |id| must be present. Empty if the parsing failed or the field |
| 73 // was not present. |
| 74 base::NullableString16 id; |
| 75 }; |
| 76 |
57 Manifest(); | 77 Manifest(); |
58 ~Manifest(); | 78 ~Manifest(); |
59 | 79 |
60 // Returns whether this Manifest had no attribute set. A newly created | 80 // Returns whether this Manifest had no attribute set. A newly created |
61 // Manifest is always empty. | 81 // Manifest is always empty. |
62 bool IsEmpty() const; | 82 bool IsEmpty() const; |
63 | 83 |
64 // Null if the parsing failed or the field was not present. | 84 // Null if the parsing failed or the field was not present. |
65 base::NullableString16 name; | 85 base::NullableString16 name; |
66 | 86 |
67 // Null if the parsing failed or the field was not present. | 87 // Null if the parsing failed or the field was not present. |
68 base::NullableString16 short_name; | 88 base::NullableString16 short_name; |
69 | 89 |
70 // Empty if the parsing failed or the field was not present. | 90 // Empty if the parsing failed or the field was not present. |
71 GURL start_url; | 91 GURL start_url; |
72 | 92 |
73 // Set to DISPLAY_MODE_UNSPECIFIED if the parsing failed or the field was not | 93 // Set to DISPLAY_MODE_UNSPECIFIED if the parsing failed or the field was not |
74 // present. | 94 // present. |
75 DisplayMode display; | 95 DisplayMode display; |
76 | 96 |
77 // Set to blink::WebScreenOrientationLockDefault if the parsing failed or the | 97 // Set to blink::WebScreenOrientationLockDefault if the parsing failed or the |
78 // field was not present. | 98 // field was not present. |
79 blink::WebScreenOrientationLockType orientation; | 99 blink::WebScreenOrientationLockType orientation; |
80 | 100 |
81 // 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 |
82 // icons inside the JSON array were invalid. | 102 // icons inside the JSON array were invalid. |
83 std::vector<Icon> icons; | 103 std::vector<Icon> icons; |
84 | 104 |
| 105 // Empty if the parsing failed, the field was not present, empty or all the |
| 106 // applications inside the array were invalid. The order of the array |
| 107 // indicates the priority of the application to use. |
| 108 std::vector<RelatedApplication> related_applications; |
| 109 |
| 110 // A boolean that is used as a hint for the user agent to say that related |
| 111 // applications should be preferred over the web application. False if missing |
| 112 // or there is a parsing failure. |
| 113 bool prefer_related_applications; |
| 114 |
85 // This is a proprietary extension of the web Manifest, double-check that it | 115 // This is a proprietary extension of the web Manifest, double-check that it |
86 // is okay to use this entry. | 116 // is okay to use this entry. |
87 // Null if parsing failed or the field was not present. | 117 // Null if parsing failed or the field was not present. |
88 base::NullableString16 gcm_sender_id; | 118 base::NullableString16 gcm_sender_id; |
89 | 119 |
90 // This is a proprietary extension of the web Manifest, double-check that it | 120 // This is a proprietary extension of the web Manifest, double-check that it |
91 // is okay to use this entry. | 121 // is okay to use this entry. |
92 // False if parsing failed or the field was not present. | 122 // False if parsing failed or the field was not present. |
93 bool gcm_user_visible_only; | 123 bool gcm_user_visible_only; |
94 | 124 |
95 // Maximum length for all the strings inside the Manifest when it is sent over | 125 // Maximum length for all the strings inside the Manifest when it is sent over |
96 // IPC. The renderer process should truncate the strings before sending the | 126 // IPC. The renderer process should truncate the strings before sending the |
97 // Manifest and the browser process must do the same when receiving it. | 127 // Manifest and the browser process must do the same when receiving it. |
98 static const size_t kMaxIPCStringLength; | 128 static const size_t kMaxIPCStringLength; |
99 }; | 129 }; |
100 | 130 |
101 } // namespace content | 131 } // namespace content |
102 | 132 |
103 #endif // CONTENT_PUBLIC_COMMON_MANIFEST_H_ | 133 #endif // CONTENT_PUBLIC_COMMON_MANIFEST_H_ |
OLD | NEW |