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

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

Issue 10914244: Remove support for page_action.icons, and the legacy code surrounding it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: constants removed Created 8 years, 3 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 | Annotate | Revision Log
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"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 l10n_util::GetStringFUTF8( 316 l10n_util::GetStringFUTF8(
317 IDS_EXTENSION_LOAD_PLUGIN_PATH_FAILED, 317 IDS_EXTENSION_LOAD_PLUGIN_PATH_FAILED,
318 plugin.path.LossyDisplayName()); 318 plugin.path.LossyDisplayName());
319 return false; 319 return false;
320 } 320 }
321 } 321 }
322 322
323 // Validate icon location and icon file size for page actions. 323 // Validate icon location and icon file size for page actions.
324 ExtensionAction* page_action = extension->page_action(); 324 ExtensionAction* page_action = extension->page_action();
325 if (page_action) { 325 if (page_action) {
326 std::vector<std::string> icon_paths(*page_action->icon_paths()); 326 std::string path = page_action->default_icon_path();
327 if (!page_action->default_icon_path().empty()) 327 if (!path.empty()) {
328 icon_paths.push_back(page_action->default_icon_path()); 328 const FilePath file_path = extension->GetResource(path).GetFilePath();
329 for (std::vector<std::string>::iterator iter = icon_paths.begin(); 329 if (!ValidateFilePath(file_path)) {
330 iter != icon_paths.end(); ++iter) {
331 const FilePath path = extension->GetResource(*iter).GetFilePath();
332 if (!ValidateFilePath(path)) {
333 *error = 330 *error =
334 l10n_util::GetStringFUTF8( 331 l10n_util::GetStringFUTF8(
335 IDS_EXTENSION_LOAD_ICON_FOR_PAGE_ACTION_FAILED, 332 IDS_EXTENSION_LOAD_ICON_FOR_PAGE_ACTION_FAILED,
336 UTF8ToUTF16(*iter)); 333 UTF8ToUTF16(path));
337 return false; 334 return false;
338 } 335 }
339 } 336 }
340 } 337 }
341 338
342 // Validate icon location and icon file size for browser actions. 339 // Validate icon location and icon file size for browser actions.
343 // Note: browser actions don't use the icon_paths().
344 ExtensionAction* browser_action = extension->browser_action(); 340 ExtensionAction* browser_action = extension->browser_action();
345 if (browser_action) { 341 if (browser_action) {
346 std::string path = browser_action->default_icon_path(); 342 std::string path = browser_action->default_icon_path();
347 if (!path.empty()) { 343 if (!path.empty()) {
348 const FilePath file_path = extension->GetResource(path).GetFilePath(); 344 const FilePath file_path = extension->GetResource(path).GetFilePath();
349 if (!ValidateFilePath(file_path)) { 345 if (!ValidateFilePath(file_path)) {
350 *error = 346 *error =
351 l10n_util::GetStringFUTF8( 347 l10n_util::GetStringFUTF8(
352 IDS_EXTENSION_LOAD_ICON_FOR_BROWSER_ACTION_FAILED, 348 IDS_EXTENSION_LOAD_ICON_FOR_BROWSER_ACTION_FAILED,
353 UTF8ToUTF16(path)); 349 UTF8ToUTF16(path));
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 return temp_path; 782 return temp_path;
787 783
788 return FilePath(); 784 return FilePath();
789 } 785 }
790 786
791 void DeleteFile(const FilePath& path, bool recursive) { 787 void DeleteFile(const FilePath& path, bool recursive) {
792 file_util::Delete(path, recursive); 788 file_util::Delete(path, recursive);
793 } 789 }
794 790
795 } // namespace extension_file_util 791 } // namespace extension_file_util
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_action_unittest.cc ('k') | chrome/common/extensions/extension_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698