| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 const Extension::PrivacyBlacklistInfo& blacklist = | 205 const Extension::PrivacyBlacklistInfo& blacklist = |
| 206 extension->privacy_blacklists()[i]; | 206 extension->privacy_blacklists()[i]; |
| 207 if (!file_util::PathExists(blacklist.path)) { | 207 if (!file_util::PathExists(blacklist.path)) { |
| 208 *error = StringPrintf("Could not load '%s' for privacy blacklist.", | 208 *error = StringPrintf("Could not load '%s' for privacy blacklist.", |
| 209 WideToUTF8(blacklist.path.ToWStringHack()).c_str()); | 209 WideToUTF8(blacklist.path.ToWStringHack()).c_str()); |
| 210 return false; | 210 return false; |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 | 213 |
| 214 // Validate icon location for page actions. | 214 // Validate icon location for page actions. |
| 215 const PageActionMap& page_actions = extension->page_actions(); | 215 const ContextualActionMap& page_actions = extension->page_actions(); |
| 216 for (PageActionMap::const_iterator i(page_actions.begin()); | 216 for (ContextualActionMap::const_iterator i(page_actions.begin()); |
| 217 i != page_actions.end(); ++i) { | 217 i != page_actions.end(); ++i) { |
| 218 PageAction* page_action = i->second; | 218 ContextualAction* page_action = i->second; |
| 219 const std::vector<std::string>& icon_paths = page_action->icon_paths(); | 219 const std::vector<std::string>& icon_paths = page_action->icon_paths(); |
| 220 for (std::vector<std::string>::const_iterator iter = icon_paths.begin(); | 220 for (std::vector<std::string>::const_iterator iter = icon_paths.begin(); |
| 221 iter != icon_paths.end(); ++iter) { | 221 iter != icon_paths.end(); ++iter) { |
| 222 if (!file_util::PathExists(extension->GetResourcePath(*iter))) { | 222 if (!file_util::PathExists(extension->GetResourcePath(*iter))) { |
| 223 *error = StringPrintf("Could not load icon '%s' for page action.", | 223 *error = StringPrintf("Could not load icon '%s' for page action.", |
| 224 iter->c_str()); | 224 iter->c_str()); |
| 225 return false; | 225 return false; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 // Validate icon location for browser actions. |
| 231 const ContextualAction* browser_action = extension->browser_action(); |
| 232 if (browser_action) { |
| 233 const std::vector<std::string>& icon_paths = browser_action->icon_paths(); |
| 234 for (std::vector<std::string>::const_iterator iter = icon_paths.begin(); |
| 235 iter != icon_paths.end(); ++iter) { |
| 236 if (!file_util::PathExists(extension->GetResourcePath(*iter))) { |
| 237 *error = StringPrintf("Could not load icon '%s' for browser action.", |
| 238 iter->c_str()); |
| 239 return false; |
| 240 } |
| 241 } |
| 242 } |
| 243 |
| 230 // Check children of extension root to see if any of them start with _ and is | 244 // Check children of extension root to see if any of them start with _ and is |
| 231 // not on the reserved list. | 245 // not on the reserved list. |
| 232 if (!CheckForIllegalFilenames(extension->path(), error)) { | 246 if (!CheckForIllegalFilenames(extension->path(), error)) { |
| 233 return false; | 247 return false; |
| 234 } | 248 } |
| 235 | 249 |
| 236 return true; | 250 return true; |
| 237 } | 251 } |
| 238 | 252 |
| 239 void UninstallExtension(const std::string& id, const FilePath& extensions_dir) { | 253 void UninstallExtension(const std::string& id, const FilePath& extensions_dir) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 "Filenames starting with \"_\" are reserved for use by the system", | 384 "Filenames starting with \"_\" are reserved for use by the system", |
| 371 filename.c_str()); | 385 filename.c_str()); |
| 372 return false; | 386 return false; |
| 373 } | 387 } |
| 374 } | 388 } |
| 375 | 389 |
| 376 return true; | 390 return true; |
| 377 } | 391 } |
| 378 | 392 |
| 379 } // extension_file_util | 393 } // extension_file_util |
| OLD | NEW |