| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/browser/profile.h" | 5 #include "chrome/browser/profile.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/lock.h" | 10 #include "base/lock.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/app/locales/locale_settings.h" | 15 #include "chrome/app/locales/locale_settings.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model.h" | 16 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 17 #include "chrome/browser/browser_list.h" | 17 #include "chrome/browser/browser_list.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/download/download_manager.h" | 19 #include "chrome/browser/download/download_manager.h" |
| 20 #include "chrome/browser/extensions/extensions_service.h" |
| 20 #include "chrome/browser/greasemonkey_master.h" | 21 #include "chrome/browser/greasemonkey_master.h" |
| 21 #include "chrome/browser/history/history.h" | 22 #include "chrome/browser/history/history.h" |
| 22 #include "chrome/browser/navigation_controller.h" | 23 #include "chrome/browser/navigation_controller.h" |
| 23 #include "chrome/browser/profile_manager.h" | 24 #include "chrome/browser/profile_manager.h" |
| 24 #include "chrome/browser/render_process_host.h" | 25 #include "chrome/browser/render_process_host.h" |
| 25 #include "chrome/browser/spellchecker.h" | 26 #include "chrome/browser/spellchecker.h" |
| 26 #include "chrome/browser/tab_restore_service.h" | 27 #include "chrome/browser/tab_restore_service.h" |
| 27 #include "chrome/browser/template_url_fetcher.h" | 28 #include "chrome/browser/template_url_fetcher.h" |
| 28 #include "chrome/browser/template_url_model.h" | 29 #include "chrome/browser/template_url_model.h" |
| 29 #include "chrome/browser/visitedlink_master.h" | 30 #include "chrome/browser/visitedlink_master.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 } | 378 } |
| 378 | 379 |
| 379 virtual Profile* GetOriginalProfile() { | 380 virtual Profile* GetOriginalProfile() { |
| 380 return profile_; | 381 return profile_; |
| 381 } | 382 } |
| 382 | 383 |
| 383 virtual VisitedLinkMaster* GetVisitedLinkMaster() { | 384 virtual VisitedLinkMaster* GetVisitedLinkMaster() { |
| 384 return profile_->GetVisitedLinkMaster(); | 385 return profile_->GetVisitedLinkMaster(); |
| 385 } | 386 } |
| 386 | 387 |
| 388 virtual ExtensionsService* GetExtensionsService() { |
| 389 return profile_->GetExtensionsService(); |
| 390 } |
| 391 |
| 387 virtual GreasemonkeyMaster* GetGreasemonkeyMaster() { | 392 virtual GreasemonkeyMaster* GetGreasemonkeyMaster() { |
| 388 return profile_->GetGreasemonkeyMaster(); | 393 return profile_->GetGreasemonkeyMaster(); |
| 389 } | 394 } |
| 390 | 395 |
| 391 virtual HistoryService* GetHistoryService(ServiceAccessType sat) { | 396 virtual HistoryService* GetHistoryService(ServiceAccessType sat) { |
| 392 if (sat == EXPLICIT_ACCESS) { | 397 if (sat == EXPLICIT_ACCESS) { |
| 393 return profile_->GetHistoryService(sat); | 398 return profile_->GetHistoryService(sat); |
| 394 } else { | 399 } else { |
| 395 NOTREACHED() << "This profile is OffTheRecord"; | 400 NOTREACHED() << "This profile is OffTheRecord"; |
| 396 return NULL; | 401 return NULL; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 | 545 |
| 541 // Time we were started. | 546 // Time we were started. |
| 542 Time start_time_; | 547 Time start_time_; |
| 543 | 548 |
| 544 DISALLOW_EVIL_CONSTRUCTORS(OffTheRecordProfileImpl); | 549 DISALLOW_EVIL_CONSTRUCTORS(OffTheRecordProfileImpl); |
| 545 }; | 550 }; |
| 546 | 551 |
| 547 ProfileImpl::ProfileImpl(const std::wstring& path) | 552 ProfileImpl::ProfileImpl(const std::wstring& path) |
| 548 : path_(path), | 553 : path_(path), |
| 549 off_the_record_(false), | 554 off_the_record_(false), |
| 555 extensions_service_(new ExtensionsService(FilePath(path))), |
| 550 history_service_created_(false), | 556 history_service_created_(false), |
| 551 created_web_data_service_(false), | 557 created_web_data_service_(false), |
| 552 created_download_manager_(false), | 558 created_download_manager_(false), |
| 553 request_context_(NULL), | 559 request_context_(NULL), |
| 554 start_time_(Time::Now()), | 560 start_time_(Time::Now()), |
| 555 spellchecker_(NULL), | 561 spellchecker_(NULL), |
| 556 #ifdef CHROME_PERSONALIZATION | 562 #ifdef CHROME_PERSONALIZATION |
| 557 personalization_(NULL), | 563 personalization_(NULL), |
| 558 #endif | 564 #endif |
| 559 shutdown_session_service_(false) { | 565 shutdown_session_service_(false) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 new VisitedLinkMaster(g_browser_process->file_thread(), | 687 new VisitedLinkMaster(g_browser_process->file_thread(), |
| 682 BroadcastNewHistoryTable, this)); | 688 BroadcastNewHistoryTable, this)); |
| 683 if (!visited_links->Init()) | 689 if (!visited_links->Init()) |
| 684 return NULL; | 690 return NULL; |
| 685 visited_link_master_.swap(visited_links); | 691 visited_link_master_.swap(visited_links); |
| 686 } | 692 } |
| 687 | 693 |
| 688 return visited_link_master_.get(); | 694 return visited_link_master_.get(); |
| 689 } | 695 } |
| 690 | 696 |
| 697 ExtensionsService* ProfileImpl::GetExtensionsService() { |
| 698 return extensions_service_.get(); |
| 699 } |
| 700 |
| 691 GreasemonkeyMaster* ProfileImpl::GetGreasemonkeyMaster() { | 701 GreasemonkeyMaster* ProfileImpl::GetGreasemonkeyMaster() { |
| 692 if (!greasemonkey_master_.get()) { | 702 if (!greasemonkey_master_.get()) { |
| 693 std::wstring script_dir_str; | 703 std::wstring script_dir_str; |
| 694 PathService::Get(chrome::DIR_USER_SCRIPTS, &script_dir_str); | 704 PathService::Get(chrome::DIR_USER_SCRIPTS, &script_dir_str); |
| 695 FilePath script_dir(script_dir_str); | 705 FilePath script_dir(script_dir_str); |
| 696 greasemonkey_master_ = | 706 greasemonkey_master_ = |
| 697 new GreasemonkeyMaster(g_browser_process->file_thread()->message_loop(), | 707 new GreasemonkeyMaster(g_browser_process->file_thread()->message_loop(), |
| 698 script_dir); | 708 script_dir); |
| 699 } | 709 } |
| 700 | 710 |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 } | 1000 } |
| 991 | 1001 |
| 992 #ifdef CHROME_PERSONALIZATION | 1002 #ifdef CHROME_PERSONALIZATION |
| 993 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { | 1003 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { |
| 994 if (!personalization_.get()) | 1004 if (!personalization_.get()) |
| 995 personalization_.reset( | 1005 personalization_.reset( |
| 996 Personalization::CreateProfilePersonalization(this)); | 1006 Personalization::CreateProfilePersonalization(this)); |
| 997 return personalization_.get(); | 1007 return personalization_.get(); |
| 998 } | 1008 } |
| 999 #endif | 1009 #endif |
| OLD | NEW |