| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 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. |
| 4 |
| 5 #include "chrome/common/extensions/api/extension_action/browser_action_handler.h
" |
| 6 |
| 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/utf_string_conversions.h" |
| 9 #include "base/values.h" |
| 10 #include "chrome/common/extensions/api/extension_action/action_handler_helpers.h
" |
| 11 #include "chrome/common/extensions/extension.h" |
| 12 #include "chrome/common/extensions/extension_constants.h" |
| 13 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 14 #include "chrome/common/extensions/feature_switch.h" |
| 15 |
| 16 namespace errors = extension_manifest_errors; |
| 17 |
| 18 namespace extensions { |
| 19 |
| 20 BrowserActionHandler::BrowserActionHandler() { |
| 21 } |
| 22 |
| 23 BrowserActionHandler::~BrowserActionHandler() { |
| 24 } |
| 25 |
| 26 bool BrowserActionHandler::Parse(const base::Value* value, |
| 27 Extension* extension, |
| 28 string16* error) { |
| 29 const DictionaryValue* dict = NULL; |
| 30 if (!value->GetAsDictionary(&dict)) { |
| 31 *error = ASCIIToUTF16(errors::kInvalidBrowserAction); |
| 32 return false; |
| 33 } |
| 34 |
| 35 scoped_ptr<ActionInfo> action_info = LoadActionInfo(extension, dict, error); |
| 36 if (!action_info.get()) |
| 37 return false; // Failed to parse browser action definition. |
| 38 |
| 39 extension->SetManifestData(extension_manifest_keys::kBrowserAction, |
| 40 new ActionInfoData(action_info.release())); |
| 41 |
| 42 return true; |
| 43 } |
| 44 |
| 45 } // namespace extensions |
| OLD | NEW |