| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/common/extensions/api/system_indicator/system_indicator_handler
.h" | 5 #include "chrome/common/extensions/api/system_indicator/system_indicator_handler
.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include <memory> |
| 8 |
| 8 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/values.h" | 10 #include "base/values.h" |
| 10 #include "chrome/common/extensions/api/extension_action/action_info.h" | 11 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| 11 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
| 12 #include "extensions/common/manifest_constants.h" | 13 #include "extensions/common/manifest_constants.h" |
| 13 | 14 |
| 14 namespace extensions { | 15 namespace extensions { |
| 15 | 16 |
| 16 SystemIndicatorHandler::SystemIndicatorHandler() { | 17 SystemIndicatorHandler::SystemIndicatorHandler() { |
| 17 } | 18 } |
| 18 | 19 |
| 19 SystemIndicatorHandler::~SystemIndicatorHandler() { | 20 SystemIndicatorHandler::~SystemIndicatorHandler() { |
| 20 } | 21 } |
| 21 | 22 |
| 22 bool SystemIndicatorHandler::Parse(Extension* extension, | 23 bool SystemIndicatorHandler::Parse(Extension* extension, |
| 23 base::string16* error) { | 24 base::string16* error) { |
| 24 const base::DictionaryValue* system_indicator_value = NULL; | 25 const base::DictionaryValue* system_indicator_value = NULL; |
| 25 if (!extension->manifest()->GetDictionary( | 26 if (!extension->manifest()->GetDictionary( |
| 26 manifest_keys::kSystemIndicator, &system_indicator_value)) { | 27 manifest_keys::kSystemIndicator, &system_indicator_value)) { |
| 27 *error = base::ASCIIToUTF16(manifest_errors::kInvalidSystemIndicator); | 28 *error = base::ASCIIToUTF16(manifest_errors::kInvalidSystemIndicator); |
| 28 return false; | 29 return false; |
| 29 } | 30 } |
| 30 | 31 |
| 31 scoped_ptr<ActionInfo> action_info = ActionInfo::Load( | 32 std::unique_ptr<ActionInfo> action_info = |
| 32 extension, system_indicator_value, error); | 33 ActionInfo::Load(extension, system_indicator_value, error); |
| 33 | 34 |
| 34 if (!action_info.get()) | 35 if (!action_info.get()) |
| 35 return false; | 36 return false; |
| 36 | 37 |
| 37 ActionInfo::SetSystemIndicatorInfo(extension, action_info.release()); | 38 ActionInfo::SetSystemIndicatorInfo(extension, action_info.release()); |
| 38 return true; | 39 return true; |
| 39 } | 40 } |
| 40 | 41 |
| 41 const std::vector<std::string> SystemIndicatorHandler::Keys() const { | 42 const std::vector<std::string> SystemIndicatorHandler::Keys() const { |
| 42 return SingleKey(manifest_keys::kSystemIndicator); | 43 return SingleKey(manifest_keys::kSystemIndicator); |
| 43 } | 44 } |
| 44 | 45 |
| 45 } // namespace extensions | 46 } // namespace extensions |
| OLD | NEW |