Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: chrome/browser/extensions/component_loader.cc

Issue 2229833002: Revert of Move ChromeVox loading out of ComponentLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/component_loader.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "grit/keyboard_resources.h" 49 #include "grit/keyboard_resources.h"
50 #include "ui/file_manager/grit/file_manager_resources.h" 50 #include "ui/file_manager/grit/file_manager_resources.h"
51 #include "ui/keyboard/keyboard_util.h" 51 #include "ui/keyboard/keyboard_util.h"
52 #endif 52 #endif
53 53
54 #if defined(GOOGLE_CHROME_BUILD) 54 #if defined(GOOGLE_CHROME_BUILD)
55 #include "chrome/browser/defaults.h" 55 #include "chrome/browser/defaults.h"
56 #endif 56 #endif
57 57
58 #if defined(OS_CHROMEOS) 58 #if defined(OS_CHROMEOS)
59 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
59 #include "chromeos/chromeos_switches.h" 60 #include "chromeos/chromeos_switches.h"
60 #include "content/public/browser/site_instance.h" 61 #include "content/public/browser/site_instance.h"
61 #include "content/public/browser/storage_partition.h" 62 #include "content/public/browser/storage_partition.h"
62 #include "extensions/browser/extensions_browser_client.h" 63 #include "extensions/browser/extensions_browser_client.h"
63 #include "storage/browser/fileapi/file_system_context.h" 64 #include "storage/browser/fileapi/file_system_context.h"
64 #endif 65 #endif
65 66
66 using content::BrowserThread; 67 using content::BrowserThread;
67 68
68 namespace extensions { 69 namespace extensions {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 base::FilePath(FILE_PATH_LITERAL("image_loader"))); 370 base::FilePath(FILE_PATH_LITERAL("image_loader")));
370 #endif // defined(IMAGE_LOADER_EXTENSION) 371 #endif // defined(IMAGE_LOADER_EXTENSION)
371 } 372 }
372 373
373 void ComponentLoader::AddNetworkSpeechSynthesisExtension() { 374 void ComponentLoader::AddNetworkSpeechSynthesisExtension() {
374 Add(IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST, 375 Add(IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST,
375 base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis"))); 376 base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis")));
376 } 377 }
377 378
378 #if defined(OS_CHROMEOS) 379 #if defined(OS_CHROMEOS)
380 void ComponentLoader::AddChromeVoxExtension(
381 const base::Closure& done_cb) {
382 base::FilePath resources_path;
383 CHECK(PathService::Get(chrome::DIR_RESOURCES, &resources_path));
384
385 base::FilePath chromevox_path =
386 resources_path.Append(extension_misc::kChromeVoxExtensionPath);
387
388 const base::FilePath::CharType* manifest_filename =
389 IsNormalSession() ? extensions::kManifestFilename
390 : extension_misc::kGuestManifestFilename;
391 AddWithManifestFile(
392 manifest_filename,
393 chromevox_path,
394 extension_misc::kChromeVoxExtensionId,
395 done_cb);
396 }
397
379 void ComponentLoader::AddChromeOsSpeechSynthesisExtension() { 398 void ComponentLoader::AddChromeOsSpeechSynthesisExtension() {
380 AddComponentFromDir( 399 const base::FilePath::CharType* manifest_filename =
400 IsNormalSession() ? extensions::kManifestFilename
401 : extension_misc::kGuestManifestFilename;
402 AddWithManifestFile(
403 manifest_filename,
381 base::FilePath(extension_misc::kSpeechSynthesisExtensionPath), 404 base::FilePath(extension_misc::kSpeechSynthesisExtensionPath),
382 extension_misc::kSpeechSynthesisExtensionId, 405 extension_misc::kSpeechSynthesisExtensionId,
383 base::Bind(&ComponentLoader::EnableFileSystemInGuestMode, 406 base::Bind(&ComponentLoader::EnableFileSystemInGuestMode,
384 weak_factory_.GetWeakPtr(), 407 weak_factory_.GetWeakPtr(),
385 extension_misc::kChromeVoxExtensionId)); 408 extension_misc::kChromeVoxExtensionId));
386 } 409 }
387 #endif 410 #endif
388 411
389 void ComponentLoader::AddWithNameAndDescription( 412 void ComponentLoader::AddWithNameAndDescription(
390 int manifest_resource_id, 413 int manifest_resource_id,
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 base::FilePath(FILE_PATH_LITERAL("chromeos/first_run/app"))); 618 base::FilePath(FILE_PATH_LITERAL("chromeos/first_run/app")));
596 619
597 Add(IDR_CONNECTIVITY_DIAGNOSTICS_MANIFEST, 620 Add(IDR_CONNECTIVITY_DIAGNOSTICS_MANIFEST,
598 base::FilePath(extension_misc::kConnectivityDiagnosticsPath)); 621 base::FilePath(extension_misc::kConnectivityDiagnosticsPath));
599 Add(IDR_CONNECTIVITY_DIAGNOSTICS_LAUNCHER_MANIFEST, 622 Add(IDR_CONNECTIVITY_DIAGNOSTICS_LAUNCHER_MANIFEST,
600 base::FilePath(extension_misc::kConnectivityDiagnosticsLauncherPath)); 623 base::FilePath(extension_misc::kConnectivityDiagnosticsLauncherPath));
601 624
602 Add(IDR_ARC_SUPPORT_MANIFEST, 625 Add(IDR_ARC_SUPPORT_MANIFEST,
603 base::FilePath(FILE_PATH_LITERAL("chromeos/arc_support"))); 626 base::FilePath(FILE_PATH_LITERAL("chromeos/arc_support")));
604 } 627 }
628
629 // Load ChromeVox extension now if spoken feedback is enabled.
630 if (chromeos::AccessibilityManager::Get() &&
631 chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled()) {
632 AddChromeVoxExtension(base::Closure());
633 }
605 #endif // defined(OS_CHROMEOS) 634 #endif // defined(OS_CHROMEOS)
606 635
607 #if defined(GOOGLE_CHROME_BUILD) 636 #if defined(GOOGLE_CHROME_BUILD)
608 #if !defined(OS_CHROMEOS) // http://crbug.com/314799 637 #if !defined(OS_CHROMEOS) // http://crbug.com/314799
609 AddNetworkSpeechSynthesisExtension(); 638 AddNetworkSpeechSynthesisExtension();
610 #endif 639 #endif
611 640
612 #endif // defined(GOOGLE_CHROME_BUILD) 641 #endif // defined(GOOGLE_CHROME_BUILD)
613 642
614 Add(IDR_CRYPTOTOKEN_MANIFEST, 643 Add(IDR_CRYPTOTOKEN_MANIFEST,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 off_the_record_context, Extension::GetBaseURLFromExtensionId(id)); 682 off_the_record_context, Extension::GetBaseURLFromExtensionId(id));
654 storage::FileSystemContext* file_system_context = 683 storage::FileSystemContext* file_system_context =
655 content::BrowserContext::GetStoragePartitionForSite( 684 content::BrowserContext::GetStoragePartitionForSite(
656 off_the_record_context, site)->GetFileSystemContext(); 685 off_the_record_context, site)->GetFileSystemContext();
657 file_system_context->EnableTemporaryFileSystemInIncognito(); 686 file_system_context->EnableTemporaryFileSystemInIncognito();
658 } 687 }
659 #endif 688 #endif
660 } 689 }
661 690
662 #if defined(OS_CHROMEOS) 691 #if defined(OS_CHROMEOS)
663 void ComponentLoader::AddComponentFromDir( 692 void ComponentLoader::AddWithManifestFile(
693 const base::FilePath::CharType* manifest_filename,
664 const base::FilePath& root_directory, 694 const base::FilePath& root_directory,
665 const char* extension_id, 695 const char* extension_id,
666 const base::Closure& done_cb) { 696 const base::Closure& done_cb) {
667 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 697 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
668 const base::FilePath::CharType* manifest_filename =
669 IsNormalSession() ? extensions::kManifestFilename
670 : extension_misc::kGuestManifestFilename;
671 BrowserThread::PostTaskAndReplyWithResult( 698 BrowserThread::PostTaskAndReplyWithResult(
672 BrowserThread::FILE, 699 BrowserThread::FILE,
673 FROM_HERE, 700 FROM_HERE,
674 base::Bind(&LoadManifestOnFileThread, root_directory, manifest_filename), 701 base::Bind(&LoadManifestOnFileThread, root_directory, manifest_filename),
675 base::Bind(&ComponentLoader::FinishAddComponentFromDir, 702 base::Bind(&ComponentLoader::FinishAddWithManifestFile,
676 weak_factory_.GetWeakPtr(), 703 weak_factory_.GetWeakPtr(),
677 root_directory, 704 root_directory,
678 extension_id, 705 extension_id,
679 done_cb)); 706 done_cb));
680 } 707 }
681 708
682 void ComponentLoader::FinishAddComponentFromDir( 709 void ComponentLoader::FinishAddWithManifestFile(
683 const base::FilePath& root_directory, 710 const base::FilePath& root_directory,
684 const char* extension_id, 711 const char* extension_id,
685 const base::Closure& done_cb, 712 const base::Closure& done_cb,
686 std::unique_ptr<base::DictionaryValue> manifest) { 713 std::unique_ptr<base::DictionaryValue> manifest) {
687 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 714 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
688 if (!manifest) 715 if (!manifest)
689 return; // Error already logged. 716 return; // Error already logged.
690 std::string actual_extension_id = Add( 717 std::string actual_extension_id = Add(
691 manifest.release(), 718 manifest.release(),
692 root_directory, 719 root_directory,
693 false); 720 false);
694 CHECK_EQ(extension_id, actual_extension_id); 721 CHECK_EQ(extension_id, actual_extension_id);
695 if (!done_cb.is_null()) 722 if (!done_cb.is_null())
696 done_cb.Run(); 723 done_cb.Run();
697 } 724 }
698 #endif 725 #endif
699 726
700 } // namespace extensions 727 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/component_loader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698