| 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 Add(IDR_ENHANCED_BOOKMARKS_MANIFEST, | 314 Add(IDR_ENHANCED_BOOKMARKS_MANIFEST, |
| 315 base::FilePath(FILE_PATH_LITERAL("enhanced_bookmark_manager"))); | 315 base::FilePath(FILE_PATH_LITERAL("enhanced_bookmark_manager"))); |
| 316 #endif | 316 #endif |
| 317 } | 317 } |
| 318 | 318 |
| 319 void ComponentLoader::AddNetworkSpeechSynthesisExtension() { | 319 void ComponentLoader::AddNetworkSpeechSynthesisExtension() { |
| 320 Add(IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST, | 320 Add(IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST, |
| 321 base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis"))); | 321 base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis"))); |
| 322 } | 322 } |
| 323 | 323 |
| 324 void ComponentLoader::AddChromeOsSpeechSynthesisExtension() { |
| 325 Add(IDR_SPEECH_SYNTHESIS_MANIFEST, |
| 326 base::FilePath(extension_misc::kSpeechSynthesisExtensionPath)); |
| 327 } |
| 328 |
| 324 void ComponentLoader::AddWithName(int manifest_resource_id, | 329 void ComponentLoader::AddWithName(int manifest_resource_id, |
| 325 const base::FilePath& root_directory, | 330 const base::FilePath& root_directory, |
| 326 const std::string& name) { | 331 const std::string& name) { |
| 327 std::string manifest_contents = | 332 std::string manifest_contents = |
| 328 ResourceBundle::GetSharedInstance().GetRawDataResource( | 333 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 329 manifest_resource_id).as_string(); | 334 manifest_resource_id).as_string(); |
| 330 | 335 |
| 331 // The Value is kept for the lifetime of the ComponentLoader. This is | 336 // The Value is kept for the lifetime of the ComponentLoader. This is |
| 332 // required in case LoadAll() is called again. | 337 // required in case LoadAll() is called again. |
| 333 base::DictionaryValue* manifest = ParseManifest(manifest_contents); | 338 base::DictionaryValue* manifest = ParseManifest(manifest_contents); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 Add(IDR_GOOGLE_NOW_MANIFEST, | 558 Add(IDR_GOOGLE_NOW_MANIFEST, |
| 554 base::FilePath(FILE_PATH_LITERAL("google_now"))); | 559 base::FilePath(FILE_PATH_LITERAL("google_now"))); |
| 555 } | 560 } |
| 556 #endif | 561 #endif |
| 557 | 562 |
| 558 #if defined(GOOGLE_CHROME_BUILD) | 563 #if defined(GOOGLE_CHROME_BUILD) |
| 559 #if !defined(OS_CHROMEOS) // http://crbug.com/314799 | 564 #if !defined(OS_CHROMEOS) // http://crbug.com/314799 |
| 560 AddNetworkSpeechSynthesisExtension(); | 565 AddNetworkSpeechSynthesisExtension(); |
| 561 #endif | 566 #endif |
| 562 #endif // defined(GOOGLE_CHROME_BUILD) | 567 #endif // defined(GOOGLE_CHROME_BUILD) |
| 568 #if defined(OS_CHROMEOS) |
| 569 AddChromeOsSpeechSynthesisExtension(); |
| 570 #endif // defined(OS_CHROMEOS) |
| 563 } | 571 } |
| 564 | 572 |
| 565 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { | 573 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { |
| 566 delete component->manifest; | 574 delete component->manifest; |
| 567 if (extension_service_->is_ready()) { | 575 if (extension_service_->is_ready()) { |
| 568 extension_service_-> | 576 extension_service_-> |
| 569 RemoveComponentExtension(component->extension_id); | 577 RemoveComponentExtension(component->extension_id); |
| 570 } | 578 } |
| 571 } | 579 } |
| 572 | 580 |
| 573 } // namespace extensions | 581 } // namespace extensions |
| OLD | NEW |