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

Side by Side Diff: apps/shell/browser/shell_extensions_browser_client.cc

Issue 180213008: Add ExtensionsApiClient interface, use it in the storage API SettingsFrontend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 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 "components/user_prefs/pref_registry_syncable.h" 12 #include "components/user_prefs/pref_registry_syncable.h"
13 #include "components/user_prefs/user_prefs.h" 13 #include "components/user_prefs/user_prefs.h"
14 #include "extensions/browser/api/extensions_api_client.h"
14 #include "extensions/browser/app_sorting.h" 15 #include "extensions/browser/app_sorting.h"
15 #include "extensions/browser/extension_prefs.h" 16 #include "extensions/browser/extension_prefs.h"
16 17
17 using content::BrowserContext; 18 using content::BrowserContext;
18 19
19 namespace extensions { 20 namespace extensions {
20 namespace { 21 namespace {
21 22
22 // See chrome::RegisterProfilePrefs() in chrome/browser/prefs/browser_prefs.cc 23 // See chrome::RegisterProfilePrefs() in chrome/browser/prefs/browser_prefs.cc
23 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) { 24 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) {
24 ExtensionPrefs::RegisterProfilePrefs(registry); 25 ExtensionPrefs::RegisterProfilePrefs(registry);
25 } 26 }
26 27
27 } // namespace 28 } // namespace
28 29
29
30 ShellExtensionsBrowserClient::ShellExtensionsBrowserClient( 30 ShellExtensionsBrowserClient::ShellExtensionsBrowserClient(
31 BrowserContext* context) 31 BrowserContext* context)
32 : browser_context_(context) { 32 : browser_context_(context), api_client_(new ExtensionsApiClient) {
33 ExtensionsApiClient::Set(api_client_.get());
34
33 // Set up the preferences service. 35 // Set up the preferences service.
34 base::PrefServiceFactory factory; 36 base::PrefServiceFactory factory;
35 factory.set_user_prefs(new TestingPrefStore); 37 factory.set_user_prefs(new TestingPrefStore);
36 factory.set_extension_prefs(new TestingPrefStore); 38 factory.set_extension_prefs(new TestingPrefStore);
37 // app_shell should not require syncable preferences, but for now we need to 39 // app_shell should not require syncable preferences, but for now we need to
38 // recycle some of the RegisterProfilePrefs() code in Chrome. 40 // recycle some of the RegisterProfilePrefs() code in Chrome.
39 // TODO(jamescook): Convert this to PrefRegistrySimple. 41 // TODO(jamescook): Convert this to PrefRegistrySimple.
40 user_prefs::PrefRegistrySyncable* pref_registry = 42 user_prefs::PrefRegistrySyncable* pref_registry =
41 new user_prefs::PrefRegistrySyncable; 43 new user_prefs::PrefRegistrySyncable;
42 // Prefs should be registered before the PrefService is created. 44 // Prefs should be registered before the PrefService is created.
43 RegisterPrefs(pref_registry); 45 RegisterPrefs(pref_registry);
44 prefs_ = factory.Create(pref_registry).Pass(); 46 prefs_ = factory.Create(pref_registry).Pass();
45 user_prefs::UserPrefs::Set(browser_context_, prefs_.get()); 47 user_prefs::UserPrefs::Set(browser_context_, prefs_.get());
46 } 48 }
47 49
48 ShellExtensionsBrowserClient::~ShellExtensionsBrowserClient() {} 50 ShellExtensionsBrowserClient::~ShellExtensionsBrowserClient() {
51 ExtensionsApiClient::Set(NULL);
52 }
49 53
50 bool ShellExtensionsBrowserClient::IsShuttingDown() { 54 bool ShellExtensionsBrowserClient::IsShuttingDown() {
51 return false; 55 return false;
52 } 56 }
53 57
54 bool ShellExtensionsBrowserClient::AreExtensionsDisabled( 58 bool ShellExtensionsBrowserClient::AreExtensionsDisabled(
55 const CommandLine& command_line, 59 const CommandLine& command_line,
56 BrowserContext* context) { 60 BrowserContext* context) {
57 return false; 61 return false;
58 } 62 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // app_shell doesn't monitor API function calls or events. 151 // app_shell doesn't monitor API function calls or events.
148 return NULL; 152 return NULL;
149 } 153 }
150 154
151 ExtensionSystemProvider* 155 ExtensionSystemProvider*
152 ShellExtensionsBrowserClient::GetExtensionSystemFactory() { 156 ShellExtensionsBrowserClient::GetExtensionSystemFactory() {
153 return ShellExtensionSystemFactory::GetInstance(); 157 return ShellExtensionSystemFactory::GetInstance();
154 } 158 }
155 159
156 } // namespace extensions 160 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698