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 #include "content/public/common/manifest.h" | 5 #include "content/public/common/manifest.h" |
6 | 6 |
7 namespace content { | 7 namespace content { |
8 | 8 |
9 // We need to provide a value here which is out of the range of a 32-bit integer | 9 // We need to provide a value here which is out of the range of a 32-bit integer |
10 // since otherwise we would not be able to check whether a theme color was valid | 10 // since otherwise we would not be able to check whether a theme color was valid |
11 // or not. The simplest way to do this is to simply add one to the maximum | 11 // or not. The simplest way to do this is to simply add one to the maximum |
12 // possible 32-bit integer. | 12 // possible 32-bit integer. |
13 const int64_t Manifest::kInvalidOrMissingColor = | 13 const int64_t Manifest::kInvalidOrMissingColor = |
14 static_cast<int64_t>(std::numeric_limits<int32_t>::max()) + 1; | 14 static_cast<int64_t>(std::numeric_limits<int32_t>::max()) + 1; |
15 const size_t Manifest::kMaxIPCStringLength = 4 * 1024; | 15 const size_t Manifest::kMaxIPCStringLength = 4 * 1024; |
16 | 16 |
17 Manifest::Icon::Icon() { } | 17 Manifest::Icon::Icon() = default; |
18 | 18 |
19 Manifest::Icon::Icon(const Icon& other) = default; | 19 Manifest::Icon::Icon(const Icon& other) = default; |
20 | 20 |
21 Manifest::Icon::~Icon() { | 21 Manifest::Icon::~Icon() = default; |
22 } | |
23 | 22 |
24 bool Manifest::Icon::operator==(const Manifest::Icon& other) const { | 23 bool Manifest::Icon::operator==(const Manifest::Icon& other) const { |
25 return src == other.src && type == other.type && sizes == other.sizes; | 24 return src == other.src && type == other.type && sizes == other.sizes; |
26 } | 25 } |
27 | 26 |
28 Manifest::RelatedApplication::RelatedApplication() { | 27 Manifest::ShareTarget::ShareTarget() = default; |
29 } | |
30 | 28 |
31 Manifest::RelatedApplication::~RelatedApplication() { | 29 Manifest::ShareTarget::~ShareTarget() = default; |
32 } | 30 |
| 31 Manifest::RelatedApplication::RelatedApplication() = default; |
| 32 |
| 33 Manifest::RelatedApplication::~RelatedApplication() = default; |
33 | 34 |
34 Manifest::Manifest() | 35 Manifest::Manifest() |
35 : display(blink::WebDisplayModeUndefined), | 36 : display(blink::WebDisplayModeUndefined), |
36 orientation(blink::WebScreenOrientationLockDefault), | 37 orientation(blink::WebScreenOrientationLockDefault), |
37 prefer_related_applications(false), | 38 prefer_related_applications(false), |
38 theme_color(Manifest::kInvalidOrMissingColor), | 39 theme_color(Manifest::kInvalidOrMissingColor), |
39 background_color(Manifest::kInvalidOrMissingColor) { | 40 background_color(Manifest::kInvalidOrMissingColor) { |
| 41 share_target = base::nullopt; |
40 } | 42 } |
41 | 43 |
42 Manifest::Manifest(const Manifest& other) = default; | 44 Manifest::Manifest(const Manifest& other) = default; |
43 | 45 |
44 Manifest::~Manifest() { | 46 Manifest::~Manifest() = default; |
45 } | |
46 | 47 |
47 bool Manifest::IsEmpty() const { | 48 bool Manifest::IsEmpty() const { |
48 return name.is_null() && | 49 return name.is_null() && |
49 short_name.is_null() && | 50 short_name.is_null() && |
50 start_url.is_empty() && | 51 start_url.is_empty() && |
51 display == blink::WebDisplayModeUndefined && | 52 display == blink::WebDisplayModeUndefined && |
52 orientation == blink::WebScreenOrientationLockDefault && | 53 orientation == blink::WebScreenOrientationLockDefault && |
53 icons.empty() && | 54 icons.empty() && |
| 55 !share_target.has_value() && |
54 related_applications.empty() && | 56 related_applications.empty() && |
55 !prefer_related_applications && | 57 !prefer_related_applications && |
56 theme_color == Manifest::kInvalidOrMissingColor && | 58 theme_color == Manifest::kInvalidOrMissingColor && |
57 background_color == Manifest::kInvalidOrMissingColor && | 59 background_color == Manifest::kInvalidOrMissingColor && |
58 gcm_sender_id.is_null() && | 60 gcm_sender_id.is_null() && |
59 scope.is_empty(); | 61 scope.is_empty(); |
60 } | 62 } |
61 | 63 |
62 } // namespace content | 64 } // namespace content |
OLD | NEW |