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

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

Issue 118043003: Fix app_shell shutdown crash due to BrowserContextKeyedServices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScopedFactoryForTest (shutdown_crash) Created 6 years, 11 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/shell_extensions_browser_client.h" 5 #include "apps/shell/shell_extensions_browser_client.h"
6 6
7 #include "apps/shell/shell_app_sorting.h" 7 #include "apps/shell/shell_app_sorting.h"
8 #include "apps/shell/shell_extension_system.h"
8 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
9 #include "base/prefs/pref_service_factory.h" 10 #include "base/prefs/pref_service_factory.h"
10 #include "base/prefs/testing_pref_store.h" 11 #include "base/prefs/testing_pref_store.h"
11 #include "chrome/browser/extensions/extension_prefs.h" 12 #include "chrome/browser/extensions/extension_prefs.h"
13 #include "chrome/browser/extensions/extension_prefs_factory.h"
12 #include "components/user_prefs/pref_registry_syncable.h" 14 #include "components/user_prefs/pref_registry_syncable.h"
13 #include "components/user_prefs/user_prefs.h" 15 #include "components/user_prefs/user_prefs.h"
14 #include "extensions/browser/app_sorting.h" 16 #include "extensions/browser/app_sorting.h"
15 17
16 using content::BrowserContext; 18 using content::BrowserContext;
17 19
20 namespace extensions {
18 namespace { 21 namespace {
19 22
20 // See chrome::RegisterProfilePrefs() in chrome/browser/prefs/browser_prefs.cc 23 // See chrome::RegisterProfilePrefs() in chrome/browser/prefs/browser_prefs.cc
21 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) { 24 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) {
22 extensions::ExtensionPrefs::RegisterProfilePrefs(registry); 25 ExtensionPrefs::RegisterProfilePrefs(registry);
23 } 26 }
24 27
25 } // namespace 28 } // namespace
26 29
27 namespace apps {
28 30
29 ShellExtensionsBrowserClient::ShellExtensionsBrowserClient( 31 ShellExtensionsBrowserClient::ShellExtensionsBrowserClient(
30 BrowserContext* context) 32 BrowserContext* context)
31 : browser_context_(context) { 33 : browser_context_(context) {
32 // Set up the preferences service. 34 // Set up the preferences service.
33 base::PrefServiceFactory factory; 35 base::PrefServiceFactory factory;
34 factory.set_user_prefs(new TestingPrefStore); 36 factory.set_user_prefs(new TestingPrefStore);
35 factory.set_extension_prefs(new TestingPrefStore); 37 factory.set_extension_prefs(new TestingPrefStore);
36 // 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
37 // recycle some of the RegisterProfilePrefs() code in Chrome. 39 // recycle some of the RegisterProfilePrefs() code in Chrome.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 bool ShellExtensionsBrowserClient::IsBackgroundPageAllowed( 96 bool ShellExtensionsBrowserClient::IsBackgroundPageAllowed(
95 BrowserContext* context) const { 97 BrowserContext* context) const {
96 return true; 98 return true;
97 } 99 }
98 100
99 bool ShellExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) { 101 bool ShellExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) {
100 // TODO(jamescook): We might want to tell extensions when app_shell updates. 102 // TODO(jamescook): We might want to tell extensions when app_shell updates.
101 return false; 103 return false;
102 } 104 }
103 105
104 scoped_ptr<extensions::AppSorting> 106 scoped_ptr<AppSorting> ShellExtensionsBrowserClient::CreateAppSorting() {
105 ShellExtensionsBrowserClient::CreateAppSorting() { 107 return scoped_ptr<AppSorting>(new apps::ShellAppSorting).Pass();
106 return scoped_ptr<extensions::AppSorting>(new ShellAppSorting).Pass();
107 } 108 }
108 109
109 bool ShellExtensionsBrowserClient::IsRunningInForcedAppMode() { 110 bool ShellExtensionsBrowserClient::IsRunningInForcedAppMode() {
110 return false; 111 return false;
111 } 112 }
112 113
113 content::JavaScriptDialogManager* 114 content::JavaScriptDialogManager*
114 ShellExtensionsBrowserClient::GetJavaScriptDialogManager() { 115 ShellExtensionsBrowserClient::GetJavaScriptDialogManager() {
115 // TODO(jamescook): Create a JavaScriptDialogManager or reuse the one from 116 // TODO(jamescook): Create a JavaScriptDialogManager or reuse the one from
116 // content_shell. 117 // content_shell.
117 NOTREACHED(); 118 NOTREACHED();
118 return NULL; 119 return NULL;
119 } 120 }
120 121
121 } // namespace apps 122 std::vector<BrowserContextKeyedServiceFactory*>
123 ShellExtensionsBrowserClient::GetExtensionSystemDependencies() {
124 std::vector<BrowserContextKeyedServiceFactory*> depends_on;
125 depends_on.push_back(ExtensionPrefsFactory::GetInstance());
126 return depends_on;
127 }
128
129 ExtensionSystem* ShellExtensionsBrowserClient::CreateExtensionSystem(
130 BrowserContext* context) {
131 return new ShellExtensionSystem(context);
132 }
133
134 } // namespace extensions
OLDNEW
« no previous file with comments | « apps/shell/shell_extensions_browser_client.h ('k') | chrome/browser/chromeos/drive/drive_integration_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698