| 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/extension.h" |
| 11 #include "chrome/common/extensions/extension_constants.h" |
| 12 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 13 #include "chrome/common/extensions/feature_switch.h" |
| 14 #include "chrome/common/extensions/manifest_handler_helpers.h" |
| 15 |
| 16 namespace extensions { |
| 17 |
| 18 BrowserActionHandler::BrowserActionHandler() { |
| 19 } |
| 20 |
| 21 BrowserActionHandler::~BrowserActionHandler() { |
| 22 } |
| 23 |
| 24 bool BrowserActionHandler::Parse(const base::Value* value, |
| 25 Extension* extension, |
| 26 string16* error) { |
| 27 const DictionaryValue* dict = NULL; |
| 28 if (!value->GetAsDictionary(&dict)) { |
| 29 *error = ASCIIToUTF16(extension_manifest_errors::kInvalidBrowserAction); |
| 30 return false; |
| 31 } |
| 32 |
| 33 scoped_ptr<ActionInfo> action_info = |
| 34 manifest_handler_helpers::LoadActionInfo(extension, dict, error); |
| 35 if (!action_info.get()) |
| 36 return false; // Failed to parse browser action definition. |
| 37 |
| 38 ActionInfo::SetBrowserActionInfo(extension, action_info.release()); |
| 39 |
| 40 return true; |
| 41 } |
| 42 |
| 43 } // namespace extensions |
| OLD | NEW |