Chromium Code Reviews| 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/extension_file_util.h" | 5 #include "chrome/common/extensions/extension_file_util.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/json/json_file_value_serializer.h" | 13 #include "base/json/json_file_value_serializer.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
| 18 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
| 21 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
| 22 #include "chrome/common/extensions/api/extension_action/action_info.h" | |
| 22 #include "chrome/common/extensions/extension.h" | 23 #include "chrome/common/extensions/extension.h" |
| 23 #include "chrome/common/extensions/extension_l10n_util.h" | 24 #include "chrome/common/extensions/extension_l10n_util.h" |
| 24 #include "chrome/common/extensions/extension_manifest_constants.h" | 25 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 25 #include "chrome/common/extensions/extension_messages.h" | 26 #include "chrome/common/extensions/extension_messages.h" |
| 26 #include "chrome/common/extensions/extension_resource.h" | 27 #include "chrome/common/extensions/extension_resource.h" |
| 27 #include "chrome/common/extensions/message_bundle.h" | 28 #include "chrome/common/extensions/message_bundle.h" |
| 28 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
| 29 #include "net/base/escape.h" | 30 #include "net/base/escape.h" |
| 30 #include "net/base/file_stream.h" | 31 #include "net/base/file_stream.h" |
| 31 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 const Extension::PluginInfo& plugin = extension->plugins()[i]; | 321 const Extension::PluginInfo& plugin = extension->plugins()[i]; |
| 321 if (!file_util::PathExists(plugin.path)) { | 322 if (!file_util::PathExists(plugin.path)) { |
| 322 *error = | 323 *error = |
| 323 l10n_util::GetStringFUTF8( | 324 l10n_util::GetStringFUTF8( |
| 324 IDS_EXTENSION_LOAD_PLUGIN_PATH_FAILED, | 325 IDS_EXTENSION_LOAD_PLUGIN_PATH_FAILED, |
| 325 plugin.path.LossyDisplayName()); | 326 plugin.path.LossyDisplayName()); |
| 326 return false; | 327 return false; |
| 327 } | 328 } |
| 328 } | 329 } |
| 329 | 330 |
| 330 const Extension::ActionInfo* action = extension->page_action_info(); | 331 const extensions::ActionInfo* action = extension->page_action_info(); |
|
Yoyo Zhou
2012/12/18 02:01:41
Note that it's also not good for this class to kno
| |
| 331 if (action && !action->default_icon.empty() && | 332 if (action && !action->default_icon.empty() && |
| 332 !ValidateExtensionIconSet(action->default_icon, extension, | 333 !ValidateExtensionIconSet(action->default_icon, extension, |
| 333 IDS_EXTENSION_LOAD_ICON_FOR_PAGE_ACTION_FAILED, error)) { | 334 IDS_EXTENSION_LOAD_ICON_FOR_PAGE_ACTION_FAILED, error)) { |
| 334 return false; | 335 return false; |
| 335 } | 336 } |
| 336 | 337 |
| 337 action = extension->browser_action_info(); | 338 action = extension->browser_action_info(); |
| 338 if (action && !action->default_icon.empty() && | 339 if (action && !action->default_icon.empty() && |
| 339 !ValidateExtensionIconSet(action->default_icon, extension, | 340 !ValidateExtensionIconSet(action->default_icon, extension, |
| 340 IDS_EXTENSION_LOAD_ICON_FOR_BROWSER_ACTION_FAILED, error)) { | 341 IDS_EXTENSION_LOAD_ICON_FOR_BROWSER_ACTION_FAILED, error)) { |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 753 return FilePath(); | 754 return FilePath(); |
| 754 } | 755 } |
| 755 return temp_path; | 756 return temp_path; |
| 756 } | 757 } |
| 757 | 758 |
| 758 void DeleteFile(const FilePath& path, bool recursive) { | 759 void DeleteFile(const FilePath& path, bool recursive) { |
| 759 file_util::Delete(path, recursive); | 760 file_util::Delete(path, recursive); |
| 760 } | 761 } |
| 761 | 762 |
| 762 } // namespace extension_file_util | 763 } // namespace extension_file_util |
| OLD | NEW |