summaryrefslogtreecommitdiffstats
path: root/content/public/common/manifest.cc
blob: e38a9043c377bf01026996775396a5ed4a70dead (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2014 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.

#include "content/public/common/manifest.h"

namespace content {

const double Manifest::Icon::kDefaultDensity = 1;
// We need to provide a value here which is out of the range of a 32-bit integer
// since otherwise we would not be able to check whether a theme color was valid
// or not. The simplest way to do this is to simply add one to the maximum
// possible 32-bit integer.
const int64_t Manifest::kInvalidOrMissingColor =
    static_cast<int64_t>(std::numeric_limits<int32_t>::max()) + 1;
const size_t Manifest::kMaxIPCStringLength = 4 * 1024;

Manifest::Icon::Icon()
    : density(kDefaultDensity) {
}

Manifest::Icon::Icon(const Icon& other) = default;

Manifest::Icon::~Icon() {
}

Manifest::RelatedApplication::RelatedApplication() {
}

Manifest::RelatedApplication::~RelatedApplication() {
}

Manifest::Manifest()
    : display(blink::WebDisplayModeUndefined),
      orientation(blink::WebScreenOrientationLockDefault),
      prefer_related_applications(false),
      theme_color(Manifest::kInvalidOrMissingColor),
      background_color(Manifest::kInvalidOrMissingColor) {
}

Manifest::Manifest(const Manifest& other) = default;

Manifest::~Manifest() {
}

bool Manifest::IsEmpty() const {
  return name.is_null() &&
         short_name.is_null() &&
         start_url.is_empty() &&
         display == blink::WebDisplayModeUndefined &&
         orientation == blink::WebScreenOrientationLockDefault &&
         icons.empty() &&
         related_applications.empty() &&
         !prefer_related_applications &&
         theme_color == Manifest::kInvalidOrMissingColor &&
         background_color == Manifest::kInvalidOrMissingColor &&
         gcm_sender_id.is_null();
}

} // namespace content