summaryrefslogtreecommitdiff
path: root/chromium/extensions/common/api/declarative/declarative_manifest_handler.cc
blob: 6292a63db32c8ca42ba2fad070a8ef638281e29f (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
// Copyright 2015 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 "extensions/common/api/declarative/declarative_manifest_handler.h"

#include "extensions/common/api/declarative/declarative_manifest_data.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h"

namespace extensions {

DeclarativeManifestHandler::DeclarativeManifestHandler() {
}

DeclarativeManifestHandler::~DeclarativeManifestHandler() {
}

bool DeclarativeManifestHandler::Parse(Extension* extension,
                                       base::string16* error) {
  const base::Value* event_rules = NULL;
  CHECK(extension->manifest()->Get(manifest_keys::kEventRules, &event_rules));
  std::unique_ptr<DeclarativeManifestData> data =
      DeclarativeManifestData::FromValue(*event_rules, error);
  if (!data)
    return false;

  extension->SetManifestData(manifest_keys::kEventRules, std::move(data));
  return true;
}

base::span<const char* const> DeclarativeManifestHandler::Keys() const {
  static constexpr const char* kKeys[] = {manifest_keys::kEventRules};
  return kKeys;
}

}  // namespace extensions