OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "chrome/common/extensions/api/page_launcher/page_launcher_handler.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/utf_string_conversions.h" |
| 9 #include "base/values.h" |
| 10 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| 11 #include "chrome/common/extensions/extension.h" |
| 12 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 13 #include "chrome/common/extensions/manifest.h" |
| 14 #include "chrome/common/extensions/manifest_handler_helpers.h" |
| 15 |
| 16 namespace keys = extension_manifest_keys; |
| 17 |
| 18 namespace extensions { |
| 19 |
| 20 PageLauncherHandler::PageLauncherHandler() { |
| 21 } |
| 22 |
| 23 PageLauncherHandler::~PageLauncherHandler() { |
| 24 } |
| 25 |
| 26 bool PageLauncherHandler::Parse(Extension* extension, string16* error) { |
| 27 DCHECK(extension->manifest()->HasKey(keys::kPageLauncher)); |
| 28 |
| 29 const base::DictionaryValue* dict; |
| 30 if (!extension->manifest()->GetDictionary(keys::kPageLauncher, &dict)) { |
| 31 *error = ASCIIToUTF16(extension_manifest_errors::kInvalidPageLauncher); |
| 32 return false; |
| 33 } |
| 34 |
| 35 scoped_ptr<ActionInfo> action_info = |
| 36 manifest_handler_helpers::LoadActionInfo(extension, dict, error); |
| 37 if (!action_info) |
| 38 return false; |
| 39 |
| 40 ActionInfo::SetPageLauncherInfo(extension, action_info.release()); |
| 41 return true; |
| 42 } |
| 43 |
| 44 } // namespace extensions |
OLD | NEW |