| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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/page_action_handler.h" | 5 #include "chrome/common/extensions/api/extension_action/page_action_handler.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/common/extensions/extension_constants.h" | 9 #include "chrome/common/extensions/extension_constants.h" |
| 10 #include "chrome/common/extensions/extension_file_util.h" | |
| 11 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
| 11 #include "extensions/common/file_util.h" |
| 12 #include "extensions/common/manifest_constants.h" | 12 #include "extensions/common/manifest_constants.h" |
| 13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 namespace keys = manifest_keys; | 17 namespace keys = manifest_keys; |
| 18 namespace errors = manifest_errors; | 18 namespace errors = manifest_errors; |
| 19 | 19 |
| 20 PageActionHandler::PageActionHandler() { | 20 PageActionHandler::PageActionHandler() { |
| 21 } | 21 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 return true; | 73 return true; |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool PageActionHandler::Validate(const Extension* extension, | 76 bool PageActionHandler::Validate(const Extension* extension, |
| 77 std::string* error, | 77 std::string* error, |
| 78 std::vector<InstallWarning>* warnings) const { | 78 std::vector<InstallWarning>* warnings) const { |
| 79 const extensions::ActionInfo* action = | 79 const extensions::ActionInfo* action = |
| 80 extensions::ActionInfo::GetPageActionInfo(extension); | 80 extensions::ActionInfo::GetPageActionInfo(extension); |
| 81 if (action && !action->default_icon.empty() && | 81 if (action && !action->default_icon.empty() && |
| 82 !extension_file_util::ValidateExtensionIconSet( | 82 !file_util::ValidateExtensionIconSet( |
| 83 action->default_icon, | 83 action->default_icon, |
| 84 extension, | 84 extension, |
| 85 IDS_EXTENSION_LOAD_ICON_FOR_PAGE_ACTION_FAILED, | 85 IDS_EXTENSION_LOAD_ICON_FOR_PAGE_ACTION_FAILED, |
| 86 error)) { | 86 error)) { |
| 87 return false; | 87 return false; |
| 88 } | 88 } |
| 89 return true; | 89 return true; |
| 90 } | 90 } |
| 91 | 91 |
| 92 const std::vector<std::string> PageActionHandler::Keys() const { | 92 const std::vector<std::string> PageActionHandler::Keys() const { |
| 93 std::vector<std::string> keys; | 93 std::vector<std::string> keys; |
| 94 keys.push_back(keys::kPageAction); | 94 keys.push_back(keys::kPageAction); |
| 95 keys.push_back(keys::kPageActions); | 95 keys.push_back(keys::kPageActions); |
| 96 return keys; | 96 return keys; |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace extensions | 99 } // namespace extensions |
| OLD | NEW |