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 "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/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/prefs/testing_pref_store.h" | 14 #include "base/prefs/testing_pref_store.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
19 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | 19 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
| 20 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" |
20 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/chrome_notification_types.h" | 22 #include "chrome/browser/chrome_notification_types.h" |
22 #include "chrome/browser/content_settings/host_content_settings_map.h" | 23 #include "chrome/browser/content_settings/host_content_settings_map.h" |
23 #include "chrome/browser/extensions/extension_service.h" | 24 #include "chrome/browser/extensions/extension_service.h" |
24 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 25 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
25 #include "chrome/browser/extensions/extension_system_factory.h" | 26 #include "chrome/browser/extensions/extension_system_factory.h" |
26 #include "chrome/browser/extensions/test_extension_system.h" | 27 #include "chrome/browser/extensions/test_extension_system.h" |
27 #include "chrome/browser/favicon/favicon_service.h" | 28 #include "chrome/browser/favicon/favicon_service.h" |
28 #include "chrome/browser/favicon/favicon_service_factory.h" | 29 #include "chrome/browser/favicon/favicon_service_factory.h" |
29 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" | 30 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 // need to be run to properly shutdown. Run all pending tasks now. This is | 492 // need to be run to properly shutdown. Run all pending tasks now. This is |
492 // normally handled by browser_process shutdown. | 493 // normally handled by browser_process shutdown. |
493 if (base::MessageLoop::current()) | 494 if (base::MessageLoop::current()) |
494 base::MessageLoop::current()->RunUntilIdle(); | 495 base::MessageLoop::current()->RunUntilIdle(); |
495 } | 496 } |
496 } | 497 } |
497 | 498 |
498 static KeyedService* BuildBookmarkModel(content::BrowserContext* context) { | 499 static KeyedService* BuildBookmarkModel(content::BrowserContext* context) { |
499 Profile* profile = static_cast<Profile*>(context); | 500 Profile* profile = static_cast<Profile*>(context); |
500 ChromeBookmarkClient* bookmark_client = | 501 ChromeBookmarkClient* bookmark_client = |
501 new ChromeBookmarkClient(profile, false); | 502 ChromeBookmarkClientFactory::GetForProfile(profile); |
502 bookmark_client->model()->Load( | 503 BookmarkModel* bookmark_model = new BookmarkModel(bookmark_client, false); |
503 profile->GetPrefs(), | 504 bookmark_client->Init(bookmark_model); |
504 profile->GetPrefs()->GetString(prefs::kAcceptLanguages), | 505 bookmark_model->Load(profile->GetPrefs(), |
505 profile->GetPath(), | 506 profile->GetPrefs()->GetString(prefs::kAcceptLanguages), |
506 profile->GetIOTaskRunner(), | 507 profile->GetPath(), |
507 content::BrowserThread::GetMessageLoopProxyForThread( | 508 profile->GetIOTaskRunner(), |
508 content::BrowserThread::UI)); | 509 content::BrowserThread::GetMessageLoopProxyForThread( |
509 return bookmark_client; | 510 content::BrowserThread::UI)); |
| 511 return bookmark_model; |
510 } | 512 } |
511 | 513 |
512 static KeyedService* BuildChromeHistoryClient( | 514 static KeyedService* BuildChromeHistoryClient( |
513 content::BrowserContext* context) { | 515 content::BrowserContext* context) { |
514 Profile* profile = static_cast<Profile*>(context); | 516 Profile* profile = static_cast<Profile*>(context); |
515 return new ChromeHistoryClient(BookmarkModelFactory::GetForProfile(profile)); | 517 return new ChromeHistoryClient(BookmarkModelFactory::GetForProfile(profile)); |
516 } | 518 } |
517 | 519 |
518 void TestingProfile::CreateBookmarkModel(bool delete_file) { | 520 void TestingProfile::CreateBookmarkModel(bool delete_file) { |
519 if (delete_file) { | 521 if (delete_file) { |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 path_, | 978 path_, |
977 delegate_, | 979 delegate_, |
978 extension_policy_, | 980 extension_policy_, |
979 pref_service_.Pass(), | 981 pref_service_.Pass(), |
980 incognito_, | 982 incognito_, |
981 guest_session_, | 983 guest_session_, |
982 managed_user_id_, | 984 managed_user_id_, |
983 policy_service_.Pass(), | 985 policy_service_.Pass(), |
984 testing_factories_)); | 986 testing_factories_)); |
985 } | 987 } |
OLD | NEW |