| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/extension_action/action_info.h" | 5 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| 6 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 6 | 7 |
| 7 namespace extensions { | 8 namespace extensions { |
| 8 | 9 |
| 10 namespace { |
| 11 |
| 12 static const ActionInfo* GetActionInfo(const Extension* extension, |
| 13 const std::string& key) { |
| 14 ActionInfoData* data = static_cast<ActionInfoData*>( |
| 15 extension->GetManifestData(key)); |
| 16 return data ? data->action_info.get() : NULL; |
| 17 } |
| 18 |
| 19 } // namespace |
| 20 |
| 9 ActionInfo::ActionInfo() {} | 21 ActionInfo::ActionInfo() {} |
| 10 ActionInfo::~ActionInfo() {} | 22 ActionInfo::~ActionInfo() {} |
| 11 | 23 |
| 24 ActionInfoData::ActionInfoData(ActionInfo* info) : action_info(info) { |
| 25 } |
| 26 |
| 27 ActionInfoData::~ActionInfoData() { |
| 28 } |
| 29 |
| 30 const ActionInfo* ActionInfoData::GetBrowserActionInfo( |
| 31 const Extension* extension) { |
| 32 return GetActionInfo(extension, extension_manifest_keys::kBrowserAction); |
| 33 } |
| 34 |
| 35 const ActionInfo* ActionInfoData::GetScriptBadgeInfo( |
| 36 const Extension* extension) { |
| 37 return GetActionInfo(extension, extension_manifest_keys::kScriptBadge); |
| 38 } |
| 39 |
| 12 } // namespace extensions | 40 } // namespace extensions |
| OLD | NEW |