| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 308 |
| 309 void ComponentLoader::AddBookmarksExtensions() { | 309 void ComponentLoader::AddBookmarksExtensions() { |
| 310 Add(IDR_BOOKMARKS_MANIFEST, | 310 Add(IDR_BOOKMARKS_MANIFEST, |
| 311 base::FilePath(FILE_PATH_LITERAL("bookmark_manager"))); | 311 base::FilePath(FILE_PATH_LITERAL("bookmark_manager"))); |
| 312 #if defined(ENABLE_ENHANCED_BOOKMARKS) | 312 #if defined(ENABLE_ENHANCED_BOOKMARKS) |
| 313 Add(IDR_ENHANCED_BOOKMARKS_MANIFEST, | 313 Add(IDR_ENHANCED_BOOKMARKS_MANIFEST, |
| 314 base::FilePath(FILE_PATH_LITERAL("enhanced_bookmark_manager"))); | 314 base::FilePath(FILE_PATH_LITERAL("enhanced_bookmark_manager"))); |
| 315 #endif | 315 #endif |
| 316 } | 316 } |
| 317 | 317 |
| 318 void ComponentLoader::AddNetworkSpeechSynthesisExtension() { |
| 319 Add(IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST, |
| 320 base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis"))); |
| 321 } |
| 322 |
| 318 void ComponentLoader::AddWithName(int manifest_resource_id, | 323 void ComponentLoader::AddWithName(int manifest_resource_id, |
| 319 const base::FilePath& root_directory, | 324 const base::FilePath& root_directory, |
| 320 const std::string& name) { | 325 const std::string& name) { |
| 321 std::string manifest_contents = | 326 std::string manifest_contents = |
| 322 ResourceBundle::GetSharedInstance().GetRawDataResource( | 327 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 323 manifest_resource_id).as_string(); | 328 manifest_resource_id).as_string(); |
| 324 | 329 |
| 325 // The Value is kept for the lifetime of the ComponentLoader. This is | 330 // The Value is kept for the lifetime of the ComponentLoader. This is |
| 326 // required in case LoadAll() is called again. | 331 // required in case LoadAll() is called again. |
| 327 base::DictionaryValue* manifest = ParseManifest(manifest_contents); | 332 base::DictionaryValue* manifest = ParseManifest(manifest_contents); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 enable_prefix.length(), | 524 enable_prefix.length(), |
| 520 enable_prefix) == 0) && | 525 enable_prefix) == 0) && |
| 521 !CommandLine::ForCurrentProcess()->HasSwitch( | 526 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 522 switches::kDisableGoogleNowIntegration)) || | 527 switches::kDisableGoogleNowIntegration)) || |
| 523 CommandLine::ForCurrentProcess()->HasSwitch( | 528 CommandLine::ForCurrentProcess()->HasSwitch( |
| 524 switches::kEnableGoogleNowIntegration)) { | 529 switches::kEnableGoogleNowIntegration)) { |
| 525 Add(IDR_GOOGLE_NOW_MANIFEST, | 530 Add(IDR_GOOGLE_NOW_MANIFEST, |
| 526 base::FilePath(FILE_PATH_LITERAL("google_now"))); | 531 base::FilePath(FILE_PATH_LITERAL("google_now"))); |
| 527 } | 532 } |
| 528 #endif | 533 #endif |
| 534 |
| 535 #if defined(GOOGLE_CHROME_BUILD) |
| 536 AddNetworkSpeechSynthesisExtension(); |
| 537 #endif // defined(GOOGLE_CHROME_BUILD) |
| 529 } | 538 } |
| 530 | 539 |
| 531 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { | 540 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { |
| 532 delete component->manifest; | 541 delete component->manifest; |
| 533 if (extension_service_->is_ready()) { | 542 if (extension_service_->is_ready()) { |
| 534 extension_service_-> | 543 extension_service_-> |
| 535 RemoveComponentExtension(component->extension_id); | 544 RemoveComponentExtension(component->extension_id); |
| 536 } | 545 } |
| 537 } | 546 } |
| 538 | 547 |
| 539 } // namespace extensions | 548 } // namespace extensions |
| OLD | NEW |