#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/search/hotword_service_factory.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
-#if defined(USE_AURA)
+#if defined(OS_CHROMEOS)
#include "grit/keyboard_resources.h"
#include "ui/keyboard/keyboard_util.h"
#endif
}
void ComponentLoader::AddHangoutServicesExtension() {
-#if defined(GOOGLE_CHROME_BUILD)
+#if defined(GOOGLE_CHROME_BUILD) || defined(ENABLE_HANGOUT_SERVICES_EXTENSION)
Add(IDR_HANGOUT_SERVICES_MANIFEST,
base::FilePath(FILE_PATH_LITERAL("hangout_services")));
#endif
}
+void ComponentLoader::AddHotwordHelperExtension() {
+ Profile* profile = static_cast<Profile*>(browser_context_);
+ if (HotwordServiceFactory::IsHotwordAllowed(profile)) {
+ Add(IDR_HOTWORD_HELPER_MANIFEST,
+ base::FilePath(FILE_PATH_LITERAL("hotword_helper")));
+ }
+}
+
void ComponentLoader::AddImageLoaderExtension() {
#if defined(IMAGE_LOADER_EXTENSION)
#ifndef NDEBUG
}
#if defined(OS_CHROMEOS)
-void ComponentLoader::AddChromeOsSpeechSynthesisExtension() {
- Add(IDR_SPEECH_SYNTHESIS_MANIFEST,
+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::AddKeyboardApp() {
-#if defined(USE_AURA)
- if (keyboard::IsKeyboardEnabled())
- Add(IDR_KEYBOARD_MANIFEST, base::FilePath(FILE_PATH_LITERAL("keyboard")));
+#if defined(OS_CHROMEOS)
+ Add(IDR_KEYBOARD_MANIFEST, base::FilePath(FILE_PATH_LITERAL("keyboard")));
#endif
}
// Component extensions needed for kiosk apps.
AddFileManagerExtension();
+
+ // Add virtual keyboard.
+ AddKeyboardApp();
}
void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages(
if (!skip_session_components) {
AddFileManagerExtension();
AddHangoutServicesExtension();
+ AddHotwordHelperExtension();
AddImageLoaderExtension();
#if defined(ENABLE_SETTINGS_APP)
#if defined(GOOGLE_CHROME_BUILD)
if (!command_line->HasSwitch(
chromeos::switches::kDisableQuickofficeComponentApp)) {
- int manifest_id = IDR_QUICKOFFICE_EDITOR_MANIFEST;
- if (command_line->HasSwitch(switches::kEnableQuickofficeViewing)) {
- manifest_id = IDR_QUICKOFFICE_VIEWING_MANIFEST;
- }
- std::string id = Add(manifest_id, base::FilePath(
+ 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)
// 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)
#endif
#endif // defined(GOOGLE_CHROME_BUILD)
-#if defined(OS_CHROMEOS)
- AddChromeOsSpeechSynthesisExtension();
-#endif // defined(OS_CHROMEOS)
-
#if defined(ENABLE_PLUGINS)
base::FilePath pdf_path;
content::PluginService* plugin_service =
}
}
+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