OLD | NEW |
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/browser/extensions/component_loader.h" | 5 #include "chrome/browser/extensions/component_loader.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 command_line->GetSwitchValuePath(switches::kImageLoaderExtensionPath)); | 295 command_line->GetSwitchValuePath(switches::kImageLoaderExtensionPath)); |
296 Add(IDR_IMAGE_LOADER_MANIFEST, image_loader_extension_path); | 296 Add(IDR_IMAGE_LOADER_MANIFEST, image_loader_extension_path); |
297 return; | 297 return; |
298 } | 298 } |
299 #endif // NDEBUG | 299 #endif // NDEBUG |
300 Add(IDR_IMAGE_LOADER_MANIFEST, | 300 Add(IDR_IMAGE_LOADER_MANIFEST, |
301 base::FilePath(FILE_PATH_LITERAL("image_loader"))); | 301 base::FilePath(FILE_PATH_LITERAL("image_loader"))); |
302 #endif // defined(IMAGE_LOADER_EXTENSION) | 302 #endif // defined(IMAGE_LOADER_EXTENSION) |
303 } | 303 } |
304 | 304 |
| 305 void ComponentLoader::AddBookmarksExtensions() { |
| 306 Add(IDR_BOOKMARKS_MANIFEST, |
| 307 base::FilePath(FILE_PATH_LITERAL("bookmark_manager"))); |
| 308 #if defined(ENABLE_ENHANCED_BOOKMARKS) |
| 309 Add(IDR_ENHANCED_BOOKMARKS_MANIFEST, |
| 310 base::FilePath(FILE_PATH_LITERAL("enhanced_bookmark_manager"))); |
| 311 #endif |
| 312 } |
| 313 |
305 void ComponentLoader::AddWithName(int manifest_resource_id, | 314 void ComponentLoader::AddWithName(int manifest_resource_id, |
306 const base::FilePath& root_directory, | 315 const base::FilePath& root_directory, |
307 const std::string& name) { | 316 const std::string& name) { |
308 std::string manifest_contents = | 317 std::string manifest_contents = |
309 ResourceBundle::GetSharedInstance().GetRawDataResource( | 318 ResourceBundle::GetSharedInstance().GetRawDataResource( |
310 manifest_resource_id).as_string(); | 319 manifest_resource_id).as_string(); |
311 | 320 |
312 // The Value is kept for the lifetime of the ComponentLoader. This is | 321 // The Value is kept for the lifetime of the ComponentLoader. This is |
313 // required in case LoadAll() is called again. | 322 // required in case LoadAll() is called again. |
314 base::DictionaryValue* manifest = ParseManifest(manifest_contents); | 323 base::DictionaryValue* manifest = ParseManifest(manifest_contents); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 if (browser_defaults::enable_help_app) { | 376 if (browser_defaults::enable_help_app) { |
368 Add(IDR_HELP_MANIFEST, base::FilePath(FILE_PATH_LITERAL( | 377 Add(IDR_HELP_MANIFEST, base::FilePath(FILE_PATH_LITERAL( |
369 "/usr/share/chromeos-assets/helpapp"))); | 378 "/usr/share/chromeos-assets/helpapp"))); |
370 } | 379 } |
371 #endif | 380 #endif |
372 | 381 |
373 // Skip all other extensions that require user session presence. | 382 // Skip all other extensions that require user session presence. |
374 if (!skip_session_components) { | 383 if (!skip_session_components) { |
375 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 384 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
376 if (!command_line->HasSwitch(chromeos::switches::kGuestSession)) | 385 if (!command_line->HasSwitch(chromeos::switches::kGuestSession)) |
377 Add(IDR_BOOKMARKS_MANIFEST, | 386 AddBookmarksExtensions(); |
378 base::FilePath(FILE_PATH_LITERAL("bookmark_manager"))); | |
379 | 387 |
380 Add(IDR_CROSH_BUILTIN_MANIFEST, base::FilePath(FILE_PATH_LITERAL( | 388 Add(IDR_CROSH_BUILTIN_MANIFEST, base::FilePath(FILE_PATH_LITERAL( |
381 "/usr/share/chromeos-assets/crosh_builtin"))); | 389 "/usr/share/chromeos-assets/crosh_builtin"))); |
382 } | 390 } |
383 #else // !defined(OS_CHROMEOS) | 391 #else // !defined(OS_CHROMEOS) |
384 DCHECK(!skip_session_components); | 392 DCHECK(!skip_session_components); |
385 Add(IDR_BOOKMARKS_MANIFEST, | 393 AddBookmarksExtensions(); |
386 base::FilePath(FILE_PATH_LITERAL("bookmark_manager"))); | |
387 // Cloud Print component app. Not required on Chrome OS. | 394 // Cloud Print component app. Not required on Chrome OS. |
388 Add(IDR_CLOUDPRINT_MANIFEST, | 395 Add(IDR_CLOUDPRINT_MANIFEST, |
389 base::FilePath(FILE_PATH_LITERAL("cloud_print"))); | 396 base::FilePath(FILE_PATH_LITERAL("cloud_print"))); |
390 #endif | 397 #endif |
391 | 398 |
392 if (!skip_session_components) { | 399 if (!skip_session_components) { |
393 AddWebStoreApp(); | 400 AddWebStoreApp(); |
394 AddChromeApp(); | 401 AddChromeApp(); |
395 } | 402 } |
396 | 403 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 | 515 |
509 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { | 516 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { |
510 delete component->manifest; | 517 delete component->manifest; |
511 if (extension_service_->is_ready()) { | 518 if (extension_service_->is_ready()) { |
512 extension_service_-> | 519 extension_service_-> |
513 RemoveComponentExtension(component->extension_id); | 520 RemoveComponentExtension(component->extension_id); |
514 } | 521 } |
515 } | 522 } |
516 | 523 |
517 } // namespace extensions | 524 } // namespace extensions |
OLD | NEW |