Enable Enterprise enrollment on desktop builds.
[chromium-blink-merge.git] / chrome / common / extensions / api / system_indicator / system_indicator_handler.cc
blob6ce19dcdd82be34fe3b21b8ac1f96477f4a61ccb
1 // Copyright (c) 2013 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 "chrome/common/extensions/api/system_indicator/system_indicator_handler.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h"
10 #include "chrome/common/extensions/api/extension_action/action_info.h"
11 #include "extensions/common/extension.h"
12 #include "extensions/common/manifest_constants.h"
14 namespace extensions {
16 SystemIndicatorHandler::SystemIndicatorHandler() {
19 SystemIndicatorHandler::~SystemIndicatorHandler() {
22 bool SystemIndicatorHandler::Parse(Extension* extension,
23 base::string16* error) {
24 const base::DictionaryValue* system_indicator_value = NULL;
25 if (!extension->manifest()->GetDictionary(
26 manifest_keys::kSystemIndicator, &system_indicator_value)) {
27 *error = base::ASCIIToUTF16(manifest_errors::kInvalidSystemIndicator);
28 return false;
31 scoped_ptr<ActionInfo> action_info = ActionInfo::Load(
32 extension, system_indicator_value, error);
34 if (!action_info.get())
35 return false;
37 ActionInfo::SetSystemIndicatorInfo(extension, action_info.release());
38 return true;
41 const std::vector<std::string> SystemIndicatorHandler::Keys() const {
42 return SingleKey(manifest_keys::kSystemIndicator);
45 } // namespace extensions