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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 309 |
310 void ComponentLoader::AddBookmarksExtensions() { | 310 void ComponentLoader::AddBookmarksExtensions() { |
311 Add(IDR_BOOKMARKS_MANIFEST, | 311 Add(IDR_BOOKMARKS_MANIFEST, |
312 base::FilePath(FILE_PATH_LITERAL("bookmark_manager"))); | 312 base::FilePath(FILE_PATH_LITERAL("bookmark_manager"))); |
313 #if defined(ENABLE_ENHANCED_BOOKMARKS) | 313 #if defined(ENABLE_ENHANCED_BOOKMARKS) |
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() { | |
320 Add(IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST, | |
321 base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis"))); | |
322 } | |
323 | |
324 void ComponentLoader::AddWithName(int manifest_resource_id, | 319 void ComponentLoader::AddWithName(int manifest_resource_id, |
325 const base::FilePath& root_directory, | 320 const base::FilePath& root_directory, |
326 const std::string& name) { | 321 const std::string& name) { |
327 std::string manifest_contents = | 322 std::string manifest_contents = |
328 ResourceBundle::GetSharedInstance().GetRawDataResource( | 323 ResourceBundle::GetSharedInstance().GetRawDataResource( |
329 manifest_resource_id).as_string(); | 324 manifest_resource_id).as_string(); |
330 | 325 |
331 // The Value is kept for the lifetime of the ComponentLoader. This is | 326 // The Value is kept for the lifetime of the ComponentLoader. This is |
332 // required in case LoadAll() is called again. | 327 // required in case LoadAll() is called again. |
333 base::DictionaryValue* manifest = ParseManifest(manifest_contents); | 328 base::DictionaryValue* manifest = ParseManifest(manifest_contents); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 | 536 |
542 bool disabled_via_flag = | 537 bool disabled_via_flag = |
543 CommandLine::ForCurrentProcess()->HasSwitch( | 538 CommandLine::ForCurrentProcess()->HasSwitch( |
544 switches::kDisableGoogleNowIntegration); | 539 switches::kDisableGoogleNowIntegration); |
545 | 540 |
546 if (enabled && !disabled_via_flag) { | 541 if (enabled && !disabled_via_flag) { |
547 Add(IDR_GOOGLE_NOW_MANIFEST, | 542 Add(IDR_GOOGLE_NOW_MANIFEST, |
548 base::FilePath(FILE_PATH_LITERAL("google_now"))); | 543 base::FilePath(FILE_PATH_LITERAL("google_now"))); |
549 } | 544 } |
550 #endif | 545 #endif |
551 | |
552 #if defined(GOOGLE_CHROME_BUILD) | |
553 AddNetworkSpeechSynthesisExtension(); | |
554 #endif // defined(GOOGLE_CHROME_BUILD) | |
555 } | 546 } |
556 | 547 |
557 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { | 548 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { |
558 delete component->manifest; | 549 delete component->manifest; |
559 if (extension_service_->is_ready()) { | 550 if (extension_service_->is_ready()) { |
560 extension_service_-> | 551 extension_service_-> |
561 RemoveComponentExtension(component->extension_id); | 552 RemoveComponentExtension(component->extension_id); |
562 } | 553 } |
563 } | 554 } |
564 | 555 |
565 } // namespace extensions | 556 } // namespace extensions |
OLD | NEW |