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/test/base/testing_profile.h" | 5 #include "chrome/test/base/testing_profile.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 #include "components/policy/core/common/policy_service_stub.h" | 95 #include "components/policy/core/common/policy_service_stub.h" |
96 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 96 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
97 | 97 |
98 #if defined(ENABLE_EXTENSIONS) | 98 #if defined(ENABLE_EXTENSIONS) |
99 #include "chrome/browser/extensions/extension_service.h" | 99 #include "chrome/browser/extensions/extension_service.h" |
100 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 100 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
101 #include "chrome/browser/extensions/extension_system_factory.h" | 101 #include "chrome/browser/extensions/extension_system_factory.h" |
102 #include "chrome/browser/extensions/test_extension_system.h" | 102 #include "chrome/browser/extensions/test_extension_system.h" |
103 #include "components/guest_view/browser/guest_view_manager.h" | 103 #include "components/guest_view/browser/guest_view_manager.h" |
104 #include "extensions/browser/event_router_factory.h" | 104 #include "extensions/browser/event_router_factory.h" |
105 #include "extensions/browser/extension_pref_value_map.h" | |
106 #include "extensions/browser/extension_pref_value_map_factory.h" | |
105 #include "extensions/browser/extension_prefs.h" | 107 #include "extensions/browser/extension_prefs.h" |
106 #include "extensions/browser/extension_prefs_factory.h" | 108 #include "extensions/browser/extension_prefs_factory.h" |
109 #include "extensions/browser/extension_prefs_observer.h" | |
107 #include "extensions/browser/extension_system.h" | 110 #include "extensions/browser/extension_system.h" |
108 #endif | 111 #endif |
109 | 112 |
110 #if defined(OS_ANDROID) | 113 #if defined(OS_ANDROID) |
111 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h" | 114 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h" |
112 #endif | 115 #endif |
113 | 116 |
114 #if defined(ENABLE_SUPERVISED_USERS) | 117 #if defined(ENABLE_SUPERVISED_USERS) |
115 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 118 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
116 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" | 119 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 | 427 |
425 // TODO(joaodasilva): remove this once this PKS isn't created in ProfileImpl | 428 // TODO(joaodasilva): remove this once this PKS isn't created in ProfileImpl |
426 // anymore, after converting the PrefService to a PKS. Until then it must | 429 // anymore, after converting the PrefService to a PKS. Until then it must |
427 // be associated with a TestingProfile too. | 430 // be associated with a TestingProfile too. |
428 if (!IsOffTheRecord()) | 431 if (!IsOffTheRecord()) |
429 CreateProfilePolicyConnector(); | 432 CreateProfilePolicyConnector(); |
430 | 433 |
431 extensions_path_ = profile_path_.AppendASCII("Extensions"); | 434 extensions_path_ = profile_path_.AppendASCII("Extensions"); |
432 | 435 |
433 #if defined(ENABLE_EXTENSIONS) | 436 #if defined(ENABLE_EXTENSIONS) |
437 // Note that the GetPrefs() creates a TestingPrefService, therefore | |
Marc Treib
2015/08/03 15:28:03
This has moved from TestExtensionSystem to here. T
| |
438 // the extension controlled pref values set in ExtensionPrefs | |
439 // are not reflected in the pref service. One would need to | |
440 // inject a new ExtensionPrefStore(extension_pref_value_map, false). | |
441 bool extensions_disabled = base::CommandLine::ForCurrentProcess()->HasSwitch( | |
442 switches::kDisableExtensions); | |
443 scoped_ptr<extensions::ExtensionPrefs> extension_prefs = | |
444 make_scoped_ptr(extensions::ExtensionPrefs::Create( | |
445 GetPrefs(), extensions_path_, | |
446 ExtensionPrefValueMapFactory::GetForBrowserContext(this), | |
447 extensions_disabled, | |
448 std::vector<extensions::ExtensionPrefsObserver*>())); | |
449 extensions::ExtensionPrefsFactory::GetInstance()->SetInstanceForTesting( | |
450 this, extension_prefs.Pass()); | |
451 | |
434 extensions::ExtensionSystemFactory::GetInstance()->SetTestingFactory( | 452 extensions::ExtensionSystemFactory::GetInstance()->SetTestingFactory( |
435 this, extensions::TestExtensionSystem::Build); | 453 this, extensions::TestExtensionSystem::Build); |
436 | 454 |
437 extensions::TestExtensionSystem* test_extension_system = | |
438 static_cast<extensions::TestExtensionSystem*>( | |
439 extensions::ExtensionSystem::Get(this)); | |
440 scoped_ptr<extensions::ExtensionPrefs> extension_prefs = | |
441 test_extension_system->CreateExtensionPrefs( | |
442 base::CommandLine::ForCurrentProcess(), extensions_path_); | |
443 extensions::ExtensionPrefsFactory::GetInstance()->SetInstanceForTesting( | |
444 this, extension_prefs.Pass()); | |
445 | |
446 extensions::EventRouterFactory::GetInstance()->SetTestingFactory(this, | 455 extensions::EventRouterFactory::GetInstance()->SetTestingFactory(this, |
447 nullptr); | 456 nullptr); |
448 #endif | 457 #endif |
449 | 458 |
450 // Prefs for incognito profiles are set in CreateIncognitoPrefService() by | 459 // Prefs for incognito profiles are set in CreateIncognitoPrefService() by |
451 // simulating ProfileImpl::GetOffTheRecordPrefs(). | 460 // simulating ProfileImpl::GetOffTheRecordPrefs(). |
452 if (!IsOffTheRecord()) { | 461 if (!IsOffTheRecord()) { |
453 DCHECK(!original_profile_); | 462 DCHECK(!original_profile_); |
454 user_prefs::PrefRegistrySyncable* pref_registry = | 463 user_prefs::PrefRegistrySyncable* pref_registry = |
455 static_cast<user_prefs::PrefRegistrySyncable*>( | 464 static_cast<user_prefs::PrefRegistrySyncable*>( |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1061 #if defined(ENABLE_EXTENSIONS) | 1070 #if defined(ENABLE_EXTENSIONS) |
1062 extension_policy_, | 1071 extension_policy_, |
1063 #endif | 1072 #endif |
1064 pref_service_.Pass(), | 1073 pref_service_.Pass(), |
1065 original_profile, | 1074 original_profile, |
1066 guest_session_, | 1075 guest_session_, |
1067 supervised_user_id_, | 1076 supervised_user_id_, |
1068 policy_service_.Pass(), | 1077 policy_service_.Pass(), |
1069 testing_factories_); | 1078 testing_factories_); |
1070 } | 1079 } |
OLD | NEW |