| 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 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "chrome/common/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
| 9 #include "chrome/common/extensions/extension_manifest_constants.h" | 9 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 ActionInfo::ActionInfo() { | 34 ActionInfo::ActionInfo() { |
| 35 } | 35 } |
| 36 | 36 |
| 37 ActionInfo::~ActionInfo() { | 37 ActionInfo::~ActionInfo() { |
| 38 } | 38 } |
| 39 | 39 |
| 40 // static | 40 // static |
| 41 const ActionInfo* ActionInfo::GetPageActionInfo(const Extension* extension) { |
| 42 ActionInfoData* data = static_cast<ActionInfoData*>( |
| 43 extension->GetManifestData(extension_manifest_keys::kPageAction)); |
| 44 return data ? data->action_info.get() : NULL; |
| 45 } |
| 46 |
| 47 // static |
| 41 const ActionInfo* ActionInfo::GetScriptBadgeInfo(const Extension* extension) { | 48 const ActionInfo* ActionInfo::GetScriptBadgeInfo(const Extension* extension) { |
| 42 ActionInfoData* data = static_cast<ActionInfoData*>( | 49 ActionInfoData* data = static_cast<ActionInfoData*>( |
| 43 extension->GetManifestData(extension_manifest_keys::kScriptBadge)); | 50 extension->GetManifestData(extension_manifest_keys::kScriptBadge)); |
| 44 return data ? data->action_info.get() : NULL; | 51 return data ? data->action_info.get() : NULL; |
| 45 } | 52 } |
| 46 | 53 |
| 47 // static | 54 // static |
| 55 void ActionInfo::SetPageActionInfo(Extension* extension, ActionInfo* info) { |
| 56 extension->SetManifestData(extension_manifest_keys::kPageAction, |
| 57 new ActionInfoData(info)); |
| 58 } |
| 59 |
| 60 // static |
| 48 void ActionInfo::SetScriptBadgeInfo(Extension* extension, ActionInfo* info) { | 61 void ActionInfo::SetScriptBadgeInfo(Extension* extension, ActionInfo* info) { |
| 49 extension->SetManifestData(extension_manifest_keys::kScriptBadge, | 62 extension->SetManifestData(extension_manifest_keys::kScriptBadge, |
| 50 new ActionInfoData(info)); | 63 new ActionInfoData(info)); |
| 51 } | 64 } |
| 52 | 65 |
| 66 // static |
| 67 bool ActionInfo::IsVerboseInstallMessage(const Extension* extension) { |
| 68 const ActionInfo* page_action_info = GetPageActionInfo(extension); |
| 69 return page_action_info && |
| 70 (extension->page_action_command() || |
| 71 !page_action_info->default_icon.empty()); |
| 72 } |
| 73 |
| 53 } // namespace extensions | 74 } // namespace extensions |
| OLD | NEW |