| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "apps/shell/browser/shell_extensions_browser_client.h" | 5 #include "apps/shell/browser/shell_extensions_browser_client.h" |
| 6 | 6 |
| 7 #include "apps/shell/browser/shell_app_sorting.h" | 7 #include "apps/shell/browser/shell_app_sorting.h" |
| 8 #include "apps/shell/browser/shell_extension_system_factory.h" | 8 #include "apps/shell/browser/shell_extension_system_factory.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/prefs/pref_service_factory.h" | 10 #include "base/prefs/pref_service_factory.h" |
| 11 #include "base/prefs/testing_pref_store.h" | 11 #include "base/prefs/testing_pref_store.h" |
| 12 #include "chrome/common/extensions/api/generated_api.h" | 12 #include "chrome/common/extensions/api/generated_api.h" |
| 13 #include "components/user_prefs/pref_registry_syncable.h" | 13 #include "components/user_prefs/pref_registry_syncable.h" |
| 14 #include "components/user_prefs/user_prefs.h" | 14 #include "components/user_prefs/user_prefs.h" |
| 15 #include "extensions/browser/api/extensions_api_client.h" |
| 15 #include "extensions/browser/app_sorting.h" | 16 #include "extensions/browser/app_sorting.h" |
| 16 #include "extensions/browser/extension_prefs.h" | 17 #include "extensions/browser/extension_prefs.h" |
| 17 | 18 |
| 18 using content::BrowserContext; | 19 using content::BrowserContext; |
| 19 | 20 |
| 20 namespace extensions { | 21 namespace extensions { |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 // See chrome::RegisterProfilePrefs() in chrome/browser/prefs/browser_prefs.cc | 24 // See chrome::RegisterProfilePrefs() in chrome/browser/prefs/browser_prefs.cc |
| 24 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) { | 25 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 25 ExtensionPrefs::RegisterProfilePrefs(registry); | 26 ExtensionPrefs::RegisterProfilePrefs(registry); |
| 26 } | 27 } |
| 27 | 28 |
| 28 } // namespace | 29 } // namespace |
| 29 | 30 |
| 30 | |
| 31 ShellExtensionsBrowserClient::ShellExtensionsBrowserClient( | 31 ShellExtensionsBrowserClient::ShellExtensionsBrowserClient( |
| 32 BrowserContext* context) | 32 BrowserContext* context) |
| 33 : browser_context_(context) { | 33 : browser_context_(context), api_client_(new ExtensionsAPIClient) { |
| 34 // Set up the preferences service. | 34 // Set up the preferences service. |
| 35 base::PrefServiceFactory factory; | 35 base::PrefServiceFactory factory; |
| 36 factory.set_user_prefs(new TestingPrefStore); | 36 factory.set_user_prefs(new TestingPrefStore); |
| 37 factory.set_extension_prefs(new TestingPrefStore); | 37 factory.set_extension_prefs(new TestingPrefStore); |
| 38 // app_shell should not require syncable preferences, but for now we need to | 38 // app_shell should not require syncable preferences, but for now we need to |
| 39 // recycle some of the RegisterProfilePrefs() code in Chrome. | 39 // recycle some of the RegisterProfilePrefs() code in Chrome. |
| 40 // TODO(jamescook): Convert this to PrefRegistrySimple. | 40 // TODO(jamescook): Convert this to PrefRegistrySimple. |
| 41 user_prefs::PrefRegistrySyncable* pref_registry = | 41 user_prefs::PrefRegistrySyncable* pref_registry = |
| 42 new user_prefs::PrefRegistrySyncable; | 42 new user_prefs::PrefRegistrySyncable; |
| 43 // Prefs should be registered before the PrefService is created. | 43 // Prefs should be registered before the PrefService is created. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 156 } |
| 157 | 157 |
| 158 void ShellExtensionsBrowserClient::RegisterExtensionFunctions( | 158 void ShellExtensionsBrowserClient::RegisterExtensionFunctions( |
| 159 ExtensionFunctionRegistry* registry) const { | 159 ExtensionFunctionRegistry* registry) const { |
| 160 // TODO(rockot): Remove this once we have enough APIs moved out of src/chrome | 160 // TODO(rockot): Remove this once we have enough APIs moved out of src/chrome |
| 161 // See http://crbug.com/349042 | 161 // See http://crbug.com/349042 |
| 162 extensions::api::GeneratedFunctionRegistry::RegisterAll(registry); | 162 extensions::api::GeneratedFunctionRegistry::RegisterAll(registry); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace extensions | 165 } // namespace extensions |
| OLD | NEW |