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

Unified Diff: chrome/browser/extensions/component_loader.cc

Issue 141733008: Use incognito split for ChromeVox and TTS in Guest mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added comment Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/component_loader.cc
diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc
index e31c954e5f9a038b9cdf5a95f94aa0d59c1bb338..ea921790c7c77b2eccd9d8e318e89ce44ee3bded 100644
--- a/chrome/browser/extensions/component_loader.cc
+++ b/chrome/browser/extensions/component_loader.cc
@@ -333,6 +333,25 @@ void ComponentLoader::AddNetworkSpeechSynthesisExtension() {
base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis")));
}
+#if defined(OS_CHROMEOS)
+std::string ComponentLoader::AddChromeVoxExtension() {
+ const CommandLine* command_line = CommandLine::ForCurrentProcess();
+ int idr = command_line->HasSwitch(chromeos::switches::kGuestSession) ?
+ IDR_CHROMEVOX_GUEST_MANIFEST : IDR_CHROMEVOX_MANIFEST;
+ return Add(idr, base::FilePath(extension_misc::kChromeVoxExtensionPath));
+}
+
+std::string ComponentLoader::AddChromeOsSpeechSynthesisExtension() {
+ const CommandLine* command_line = CommandLine::ForCurrentProcess();
+ int idr = command_line->HasSwitch(chromeos::switches::kGuestSession) ?
+ IDR_SPEECH_SYNTHESIS_GUEST_MANIFEST : IDR_SPEECH_SYNTHESIS_MANIFEST;
+ std::string id = Add(idr,
+ base::FilePath(extension_misc::kSpeechSynthesisExtensionPath));
+ EnableFileSystemInGuestMode(id);
+ return id;
+}
+#endif
+
void ComponentLoader::AddWithName(int manifest_resource_id,
const base::FilePath& root_directory,
const std::string& name) {
@@ -479,21 +498,7 @@ void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages(
chromeos::switches::kDisableQuickofficeComponentApp)) {
std::string id = Add(IDR_QUICKOFFICE_MANIFEST, base::FilePath(
FILE_PATH_LITERAL("/usr/share/chromeos-assets/quick_office")));
- if (command_line->HasSwitch(chromeos::switches::kGuestSession)) {
- // TODO(dpolukhin): Hack to enable HTML5 temporary file system for
- // Quickoffice. It doesn't work without temporary file system access.
- // Make sure temporary file system is enabled in the off the record
- // browser context (as that is the one used in guest session).
- content::BrowserContext* off_the_record_context =
- ExtensionsBrowserClient::Get()->GetOffTheRecordContext(
- browser_context_);
- GURL site = content::SiteInstance::GetSiteForURL(
- off_the_record_context, Extension::GetBaseURLFromExtensionId(id));
- fileapi::FileSystemContext* file_system_context =
- content::BrowserContext::GetStoragePartitionForSite(
- off_the_record_context, site)->GetFileSystemContext();
- file_system_context->EnableTemporaryFileSystemInIncognito();
- }
+ EnableFileSystemInGuestMode(id);
}
#endif // defined(GOOGLE_CHROME_BUILD)
@@ -527,9 +532,7 @@ void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages(
// Load ChromeVox extension now if spoken feedback is enabled.
if (chromeos::AccessibilityManager::Get() &&
chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled()) {
- base::FilePath path =
- base::FilePath(extension_misc::kChromeVoxExtensionPath);
- Add(IDR_CHROMEVOX_MANIFEST, path);
+ AddChromeVoxExtension();
}
#endif // defined(OS_CHROMEOS)
@@ -594,4 +597,25 @@ void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) {
}
}
+void ComponentLoader::EnableFileSystemInGuestMode(const std::string& id) {
+#if defined(OS_CHROMEOS)
+ const CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(chromeos::switches::kGuestSession)) {
+ // TODO(dpolukhin): Hack to enable HTML5 temporary file system for
+ // the extension. Some component extensions don't work without temporary
+ // file system access. Make sure temporary file system is enabled in the off
+ // the record browser context (as that is the one used in guest session).
+ content::BrowserContext* off_the_record_context =
+ ExtensionsBrowserClient::Get()->GetOffTheRecordContext(
+ browser_context_);
+ GURL site = content::SiteInstance::GetSiteForURL(
+ off_the_record_context, Extension::GetBaseURLFromExtensionId(id));
+ fileapi::FileSystemContext* file_system_context =
+ content::BrowserContext::GetStoragePartitionForSite(
+ off_the_record_context, site)->GetFileSystemContext();
+ file_system_context->EnableTemporaryFileSystemInIncognito();
+ }
+#endif
+}
+
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/component_loader.h ('k') | chrome/browser/resources/chromeos/chromevox/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698