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

Side by Side 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 guest manifests for ChromeVox and TTS 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 unified diff | Download patch | Annotate | Revision Log
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 <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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 #endif 328 #endif
329 } 329 }
330 330
331 void ComponentLoader::AddNetworkSpeechSynthesisExtension() { 331 void ComponentLoader::AddNetworkSpeechSynthesisExtension() {
332 Add(IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST, 332 Add(IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST,
333 base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis"))); 333 base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis")));
334 } 334 }
335 335
336 #if defined(OS_CHROMEOS) 336 #if defined(OS_CHROMEOS)
337 void ComponentLoader::AddChromeOsSpeechSynthesisExtension() { 337 void ComponentLoader::AddChromeOsSpeechSynthesisExtension() {
338 Add(IDR_SPEECH_SYNTHESIS_MANIFEST, 338 const CommandLine* command_line = CommandLine::ForCurrentProcess();
339 int idr = command_line->HasSwitch(chromeos::switches::kGuestSession) ?
340 IDR_SPEECH_SYNTHESIS_GUEST_MANIFEST : IDR_SPEECH_SYNTHESIS_MANIFEST;
341 std::string id = Add(idr,
339 base::FilePath(extension_misc::kSpeechSynthesisExtensionPath)); 342 base::FilePath(extension_misc::kSpeechSynthesisExtensionPath));
343 EnbaleFileSystemInGuestMode(id);
340 } 344 }
341 #endif 345 #endif
342 346
343 void ComponentLoader::AddWithName(int manifest_resource_id, 347 void ComponentLoader::AddWithName(int manifest_resource_id,
344 const base::FilePath& root_directory, 348 const base::FilePath& root_directory,
345 const std::string& name) { 349 const std::string& name) {
346 std::string manifest_contents = 350 std::string manifest_contents =
347 ResourceBundle::GetSharedInstance().GetRawDataResource( 351 ResourceBundle::GetSharedInstance().GetRawDataResource(
348 manifest_resource_id).as_string(); 352 manifest_resource_id).as_string();
349 353
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 if (install_feedback) 487 if (install_feedback)
484 Add(IDR_FEEDBACK_MANIFEST, base::FilePath(FILE_PATH_LITERAL("feedback"))); 488 Add(IDR_FEEDBACK_MANIFEST, base::FilePath(FILE_PATH_LITERAL("feedback")));
485 489
486 #if defined(OS_CHROMEOS) 490 #if defined(OS_CHROMEOS)
487 if (!skip_session_components) { 491 if (!skip_session_components) {
488 #if defined(GOOGLE_CHROME_BUILD) 492 #if defined(GOOGLE_CHROME_BUILD)
489 if (!command_line->HasSwitch( 493 if (!command_line->HasSwitch(
490 chromeos::switches::kDisableQuickofficeComponentApp)) { 494 chromeos::switches::kDisableQuickofficeComponentApp)) {
491 std::string id = Add(IDR_QUICKOFFICE_MANIFEST, base::FilePath( 495 std::string id = Add(IDR_QUICKOFFICE_MANIFEST, base::FilePath(
492 FILE_PATH_LITERAL("/usr/share/chromeos-assets/quick_office"))); 496 FILE_PATH_LITERAL("/usr/share/chromeos-assets/quick_office")));
493 if (command_line->HasSwitch(chromeos::switches::kGuestSession)) { 497 EnbaleFileSystemInGuestMode(id);
494 // TODO(dpolukhin): Hack to enable HTML5 temporary file system for
495 // Quickoffice. It doesn't work without temporary file system access.
496 // Make sure temporary file system is enabled in the off the record
497 // browser context (as that is the one used in guest session).
498 content::BrowserContext* off_the_record_context =
499 ExtensionsBrowserClient::Get()->GetOffTheRecordContext(
500 browser_context_);
501 GURL site = content::SiteInstance::GetSiteForURL(
502 off_the_record_context, Extension::GetBaseURLFromExtensionId(id));
503 fileapi::FileSystemContext* file_system_context =
504 content::BrowserContext::GetStoragePartitionForSite(
505 off_the_record_context, site)->GetFileSystemContext();
506 file_system_context->EnableTemporaryFileSystemInIncognito();
507 }
508 } 498 }
509 #endif // defined(GOOGLE_CHROME_BUILD) 499 #endif // defined(GOOGLE_CHROME_BUILD)
510 500
511 base::FilePath echo_extension_path(FILE_PATH_LITERAL( 501 base::FilePath echo_extension_path(FILE_PATH_LITERAL(
512 "/usr/share/chromeos-assets/echo")); 502 "/usr/share/chromeos-assets/echo"));
513 if (command_line->HasSwitch(chromeos::switches::kEchoExtensionPath)) { 503 if (command_line->HasSwitch(chromeos::switches::kEchoExtensionPath)) {
514 echo_extension_path = command_line->GetSwitchValuePath( 504 echo_extension_path = command_line->GetSwitchValuePath(
515 chromeos::switches::kEchoExtensionPath); 505 chromeos::switches::kEchoExtensionPath);
516 } 506 }
517 Add(IDR_ECHO_MANIFEST, echo_extension_path); 507 Add(IDR_ECHO_MANIFEST, echo_extension_path);
(...skipping 13 matching lines...) Expand all
531 521
532 Add(IDR_CONNECTIVITY_DIAGNOSTICS_MANIFEST, 522 Add(IDR_CONNECTIVITY_DIAGNOSTICS_MANIFEST,
533 base::FilePath(extension_misc::kConnectivityDiagnosticsPath)); 523 base::FilePath(extension_misc::kConnectivityDiagnosticsPath));
534 Add(IDR_CONNECTIVITY_DIAGNOSTICS_LAUNCHER_MANIFEST, 524 Add(IDR_CONNECTIVITY_DIAGNOSTICS_LAUNCHER_MANIFEST,
535 base::FilePath(extension_misc::kConnectivityDiagnosticsLauncherPath)); 525 base::FilePath(extension_misc::kConnectivityDiagnosticsLauncherPath));
536 } 526 }
537 527
538 // Load ChromeVox extension now if spoken feedback is enabled. 528 // Load ChromeVox extension now if spoken feedback is enabled.
539 if (chromeos::AccessibilityManager::Get() && 529 if (chromeos::AccessibilityManager::Get() &&
540 chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled()) { 530 chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled()) {
541 base::FilePath path = 531 int idr = command_line->HasSwitch(chromeos::switches::kGuestSession) ?
542 base::FilePath(extension_misc::kChromeVoxExtensionPath); 532 IDR_CHROMEVOX_GUEST_MANIFEST : IDR_CHROMEVOX_MANIFEST;
543 Add(IDR_CHROMEVOX_MANIFEST, path); 533 Add(idr, base::FilePath(extension_misc::kChromeVoxExtensionPath));
544 } 534 }
545 #endif // defined(OS_CHROMEOS) 535 #endif // defined(OS_CHROMEOS)
546 536
547 #if defined(ENABLE_GOOGLE_NOW) 537 #if defined(ENABLE_GOOGLE_NOW)
548 const char kEnablePrefix[] = "Enable"; 538 const char kEnablePrefix[] = "Enable";
549 const char kFieldTrialName[] = "GoogleNow"; 539 const char kFieldTrialName[] = "GoogleNow";
550 std::string enable_prefix(kEnablePrefix); 540 std::string enable_prefix(kEnablePrefix);
551 std::string field_trial_result = 541 std::string field_trial_result =
552 base::FieldTrialList::FindFullName(kFieldTrialName); 542 base::FieldTrialList::FindFullName(kFieldTrialName);
553 543
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 } 592 }
603 593
604 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { 594 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) {
605 delete component->manifest; 595 delete component->manifest;
606 if (extension_service_->is_ready()) { 596 if (extension_service_->is_ready()) {
607 extension_service_-> 597 extension_service_->
608 RemoveComponentExtension(component->extension_id); 598 RemoveComponentExtension(component->extension_id);
609 } 599 }
610 } 600 }
611 601
602 void ComponentLoader::EnbaleFileSystemInGuestMode(const std::string& id) {
603 #if defined(OS_CHROMEOS)
604 const CommandLine* command_line = CommandLine::ForCurrentProcess();
605 if (command_line->HasSwitch(chromeos::switches::kGuestSession)) {
606 // TODO(dpolukhin): Hack to enable HTML5 temporary file system for
asargent_no_longer_on_chrome 2014/02/07 00:09:50 Please file a bug to fix this (is this an extensio
Dmitry Polukhin 2014/02/07 00:20:00 It is not extensions issue. Root of the problem th
607 // the extension. Some component extensions don't work without temporary
608 // file system access. Make sure temporary file system is enabled in the off
609 // the record browser context (as that is the one used in guest session).
610 content::BrowserContext* off_the_record_context =
611 ExtensionsBrowserClient::Get()->GetOffTheRecordContext(
612 browser_context_);
613 GURL site = content::SiteInstance::GetSiteForURL(
614 off_the_record_context, Extension::GetBaseURLFromExtensionId(id));
615 fileapi::FileSystemContext* file_system_context =
616 content::BrowserContext::GetStoragePartitionForSite(
617 off_the_record_context, site)->GetFileSystemContext();
618 file_system_context->EnableTemporaryFileSystemInIncognito();
619 }
620 #endif
621 }
622
612 } // namespace extensions 623 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698