Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2049)

Side by Side Diff: chrome/common/extensions/extension_file_util.cc

Issue 11968032: Move 'theme' parsing out of Extension class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed IncognitoAutofillManagerTest unittest Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | chrome/common/extensions/unpacker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/api/extension_action/action_info.h"
23 #include "chrome/common/extensions/api/extension_action/browser_action_handler.h " 23 #include "chrome/common/extensions/api/extension_action/browser_action_handler.h "
24 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" 24 #include "chrome/common/extensions/api/i18n/default_locale_handler.h"
25 #include "chrome/common/extensions/api/themes/theme_handler.h"
25 #include "chrome/common/extensions/extension.h" 26 #include "chrome/common/extensions/extension.h"
26 #include "chrome/common/extensions/extension_l10n_util.h" 27 #include "chrome/common/extensions/extension_l10n_util.h"
27 #include "chrome/common/extensions/extension_manifest_constants.h" 28 #include "chrome/common/extensions/extension_manifest_constants.h"
28 #include "chrome/common/extensions/extension_messages.h" 29 #include "chrome/common/extensions/extension_messages.h"
29 #include "chrome/common/extensions/extension_resource.h" 30 #include "chrome/common/extensions/extension_resource.h"
30 #include "chrome/common/extensions/manifest.h" 31 #include "chrome/common/extensions/manifest.h"
31 #include "chrome/common/extensions/manifest_url_handler.h" 32 #include "chrome/common/extensions/manifest_url_handler.h"
32 #include "chrome/common/extensions/message_bundle.h" 33 #include "chrome/common/extensions/message_bundle.h"
33 #include "extensions/common/install_warning.h" 34 #include "extensions/common/install_warning.h"
34 #include "grit/generated_resources.h" 35 #include "grit/generated_resources.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 if (!ValidateFilePath(path)) { 264 if (!ValidateFilePath(path)) {
264 *error = 265 *error =
265 l10n_util::GetStringFUTF8(IDS_EXTENSION_LOAD_ICON_FAILED, 266 l10n_util::GetStringFUTF8(IDS_EXTENSION_LOAD_ICON_FAILED,
266 UTF8ToUTF16(iter->second)); 267 UTF8ToUTF16(iter->second));
267 return false; 268 return false;
268 } 269 }
269 } 270 }
270 271
271 // Theme resource validation. 272 // Theme resource validation.
272 if (extension->is_theme()) { 273 if (extension->is_theme()) {
273 DictionaryValue* images_value = extension->GetThemeImages(); 274 DictionaryValue* images_value =
275 extensions::ThemeInfo::GetThemeImages(extension);
274 if (images_value) { 276 if (images_value) {
275 for (DictionaryValue::Iterator iter(*images_value); !iter.IsAtEnd(); 277 for (DictionaryValue::Iterator iter(*images_value); !iter.IsAtEnd();
276 iter.Advance()) { 278 iter.Advance()) {
277 std::string val; 279 std::string val;
278 if (iter.value().GetAsString(&val)) { 280 if (iter.value().GetAsString(&val)) {
279 base::FilePath image_path = extension->path().Append( 281 base::FilePath image_path = extension->path().Append(
280 base::FilePath::FromUTF8Unsafe(val)); 282 base::FilePath::FromUTF8Unsafe(val));
281 if (!file_util::PathExists(image_path)) { 283 if (!file_util::PathExists(image_path)) {
282 *error = 284 *error =
283 l10n_util::GetStringFUTF8(IDS_EXTENSION_INVALID_IMAGE_PATH, 285 l10n_util::GetStringFUTF8(IDS_EXTENSION_INVALID_IMAGE_PATH,
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 return base::FilePath(); 771 return base::FilePath();
770 } 772 }
771 return temp_path; 773 return temp_path;
772 } 774 }
773 775
774 void DeleteFile(const base::FilePath& path, bool recursive) { 776 void DeleteFile(const base::FilePath& path, bool recursive) {
775 file_util::Delete(path, recursive); 777 file_util::Delete(path, recursive);
776 } 778 }
777 779
778 } // namespace extension_file_util 780 } // namespace extension_file_util
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | chrome/common/extensions/unpacker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698