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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 Add(IDR_ENHANCED_BOOKMARKS_MANIFEST, | 326 Add(IDR_ENHANCED_BOOKMARKS_MANIFEST, |
327 base::FilePath(FILE_PATH_LITERAL("enhanced_bookmark_manager"))); | 327 base::FilePath(FILE_PATH_LITERAL("enhanced_bookmark_manager"))); |
328 #endif | 328 #endif |
329 } | 329 } |
330 | 330 |
331 void ComponentLoader::AddNetworkSpeechSynthesisExtension() { | 331 void ComponentLoader::AddNetworkSpeechSynthesisExtension() { |
332 Add(IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST, | 332 Add(IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST, |
333 base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis"))); | 333 base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis"))); |
334 } | 334 } |
335 | 335 |
336 #if defined(OS_CHROMEOS) | |
337 void ComponentLoader::AddChromeOsSpeechSynthesisExtension() { | |
338 Add(IDR_SPEECH_SYNTHESIS_MANIFEST, | |
339 base::FilePath(extension_misc::kSpeechSynthesisExtensionPath)); | |
340 } | |
341 #endif | |
342 | |
343 void ComponentLoader::AddWithName(int manifest_resource_id, | 336 void ComponentLoader::AddWithName(int manifest_resource_id, |
344 const base::FilePath& root_directory, | 337 const base::FilePath& root_directory, |
345 const std::string& name) { | 338 const std::string& name) { |
346 std::string manifest_contents = | 339 std::string manifest_contents = |
347 ResourceBundle::GetSharedInstance().GetRawDataResource( | 340 ResourceBundle::GetSharedInstance().GetRawDataResource( |
348 manifest_resource_id).as_string(); | 341 manifest_resource_id).as_string(); |
349 | 342 |
350 // The Value is kept for the lifetime of the ComponentLoader. This is | 343 // The Value is kept for the lifetime of the ComponentLoader. This is |
351 // required in case LoadAll() is called again. | 344 // required in case LoadAll() is called again. |
352 base::DictionaryValue* manifest = ParseManifest(manifest_contents); | 345 base::DictionaryValue* manifest = ParseManifest(manifest_contents); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 } | 419 } |
427 | 420 |
428 void ComponentLoader::AddDefaultComponentExtensionsForKioskMode( | 421 void ComponentLoader::AddDefaultComponentExtensionsForKioskMode( |
429 bool skip_session_components) { | 422 bool skip_session_components) { |
430 // No component extension for kiosk app launch splash screen. | 423 // No component extension for kiosk app launch splash screen. |
431 if (skip_session_components) | 424 if (skip_session_components) |
432 return; | 425 return; |
433 | 426 |
434 // Component extensions needed for kiosk apps. | 427 // Component extensions needed for kiosk apps. |
435 AddFileManagerExtension(); | 428 AddFileManagerExtension(); |
436 | |
437 #if defined(OS_CHROMEOS) | |
438 ComponentLoader::AddChromeOsSpeechSynthesisExtension(); | |
439 #endif | |
440 } | 429 } |
441 | 430 |
442 void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages( | 431 void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages( |
443 bool skip_session_components) { | 432 bool skip_session_components) { |
444 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 433 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
445 | 434 |
446 // Component extensions with background pages are not enabled during tests | 435 // Component extensions with background pages are not enabled during tests |
447 // because they generate a lot of background behavior that can interfere. | 436 // because they generate a lot of background behavior that can interfere. |
448 if (!enable_background_extensions_during_testing && | 437 if (!enable_background_extensions_during_testing && |
449 (command_line->HasSwitch(switches::kTestType) || | 438 (command_line->HasSwitch(switches::kTestType) || |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 base::FilePath(FILE_PATH_LITERAL("google_now"))); | 567 base::FilePath(FILE_PATH_LITERAL("google_now"))); |
579 } | 568 } |
580 #endif | 569 #endif |
581 | 570 |
582 #if defined(GOOGLE_CHROME_BUILD) | 571 #if defined(GOOGLE_CHROME_BUILD) |
583 #if !defined(OS_CHROMEOS) // http://crbug.com/314799 | 572 #if !defined(OS_CHROMEOS) // http://crbug.com/314799 |
584 AddNetworkSpeechSynthesisExtension(); | 573 AddNetworkSpeechSynthesisExtension(); |
585 #endif | 574 #endif |
586 #endif // defined(GOOGLE_CHROME_BUILD) | 575 #endif // defined(GOOGLE_CHROME_BUILD) |
587 | 576 |
588 #if defined(OS_CHROMEOS) | |
589 AddChromeOsSpeechSynthesisExtension(); | |
590 #endif // defined(OS_CHROMEOS) | |
591 | |
592 #if defined(ENABLE_PLUGINS) | 577 #if defined(ENABLE_PLUGINS) |
593 base::FilePath pdf_path; | 578 base::FilePath pdf_path; |
594 content::PluginService* plugin_service = | 579 content::PluginService* plugin_service = |
595 content::PluginService::GetInstance(); | 580 content::PluginService::GetInstance(); |
596 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kOutOfProcessPdf) && | 581 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kOutOfProcessPdf) && |
597 PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path) && | 582 PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path) && |
598 plugin_service->GetRegisteredPpapiPluginInfo(pdf_path)) { | 583 plugin_service->GetRegisteredPpapiPluginInfo(pdf_path)) { |
599 Add(IDR_PDF_MANIFEST, base::FilePath(FILE_PATH_LITERAL("pdf"))); | 584 Add(IDR_PDF_MANIFEST, base::FilePath(FILE_PATH_LITERAL("pdf"))); |
600 } | 585 } |
601 #endif | 586 #endif |
602 } | 587 } |
603 | 588 |
604 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { | 589 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { |
605 delete component->manifest; | 590 delete component->manifest; |
606 if (extension_service_->is_ready()) { | 591 if (extension_service_->is_ready()) { |
607 extension_service_-> | 592 extension_service_-> |
608 RemoveComponentExtension(component->extension_id); | 593 RemoveComponentExtension(component->extension_id); |
609 } | 594 } |
610 } | 595 } |
611 | 596 |
612 } // namespace extensions | 597 } // namespace extensions |
OLD | NEW |