OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "chrome/browser/prerender/prerender_manager.h" | 34 #include "chrome/browser/prerender/prerender_manager.h" |
35 #include "chrome/browser/profiles/profile_dependency_manager.h" | 35 #include "chrome/browser/profiles/profile_dependency_manager.h" |
36 #include "chrome/browser/search_engines/template_url_fetcher.h" | 36 #include "chrome/browser/search_engines/template_url_fetcher.h" |
37 #include "chrome/browser/search_engines/template_url_service.h" | 37 #include "chrome/browser/search_engines/template_url_service.h" |
38 #include "chrome/browser/search_engines/template_url_service_factory.h" | 38 #include "chrome/browser/search_engines/template_url_service_factory.h" |
39 #include "chrome/browser/sync/profile_sync_service_mock.h" | 39 #include "chrome/browser/sync/profile_sync_service_mock.h" |
40 #include "chrome/browser/ui/find_bar/find_bar_state.h" | 40 #include "chrome/browser/ui/find_bar/find_bar_state.h" |
41 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 41 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
42 #include "chrome/common/chrome_constants.h" | 42 #include "chrome/common/chrome_constants.h" |
43 #include "chrome/common/chrome_notification_types.h" | 43 #include "chrome/common/chrome_notification_types.h" |
| 44 #include "chrome/common/chrome_switches.h" |
44 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
45 #include "chrome/test/base/bookmark_load_observer.h" | 46 #include "chrome/test/base/bookmark_load_observer.h" |
46 #include "chrome/test/base/test_url_request_context_getter.h" | 47 #include "chrome/test/base/test_url_request_context_getter.h" |
47 #include "chrome/test/base/testing_pref_service.h" | 48 #include "chrome/test/base/testing_pref_service.h" |
48 #include "chrome/test/base/ui_test_utils.h" | 49 #include "chrome/test/base/ui_test_utils.h" |
49 #include "content/browser/browser_thread.h" | 50 #include "content/browser/browser_thread.h" |
50 #include "content/browser/in_process_webkit/webkit_context.h" | 51 #include "content/browser/in_process_webkit/webkit_context.h" |
51 #include "content/browser/mock_resource_context.h" | 52 #include "content/browser/mock_resource_context.h" |
52 #include "content/common/notification_service.h" | 53 #include "content/common/notification_service.h" |
53 #include "net/base/cookie_monster.h" | 54 #include "net/base/cookie_monster.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 this, BuildTemplateURLService); | 336 this, BuildTemplateURLService); |
336 } | 337 } |
337 | 338 |
338 ExtensionService* TestingProfile::CreateExtensionService( | 339 ExtensionService* TestingProfile::CreateExtensionService( |
339 const CommandLine* command_line, | 340 const CommandLine* command_line, |
340 const FilePath& install_directory, | 341 const FilePath& install_directory, |
341 bool autoupdate_enabled) { | 342 bool autoupdate_enabled) { |
342 // Extension pref store, created for use by |extension_prefs_|. | 343 // Extension pref store, created for use by |extension_prefs_|. |
343 | 344 |
344 extension_pref_value_map_.reset(new ExtensionPrefValueMap); | 345 extension_pref_value_map_.reset(new ExtensionPrefValueMap); |
| 346 |
| 347 bool extensions_disabled = |
| 348 command_line && command_line->HasSwitch(switches::kDisableExtensions); |
| 349 |
345 // Note that the GetPrefs() creates a TestingPrefService, therefore | 350 // Note that the GetPrefs() creates a TestingPrefService, therefore |
346 // the extension controlled pref values set in extension_prefs_ | 351 // the extension controlled pref values set in extension_prefs_ |
347 // are not reflected in the pref service. One would need to | 352 // are not reflected in the pref service. One would need to |
348 // inject a new ExtensionPrefStore(extension_pref_value_map_.get(), false). | 353 // inject a new ExtensionPrefStore(extension_pref_value_map_.get(), false). |
349 extension_prefs_.reset( | 354 extension_prefs_.reset( |
350 new ExtensionPrefs(GetPrefs(), | 355 new ExtensionPrefs(GetPrefs(), |
351 install_directory, | 356 install_directory, |
352 extension_pref_value_map_.get())); | 357 extension_pref_value_map_.get())); |
| 358 extension_prefs_->Init(extensions_disabled); |
353 extension_service_.reset(new ExtensionService(this, | 359 extension_service_.reset(new ExtensionService(this, |
354 command_line, | 360 command_line, |
355 install_directory, | 361 install_directory, |
356 extension_prefs_.get(), | 362 extension_prefs_.get(), |
357 autoupdate_enabled, | 363 autoupdate_enabled, |
358 true)); | 364 true)); |
359 return extension_service_.get(); | 365 return extension_service_.get(); |
360 } | 366 } |
361 | 367 |
362 FilePath TestingProfile::GetPath() { | 368 FilePath TestingProfile::GetPath() { |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { | 802 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { |
797 return GetExtensionSpecialStoragePolicy(); | 803 return GetExtensionSpecialStoragePolicy(); |
798 } | 804 } |
799 | 805 |
800 void TestingProfile::DestroyWebDataService() { | 806 void TestingProfile::DestroyWebDataService() { |
801 if (!web_data_service_.get()) | 807 if (!web_data_service_.get()) |
802 return; | 808 return; |
803 | 809 |
804 web_data_service_->Shutdown(); | 810 web_data_service_->Shutdown(); |
805 } | 811 } |
OLD | NEW |