Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / common / api / declarative / declarative_manifest_handler.cc
blobb96ddf68ad60358aa932f0046477a37d2010955b
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "extensions/common/api/declarative/declarative_manifest_handler.h"
7 #include "extensions/common/api/declarative/declarative_manifest_data.h"
8 #include "extensions/common/extension.h"
9 #include "extensions/common/manifest_constants.h"
11 namespace extensions {
13 DeclarativeManifestHandler::DeclarativeManifestHandler() {
16 DeclarativeManifestHandler::~DeclarativeManifestHandler() {
19 bool DeclarativeManifestHandler::Parse(Extension* extension,
20 base::string16* error) {
21 const base::Value* event_rules = NULL;
22 CHECK(extension->manifest()->Get(manifest_keys::kEventRules, &event_rules));
23 scoped_ptr<DeclarativeManifestData> data =
24 DeclarativeManifestData::FromValue(*event_rules, error);
25 if (!data)
26 return false;
28 extension->SetManifestData(manifest_keys::kEventRules, data.release());
29 return true;
32 const std::vector<std::string> DeclarativeManifestHandler::Keys() const {
33 return SingleKey(manifest_keys::kEventRules);
36 } // namespace extensions