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

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

Issue 160550: Put the null pointer check for theme images before we use the (Closed)
Patch Set: Created 11 years, 4 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 | « no previous file | no next file » | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser/extensions/extension_file_util.h" 5 #include "chrome/browser/extensions/extension_file_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (!file_util::PathExists(extension->GetResourcePath(iter->second))) { 189 if (!file_util::PathExists(extension->GetResourcePath(iter->second))) {
190 *error = StringPrintf("Could not load extension icon '%s'.", 190 *error = StringPrintf("Could not load extension icon '%s'.",
191 iter->second.c_str()); 191 iter->second.c_str());
192 return NULL; 192 return NULL;
193 } 193 }
194 } 194 }
195 195
196 // Theme resource validation. 196 // Theme resource validation.
197 if (extension->IsTheme()) { 197 if (extension->IsTheme()) {
198 DictionaryValue* images_value = extension->GetThemeImages(); 198 DictionaryValue* images_value = extension->GetThemeImages();
199 DictionaryValue::key_iterator iter = images_value->begin_keys();
200 if (images_value) { 199 if (images_value) {
200 DictionaryValue::key_iterator iter = images_value->begin_keys();
201 while (iter != images_value->end_keys()) { 201 while (iter != images_value->end_keys()) {
202 std::string val; 202 std::string val;
203 if (images_value->GetString(*iter , &val)) { 203 if (images_value->GetString(*iter , &val)) {
204 FilePath image_path = extension->path().AppendASCII(val); 204 FilePath image_path = extension->path().AppendASCII(val);
205 if (!file_util::PathExists(image_path)) { 205 if (!file_util::PathExists(image_path)) {
206 *error = StringPrintf( 206 *error = StringPrintf(
207 "Could not load '%s' for theme.", 207 "Could not load '%s' for theme.",
208 WideToUTF8(image_path.ToWStringHack()).c_str()); 208 WideToUTF8(image_path.ToWStringHack()).c_str());
209 return NULL; 209 return NULL;
210 } 210 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 "directory: " << extension_id; 333 "directory: " << extension_id;
334 LOG(INFO) << "Deleting invalid extension directory " 334 LOG(INFO) << "Deleting invalid extension directory "
335 << WideToASCII(extension_path.ToWStringHack()) << "."; 335 << WideToASCII(extension_path.ToWStringHack()) << ".";
336 file_util::Delete(extension_path, true); // Recursive. 336 file_util::Delete(extension_path, true); // Recursive.
337 continue; 337 continue;
338 } 338 }
339 } 339 }
340 } 340 }
341 341
342 } // extensionfile_util 342 } // extensionfile_util
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698