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

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: fix Chromium build 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
« no previous file with comments | « chrome/browser/extensions/component_loader.h ('k') | webkit/browser/fileapi/file_system_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/component_loader.cc
diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc
index 6c5292970d28ab20b762ebc86c9e0ab35cf64735..46f100c3fef21750850eb5cb22dc225ef60ec1c7 100644
--- a/chrome/browser/extensions/component_loader.cc
+++ b/chrome/browser/extensions/component_loader.cc
@@ -183,9 +183,22 @@ std::string ComponentLoader::Add(const std::string& manifest_contents,
return std::string();
}
-std::string ComponentLoader::Add(const base::DictionaryValue* parsed_manifest,
+std::string ComponentLoader::Add(base::DictionaryValue* parsed_manifest,
const base::FilePath& root_directory) {
ComponentExtensionInfo info(parsed_manifest, root_directory);
+#if defined(OS_CHROMEOS)
+ // Force incognito split in Guest mode for some component extensions.
+ // In Guest mode non-incognito background pages are not allowed so
+ // split mode is required.
+ if (info.extension_id == extension_misc::kChromeVoxExtensionId ||
+ info.extension_id == extension_misc::kSpeechSynthesisExtensionId) {
+ const CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(chromeos::switches::kGuestSession)) {
+ parsed_manifest->SetString(manifest_keys::kIncognito,
+ manifest_values::kIncognitoSplit);
+ }
+ }
+#endif
asargent_no_longer_on_chrome 2014/02/06 00:58:02 It seems a little hacky to inject a value into the
Dmitry Polukhin 2014/02/06 01:30:21 I'm not aware of the fix for the file manager. Do
component_extensions_.push_back(info);
if (extension_service_->is_ready())
Load(info);
@@ -326,8 +339,9 @@ void ComponentLoader::AddNetworkSpeechSynthesisExtension() {
#if defined(OS_CHROMEOS)
void ComponentLoader::AddChromeOsSpeechSynthesisExtension() {
- Add(IDR_SPEECH_SYNTHESIS_MANIFEST,
+ std::string id = Add(IDR_SPEECH_SYNTHESIS_MANIFEST,
base::FilePath(extension_misc::kSpeechSynthesisExtensionPath));
+ EnbaleFileSystemInGuestMode(id);
}
#endif
@@ -480,21 +494,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();
- }
+ EnbaleFileSystemInGuestMode(id);
}
#endif // defined(GOOGLE_CHROME_BUILD)
@@ -599,4 +599,25 @@ void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) {
}
}
+void ComponentLoader::EnbaleFileSystemInGuestMode(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') | webkit/browser/fileapi/file_system_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698