| OLD | NEW |
| 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 const Extension::PrivacyBlacklistInfo& blacklist = | 221 const Extension::PrivacyBlacklistInfo& blacklist = |
| 222 extension->privacy_blacklists()[i]; | 222 extension->privacy_blacklists()[i]; |
| 223 if (!file_util::PathExists(blacklist.path)) { | 223 if (!file_util::PathExists(blacklist.path)) { |
| 224 *error = StringPrintf("Could not load '%s' for privacy blacklist.", | 224 *error = StringPrintf("Could not load '%s' for privacy blacklist.", |
| 225 WideToUTF8(blacklist.path.ToWStringHack()).c_str()); | 225 WideToUTF8(blacklist.path.ToWStringHack()).c_str()); |
| 226 return false; | 226 return false; |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 // Validate icon location for page actions. | 230 // Validate icon location for page actions. |
| 231 ExtensionAction2* page_action = extension->page_action(); | 231 ExtensionAction* page_action = extension->page_action(); |
| 232 if (page_action) { | 232 if (page_action) { |
| 233 std::vector<std::string> icon_paths(*page_action->icon_paths()); | 233 std::vector<std::string> icon_paths(*page_action->icon_paths()); |
| 234 if (!page_action->default_icon_path().empty()) | 234 if (!page_action->default_icon_path().empty()) |
| 235 icon_paths.push_back(page_action->default_icon_path()); | 235 icon_paths.push_back(page_action->default_icon_path()); |
| 236 for (std::vector<std::string>::iterator iter = icon_paths.begin(); | 236 for (std::vector<std::string>::iterator iter = icon_paths.begin(); |
| 237 iter != icon_paths.end(); ++iter) { | 237 iter != icon_paths.end(); ++iter) { |
| 238 if (extension->GetResource(*iter).GetFilePath().empty()) { | 238 if (extension->GetResource(*iter).GetFilePath().empty()) { |
| 239 *error = StringPrintf("Could not load icon '%s' for page action.", | 239 *error = StringPrintf("Could not load icon '%s' for page action.", |
| 240 iter->c_str()); | 240 iter->c_str()); |
| 241 return false; | 241 return false; |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 | 245 |
| 246 // Validate icon location for browser actions. | 246 // Validate icon location for browser actions. |
| 247 // Note: browser actions don't use the icon_paths(). | 247 // Note: browser actions don't use the icon_paths(). |
| 248 ExtensionAction2* browser_action = extension->browser_action(); | 248 ExtensionAction* browser_action = extension->browser_action(); |
| 249 if (browser_action) { | 249 if (browser_action) { |
| 250 std::string default_icon_path = browser_action->default_icon_path(); | 250 std::string default_icon_path = browser_action->default_icon_path(); |
| 251 if (!default_icon_path.empty()) { | 251 if (!default_icon_path.empty()) { |
| 252 if (extension->GetResource(default_icon_path).GetFilePath().empty()) { | 252 if (extension->GetResource(default_icon_path).GetFilePath().empty()) { |
| 253 *error = StringPrintf("Could not load icon '%s' for browser action.", | 253 *error = StringPrintf("Could not load icon '%s' for browser action.", |
| 254 default_icon_path.c_str()); | 254 default_icon_path.c_str()); |
| 255 return false; | 255 return false; |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 } | 258 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 "Filenames starting with \"_\" are reserved for use by the system.", | 401 "Filenames starting with \"_\" are reserved for use by the system.", |
| 402 filename.c_str()); | 402 filename.c_str()); |
| 403 return false; | 403 return false; |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 | 406 |
| 407 return true; | 407 return true; |
| 408 } | 408 } |
| 409 | 409 |
| 410 } // namespace extension_file_util | 410 } // namespace extension_file_util |
| OLD | NEW |