| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/testing_profile.h" | 5 #include "chrome/test/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" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 15 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model.h" | 16 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 17 #include "chrome/browser/browser_thread.h" | 17 #include "chrome/browser/browser_thread.h" |
| 18 #include "chrome/browser/content_settings/host_content_settings_map.h" | 18 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 19 #include "chrome/browser/dom_ui/ntp_resource_cache.h" | 19 #include "chrome/browser/dom_ui/ntp_resource_cache.h" |
| 20 #include "chrome/browser/extensions/extension_pref_store.h" | 20 #include "chrome/browser/extensions/extension_pref_store.h" |
| 21 #include "chrome/browser/extensions/extensions_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
| 22 #include "chrome/browser/favicon_service.h" | 22 #include "chrome/browser/favicon_service.h" |
| 23 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | 23 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" |
| 24 #include "chrome/browser/geolocation/geolocation_permission_context.h" | 24 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
| 25 #include "chrome/browser/history/history.h" | 25 #include "chrome/browser/history/history.h" |
| 26 #include "chrome/browser/history/history_backend.h" | 26 #include "chrome/browser/history/history_backend.h" |
| 27 #include "chrome/browser/history/top_sites.h" | 27 #include "chrome/browser/history/top_sites.h" |
| 28 #include "chrome/browser/in_process_webkit/webkit_context.h" | 28 #include "chrome/browser/in_process_webkit/webkit_context.h" |
| 29 #include "chrome/browser/net/gaia/token_service.h" | 29 #include "chrome/browser/net/gaia/token_service.h" |
| 30 #include "chrome/browser/net/pref_proxy_config_service.h" | 30 #include "chrome/browser/net/pref_proxy_config_service.h" |
| 31 #include "chrome/browser/notifications/desktop_notification_service.h" | 31 #include "chrome/browser/notifications/desktop_notification_service.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 void TestingProfile::SetTemplateURLModel(TemplateURLModel* model) { | 319 void TestingProfile::SetTemplateURLModel(TemplateURLModel* model) { |
| 320 template_url_model_.reset(model); | 320 template_url_model_.reset(model); |
| 321 } | 321 } |
| 322 | 322 |
| 323 void TestingProfile::UseThemeProvider(BrowserThemeProvider* theme_provider) { | 323 void TestingProfile::UseThemeProvider(BrowserThemeProvider* theme_provider) { |
| 324 theme_provider->Init(this); | 324 theme_provider->Init(this); |
| 325 created_theme_provider_ = true; | 325 created_theme_provider_ = true; |
| 326 theme_provider_.reset(theme_provider); | 326 theme_provider_.reset(theme_provider); |
| 327 } | 327 } |
| 328 | 328 |
| 329 scoped_refptr<ExtensionsService> TestingProfile::CreateExtensionsService( | 329 scoped_refptr<ExtensionService> TestingProfile::CreateExtensionService( |
| 330 const CommandLine* command_line, | 330 const CommandLine* command_line, |
| 331 const FilePath& install_directory) { | 331 const FilePath& install_directory) { |
| 332 extension_pref_store_.reset(new ExtensionPrefStore); | 332 extension_pref_store_.reset(new ExtensionPrefStore); |
| 333 extension_prefs_.reset(new ExtensionPrefs(GetPrefs(), | 333 extension_prefs_.reset(new ExtensionPrefs(GetPrefs(), |
| 334 install_directory, | 334 install_directory, |
| 335 extension_pref_store_.get())); | 335 extension_pref_store_.get())); |
| 336 extensions_service_ = new ExtensionsService(this, | 336 extensions_service_ = new ExtensionService(this, |
| 337 command_line, | 337 command_line, |
| 338 install_directory, | 338 install_directory, |
| 339 extension_prefs_.get(), | 339 extension_prefs_.get(), |
| 340 false); | 340 false); |
| 341 return extensions_service_; | 341 return extensions_service_; |
| 342 } | 342 } |
| 343 | 343 |
| 344 FilePath TestingProfile::GetPath() { | 344 FilePath TestingProfile::GetPath() { |
| 345 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better. | 345 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better. |
| 346 return temp_dir_.path(); | 346 return temp_dir_.path(); |
| 347 } | 347 } |
| 348 | 348 |
| 349 TestingPrefService* TestingProfile::GetTestingPrefService() { | 349 TestingPrefService* TestingProfile::GetTestingPrefService() { |
| 350 if (!prefs_.get()) | 350 if (!prefs_.get()) |
| 351 CreateTestingPrefService(); | 351 CreateTestingPrefService(); |
| 352 DCHECK(testing_prefs_); | 352 DCHECK(testing_prefs_); |
| 353 return testing_prefs_; | 353 return testing_prefs_; |
| 354 } | 354 } |
| 355 | 355 |
| 356 webkit_database::DatabaseTracker* TestingProfile::GetDatabaseTracker() { | 356 webkit_database::DatabaseTracker* TestingProfile::GetDatabaseTracker() { |
| 357 if (!db_tracker_) | 357 if (!db_tracker_) |
| 358 db_tracker_ = new webkit_database::DatabaseTracker(GetPath(), false); | 358 db_tracker_ = new webkit_database::DatabaseTracker(GetPath(), false); |
| 359 return db_tracker_; | 359 return db_tracker_; |
| 360 } | 360 } |
| 361 | 361 |
| 362 ExtensionsService* TestingProfile::GetExtensionsService() { | 362 ExtensionService* TestingProfile::GetExtensionService() { |
| 363 return extensions_service_.get(); | 363 return extensions_service_.get(); |
| 364 } | 364 } |
| 365 | 365 |
| 366 net::CookieMonster* TestingProfile::GetCookieMonster() { | 366 net::CookieMonster* TestingProfile::GetCookieMonster() { |
| 367 if (!GetRequestContext()) | 367 if (!GetRequestContext()) |
| 368 return NULL; | 368 return NULL; |
| 369 return GetRequestContext()->GetCookieStore()->GetCookieMonster(); | 369 return GetRequestContext()->GetCookieStore()->GetCookieMonster(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void TestingProfile::InitThemes() { | 372 void TestingProfile::InitThemes() { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 } | 517 } |
| 518 return profile_sync_service_.get(); | 518 return profile_sync_service_.get(); |
| 519 } | 519 } |
| 520 | 520 |
| 521 void TestingProfile::DestroyWebDataService() { | 521 void TestingProfile::DestroyWebDataService() { |
| 522 if (!web_data_service_.get()) | 522 if (!web_data_service_.get()) |
| 523 return; | 523 return; |
| 524 | 524 |
| 525 web_data_service_->Shutdown(); | 525 web_data_service_->Shutdown(); |
| 526 } | 526 } |
| OLD | NEW |