| 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/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/custom_handlers/protocol_handler_registry.h" |
| 19 #include "chrome/browser/dom_ui/ntp_resource_cache.h" | 20 #include "chrome/browser/dom_ui/ntp_resource_cache.h" |
| 20 #include "chrome/browser/extensions/extension_pref_value_map.h" | 21 #include "chrome/browser/extensions/extension_pref_value_map.h" |
| 21 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
| 22 #include "chrome/browser/favicon_service.h" | 23 #include "chrome/browser/favicon_service.h" |
| 23 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | 24 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" |
| 24 #include "chrome/browser/geolocation/geolocation_permission_context.h" | 25 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
| 25 #include "chrome/browser/history/history.h" | 26 #include "chrome/browser/history/history.h" |
| 26 #include "chrome/browser/history/history_backend.h" | 27 #include "chrome/browser/history/history_backend.h" |
| 27 #include "chrome/browser/history/top_sites.h" | 28 #include "chrome/browser/history/top_sites.h" |
| 28 #include "chrome/browser/in_process_webkit/webkit_context.h" | 29 #include "chrome/browser/in_process_webkit/webkit_context.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 history_service_->history_backend_->expirer_.bookmark_service_ = | 272 history_service_->history_backend_->expirer_.bookmark_service_ = |
| 272 bookmark_bar_model_.get(); | 273 bookmark_bar_model_.get(); |
| 273 } | 274 } |
| 274 bookmark_bar_model_->Load(); | 275 bookmark_bar_model_->Load(); |
| 275 } | 276 } |
| 276 | 277 |
| 277 void TestingProfile::CreateAutocompleteClassifier() { | 278 void TestingProfile::CreateAutocompleteClassifier() { |
| 278 autocomplete_classifier_.reset(new AutocompleteClassifier(this)); | 279 autocomplete_classifier_.reset(new AutocompleteClassifier(this)); |
| 279 } | 280 } |
| 280 | 281 |
| 282 void TestingProfile::CreateProtocolHandlerRegistry() { |
| 283 protocol_handler_registry_ = new ProtocolHandlerRegistry(this); |
| 284 } |
| 285 |
| 281 void TestingProfile::CreateWebDataService(bool delete_file) { | 286 void TestingProfile::CreateWebDataService(bool delete_file) { |
| 282 if (web_data_service_.get()) | 287 if (web_data_service_.get()) |
| 283 web_data_service_->Shutdown(); | 288 web_data_service_->Shutdown(); |
| 284 | 289 |
| 285 if (delete_file) { | 290 if (delete_file) { |
| 286 FilePath path = GetPath(); | 291 FilePath path = GetPath(); |
| 287 path = path.Append(chrome::kWebDataFilename); | 292 path = path.Append(chrome::kWebDataFilename); |
| 288 file_util::Delete(path, false); | 293 file_util::Delete(path, false); |
| 289 } | 294 } |
| 290 | 295 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 } | 650 } |
| 646 | 651 |
| 647 base::Time TestingProfile::GetStartTime() const { | 652 base::Time TestingProfile::GetStartTime() const { |
| 648 return start_time_; | 653 return start_time_; |
| 649 } | 654 } |
| 650 | 655 |
| 651 TabRestoreService* TestingProfile::GetTabRestoreService() { | 656 TabRestoreService* TestingProfile::GetTabRestoreService() { |
| 652 return NULL; | 657 return NULL; |
| 653 } | 658 } |
| 654 | 659 |
| 660 ProtocolHandlerRegistry* TestingProfile::GetProtocolHandlerRegistry() { |
| 661 return protocol_handler_registry_.get(); |
| 662 } |
| 663 |
| 655 SpellCheckHost* TestingProfile::GetSpellCheckHost() { | 664 SpellCheckHost* TestingProfile::GetSpellCheckHost() { |
| 656 return NULL; | 665 return NULL; |
| 657 } | 666 } |
| 658 | 667 |
| 659 void TestingProfile::set_session_service(SessionService* session_service) { | 668 void TestingProfile::set_session_service(SessionService* session_service) { |
| 660 session_service_ = session_service; | 669 session_service_ = session_service; |
| 661 } | 670 } |
| 662 | 671 |
| 663 WebKitContext* TestingProfile::GetWebKitContext() { | 672 WebKitContext* TestingProfile::GetWebKitContext() { |
| 664 if (webkit_context_ == NULL) | 673 if (webkit_context_ == NULL) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 } | 792 } |
| 784 | 793 |
| 785 DerivedTestingProfile::DerivedTestingProfile(Profile* profile) | 794 DerivedTestingProfile::DerivedTestingProfile(Profile* profile) |
| 786 : original_profile_(profile) {} | 795 : original_profile_(profile) {} |
| 787 | 796 |
| 788 DerivedTestingProfile::~DerivedTestingProfile() {} | 797 DerivedTestingProfile::~DerivedTestingProfile() {} |
| 789 | 798 |
| 790 ProfileId DerivedTestingProfile::GetRuntimeId() { | 799 ProfileId DerivedTestingProfile::GetRuntimeId() { |
| 791 return original_profile_->GetRuntimeId(); | 800 return original_profile_->GetRuntimeId(); |
| 792 } | 801 } |
| OLD | NEW |