| 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" | 15 #include "chrome/browser/search/hotword_service_factory.h" |
| 16 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
| 17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/common/chrome_version_info.h" | 18 #include "chrome/common/chrome_version_info.h" |
| 19 #include "chrome/common/extensions/extension_constants.h" | 19 #include "chrome/common/extensions/extension_constants.h" |
| 20 #include "components/crx_file/id_util.h" |
| 20 #include "content/public/browser/browser_context.h" | 21 #include "content/public/browser/browser_context.h" |
| 21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/browser/plugin_service.h" | 23 #include "content/public/browser/plugin_service.h" |
| 23 #include "extensions/common/extension.h" | 24 #include "extensions/common/extension.h" |
| 24 #include "extensions/common/file_util.h" | 25 #include "extensions/common/file_util.h" |
| 25 #include "extensions/common/id_util.h" | |
| 26 #include "extensions/common/manifest_constants.h" | 26 #include "extensions/common/manifest_constants.h" |
| 27 #include "grit/browser_resources.h" | 27 #include "grit/browser_resources.h" |
| 28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 31 | 31 |
| 32 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
| 33 #include "grit/keyboard_resources.h" | 33 #include "grit/keyboard_resources.h" |
| 34 #include "ui/file_manager/grit/file_manager_resources.h" | 34 #include "ui/file_manager/grit/file_manager_resources.h" |
| 35 #include "ui/keyboard/keyboard_util.h" | 35 #include "ui/keyboard/keyboard_util.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 59 namespace { | 59 namespace { |
| 60 | 60 |
| 61 static bool enable_background_extensions_during_testing = false; | 61 static bool enable_background_extensions_during_testing = false; |
| 62 | 62 |
| 63 std::string GenerateId(const base::DictionaryValue* manifest, | 63 std::string GenerateId(const base::DictionaryValue* manifest, |
| 64 const base::FilePath& path) { | 64 const base::FilePath& path) { |
| 65 std::string raw_key; | 65 std::string raw_key; |
| 66 std::string id_input; | 66 std::string id_input; |
| 67 CHECK(manifest->GetString(manifest_keys::kPublicKey, &raw_key)); | 67 CHECK(manifest->GetString(manifest_keys::kPublicKey, &raw_key)); |
| 68 CHECK(Extension::ParsePEMKeyBytes(raw_key, &id_input)); | 68 CHECK(Extension::ParsePEMKeyBytes(raw_key, &id_input)); |
| 69 std::string id = id_util::GenerateId(id_input); | 69 std::string id = crx_file::id_util::GenerateId(id_input); |
| 70 return id; | 70 return id; |
| 71 } | 71 } |
| 72 | 72 |
| 73 #if defined(OS_CHROMEOS) | 73 #if defined(OS_CHROMEOS) |
| 74 scoped_ptr<base::DictionaryValue> | 74 scoped_ptr<base::DictionaryValue> |
| 75 LoadManifestOnFileThread( | 75 LoadManifestOnFileThread( |
| 76 const base::FilePath& chromevox_path, const char* manifest_filename) { | 76 const base::FilePath& chromevox_path, const char* manifest_filename) { |
| 77 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); | 77 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); |
| 78 std::string error; | 78 std::string error; |
| 79 scoped_ptr<base::DictionaryValue> manifest( | 79 scoped_ptr<base::DictionaryValue> manifest( |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 off_the_record_context, Extension::GetBaseURLFromExtensionId(id)); | 633 off_the_record_context, Extension::GetBaseURLFromExtensionId(id)); |
| 634 fileapi::FileSystemContext* file_system_context = | 634 fileapi::FileSystemContext* file_system_context = |
| 635 content::BrowserContext::GetStoragePartitionForSite( | 635 content::BrowserContext::GetStoragePartitionForSite( |
| 636 off_the_record_context, site)->GetFileSystemContext(); | 636 off_the_record_context, site)->GetFileSystemContext(); |
| 637 file_system_context->EnableTemporaryFileSystemInIncognito(); | 637 file_system_context->EnableTemporaryFileSystemInIncognito(); |
| 638 } | 638 } |
| 639 #endif | 639 #endif |
| 640 } | 640 } |
| 641 | 641 |
| 642 } // namespace extensions | 642 } // namespace extensions |
| OLD | NEW |