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/background/background_contents_service_factory.h" | 5 #include "chrome/browser/background/background_contents_service_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/background/background_contents_service.h" | 9 #include "chrome/browser/background/background_contents_service.h" |
| 10 #include "chrome/browser/profiles/incognito_helpers.h" |
10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/profiles/profile_dependency_manager.h" | 12 #include "chrome/browser/profiles/profile_dependency_manager.h" |
12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
13 #include "components/user_prefs/pref_registry_syncable.h" | 14 #include "components/user_prefs/pref_registry_syncable.h" |
14 | 15 |
15 // static | 16 // static |
16 BackgroundContentsService* BackgroundContentsServiceFactory::GetForProfile( | 17 BackgroundContentsService* BackgroundContentsServiceFactory::GetForProfile( |
17 Profile* profile) { | 18 Profile* profile) { |
18 return static_cast<BackgroundContentsService*>( | 19 return static_cast<BackgroundContentsService*>( |
19 GetInstance()->GetServiceForProfile(profile, true)); | 20 GetInstance()->GetServiceForProfile(profile, true)); |
(...skipping 18 matching lines...) Expand all Loading... |
38 return new BackgroundContentsService(static_cast<Profile*>(profile), | 39 return new BackgroundContentsService(static_cast<Profile*>(profile), |
39 CommandLine::ForCurrentProcess()); | 40 CommandLine::ForCurrentProcess()); |
40 } | 41 } |
41 | 42 |
42 void BackgroundContentsServiceFactory::RegisterUserPrefs( | 43 void BackgroundContentsServiceFactory::RegisterUserPrefs( |
43 PrefRegistrySyncable* user_prefs) { | 44 PrefRegistrySyncable* user_prefs) { |
44 user_prefs->RegisterDictionaryPref(prefs::kRegisteredBackgroundContents, | 45 user_prefs->RegisterDictionaryPref(prefs::kRegisteredBackgroundContents, |
45 PrefRegistrySyncable::UNSYNCABLE_PREF); | 46 PrefRegistrySyncable::UNSYNCABLE_PREF); |
46 } | 47 } |
47 | 48 |
48 bool | 49 content::BrowserContext* |
49 BackgroundContentsServiceFactory::ServiceHasOwnInstanceInIncognito() const { | 50 BackgroundContentsServiceFactory::GetBrowserContextToUse( |
50 return true; | 51 content::BrowserContext* context) const { |
| 52 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
51 } | 53 } |
52 | 54 |
53 bool BackgroundContentsServiceFactory::ServiceIsCreatedWithProfile() const { | 55 bool BackgroundContentsServiceFactory::ServiceIsCreatedWithProfile() const { |
54 return true; | 56 return true; |
55 } | 57 } |
56 | 58 |
57 bool BackgroundContentsServiceFactory::ServiceIsNULLWhileTesting() const { | 59 bool BackgroundContentsServiceFactory::ServiceIsNULLWhileTesting() const { |
58 return true; | 60 return true; |
59 } | 61 } |
OLD | NEW |