| OLD | NEW |
| 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/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/json/json_string_value_serializer.h" | 11 #include "base/json/json_string_value_serializer.h" |
| 12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/search/hotword_service_factory.h" | |
| 16 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 17 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/common/chrome_version_info.h" | 17 #include "chrome/common/chrome_version_info.h" |
| 19 #include "chrome/common/extensions/extension_constants.h" | 18 #include "chrome/common/extensions/extension_constants.h" |
| 20 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/plugin_service.h" | 20 #include "content/public/browser/plugin_service.h" |
| 22 #include "extensions/common/extension.h" | 21 #include "extensions/common/extension.h" |
| 23 #include "extensions/common/file_util.h" | 22 #include "extensions/common/file_util.h" |
| 24 #include "extensions/common/id_util.h" | 23 #include "extensions/common/id_util.h" |
| 25 #include "extensions/common/manifest_constants.h" | 24 #include "extensions/common/manifest_constants.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 45 #include "content/public/browser/site_instance.h" | 44 #include "content/public/browser/site_instance.h" |
| 46 #include "content/public/browser/storage_partition.h" | 45 #include "content/public/browser/storage_partition.h" |
| 47 #include "extensions/browser/extensions_browser_client.h" | 46 #include "extensions/browser/extensions_browser_client.h" |
| 48 #include "webkit/browser/fileapi/file_system_context.h" | 47 #include "webkit/browser/fileapi/file_system_context.h" |
| 49 #endif | 48 #endif |
| 50 | 49 |
| 51 #if defined(ENABLE_APP_LIST) | 50 #if defined(ENABLE_APP_LIST) |
| 52 #include "grit/chromium_strings.h" | 51 #include "grit/chromium_strings.h" |
| 53 #endif | 52 #endif |
| 54 | 53 |
| 54 #if defined(ENABLE_EXTENSIONS) |
| 55 #include "chrome/browser/search/hotword_service_factory.h" |
| 56 #endif |
| 57 |
| 55 using content::BrowserThread; | 58 using content::BrowserThread; |
| 56 | 59 |
| 57 namespace extensions { | 60 namespace extensions { |
| 58 | 61 |
| 59 namespace { | 62 namespace { |
| 60 | 63 |
| 61 static bool enable_background_extensions_during_testing = false; | 64 static bool enable_background_extensions_during_testing = false; |
| 62 | 65 |
| 63 std::string GenerateId(const base::DictionaryValue* manifest, | 66 std::string GenerateId(const base::DictionaryValue* manifest, |
| 64 const base::FilePath& path) { | 67 const base::FilePath& path) { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 } | 298 } |
| 296 | 299 |
| 297 void ComponentLoader::AddHangoutServicesExtension() { | 300 void ComponentLoader::AddHangoutServicesExtension() { |
| 298 #if defined(GOOGLE_CHROME_BUILD) || defined(ENABLE_HANGOUT_SERVICES_EXTENSION) | 301 #if defined(GOOGLE_CHROME_BUILD) || defined(ENABLE_HANGOUT_SERVICES_EXTENSION) |
| 299 Add(IDR_HANGOUT_SERVICES_MANIFEST, | 302 Add(IDR_HANGOUT_SERVICES_MANIFEST, |
| 300 base::FilePath(FILE_PATH_LITERAL("hangout_services"))); | 303 base::FilePath(FILE_PATH_LITERAL("hangout_services"))); |
| 301 #endif | 304 #endif |
| 302 } | 305 } |
| 303 | 306 |
| 304 void ComponentLoader::AddHotwordHelperExtension() { | 307 void ComponentLoader::AddHotwordHelperExtension() { |
| 308 #if defined(ENABLE_EXTENSIONS) |
| 305 if (HotwordServiceFactory::IsHotwordAllowed(browser_context_)) { | 309 if (HotwordServiceFactory::IsHotwordAllowed(browser_context_)) { |
| 306 Add(IDR_HOTWORD_HELPER_MANIFEST, | 310 Add(IDR_HOTWORD_HELPER_MANIFEST, |
| 307 base::FilePath(FILE_PATH_LITERAL("hotword_helper"))); | 311 base::FilePath(FILE_PATH_LITERAL("hotword_helper"))); |
| 308 } | 312 } |
| 313 #endif |
| 309 } | 314 } |
| 310 | 315 |
| 311 void ComponentLoader::AddImageLoaderExtension() { | 316 void ComponentLoader::AddImageLoaderExtension() { |
| 312 #if defined(IMAGE_LOADER_EXTENSION) | 317 #if defined(IMAGE_LOADER_EXTENSION) |
| 313 Add(IDR_IMAGE_LOADER_MANIFEST, | 318 Add(IDR_IMAGE_LOADER_MANIFEST, |
| 314 base::FilePath(FILE_PATH_LITERAL("image_loader"))); | 319 base::FilePath(FILE_PATH_LITERAL("image_loader"))); |
| 315 #endif // defined(IMAGE_LOADER_EXTENSION) | 320 #endif // defined(IMAGE_LOADER_EXTENSION) |
| 316 } | 321 } |
| 317 | 322 |
| 318 void ComponentLoader::AddNetworkSpeechSynthesisExtension() { | 323 void ComponentLoader::AddNetworkSpeechSynthesisExtension() { |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 off_the_record_context, Extension::GetBaseURLFromExtensionId(id)); | 646 off_the_record_context, Extension::GetBaseURLFromExtensionId(id)); |
| 642 fileapi::FileSystemContext* file_system_context = | 647 fileapi::FileSystemContext* file_system_context = |
| 643 content::BrowserContext::GetStoragePartitionForSite( | 648 content::BrowserContext::GetStoragePartitionForSite( |
| 644 off_the_record_context, site)->GetFileSystemContext(); | 649 off_the_record_context, site)->GetFileSystemContext(); |
| 645 file_system_context->EnableTemporaryFileSystemInIncognito(); | 650 file_system_context->EnableTemporaryFileSystemInIncognito(); |
| 646 } | 651 } |
| 647 #endif | 652 #endif |
| 648 } | 653 } |
| 649 | 654 |
| 650 } // namespace extensions | 655 } // namespace extensions |
| OLD | NEW |