| 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/browser/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 | 558 |
| 559 virtual SpellCheckHost* GetSpellCheckHost() { | 559 virtual SpellCheckHost* GetSpellCheckHost() { |
| 560 return profile_->GetSpellCheckHost(); | 560 return profile_->GetSpellCheckHost(); |
| 561 } | 561 } |
| 562 | 562 |
| 563 virtual void ReinitializeSpellCheckHost(bool force) { | 563 virtual void ReinitializeSpellCheckHost(bool force) { |
| 564 profile_->ReinitializeSpellCheckHost(force); | 564 profile_->ReinitializeSpellCheckHost(force); |
| 565 } | 565 } |
| 566 | 566 |
| 567 virtual WebKitContext* GetWebKitContext() { | 567 virtual WebKitContext* GetWebKitContext() { |
| 568 if (!webkit_context_.get()) { | 568 CreateQuotaManagerAndClients(); |
| 569 webkit_context_ = new WebKitContext( | |
| 570 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(), | |
| 571 false); | |
| 572 } | |
| 573 return webkit_context_.get(); | 569 return webkit_context_.get(); |
| 574 } | 570 } |
| 575 | 571 |
| 576 virtual history::TopSites* GetTopSitesWithoutCreating() { | 572 virtual history::TopSites* GetTopSitesWithoutCreating() { |
| 577 return NULL; | 573 return NULL; |
| 578 } | 574 } |
| 579 | 575 |
| 580 virtual history::TopSites* GetTopSites() { | 576 virtual history::TopSites* GetTopSites() { |
| 581 return NULL; | 577 return NULL; |
| 582 } | 578 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 // TODO(tburkard): Figure out if we want to support this, and how, at some | 683 // TODO(tburkard): Figure out if we want to support this, and how, at some |
| 688 // point in the future. | 684 // point in the future. |
| 689 return NULL; | 685 return NULL; |
| 690 } | 686 } |
| 691 | 687 |
| 692 private: | 688 private: |
| 693 void CreateQuotaManagerAndClients() { | 689 void CreateQuotaManagerAndClients() { |
| 694 if (quota_manager_.get()) { | 690 if (quota_manager_.get()) { |
| 695 DCHECK(file_system_context_.get()); | 691 DCHECK(file_system_context_.get()); |
| 696 DCHECK(db_tracker_.get()); | 692 DCHECK(db_tracker_.get()); |
| 693 DCHECK(webkit_context_.get()); |
| 697 return; | 694 return; |
| 698 } | 695 } |
| 699 | 696 |
| 700 // All of the clients have to be created and registered with the | 697 // All of the clients have to be created and registered with the |
| 701 // QuotaManager prior to the QuotaManger being used. So we do them | 698 // QuotaManager prior to the QuotaManger being used. So we do them |
| 702 // all together here prior to handing out a reference to anything | 699 // all together here prior to handing out a reference to anything |
| 703 // that utlizes the QuotaManager. | 700 // that utlizes the QuotaManager. |
| 704 quota_manager_ = new quota::QuotaManager( | 701 quota_manager_ = new quota::QuotaManager( |
| 705 IsOffTheRecord(), | 702 IsOffTheRecord(), |
| 706 GetPath(), | 703 GetPath(), |
| 707 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 704 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 708 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)); | 705 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)); |
| 709 | 706 |
| 710 // Each consumer is responsible for registering its QuotaClient during | 707 // Each consumer is responsible for registering its QuotaClient during |
| 711 // its construction. | 708 // its construction. |
| 712 file_system_context_ = CreateFileSystemContext( | 709 file_system_context_ = CreateFileSystemContext( |
| 713 GetPath(), IsOffTheRecord(), | 710 GetPath(), IsOffTheRecord(), |
| 714 GetExtensionSpecialStoragePolicy(), | 711 GetExtensionSpecialStoragePolicy(), |
| 715 quota_manager_->proxy()); | 712 quota_manager_->proxy()); |
| 716 db_tracker_ = new webkit_database::DatabaseTracker( | 713 db_tracker_ = new webkit_database::DatabaseTracker( |
| 717 GetPath(), IsOffTheRecord(), GetExtensionSpecialStoragePolicy(), | 714 GetPath(), IsOffTheRecord(), GetExtensionSpecialStoragePolicy(), |
| 718 quota_manager_->proxy(), | 715 quota_manager_->proxy(), |
| 719 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 716 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
| 717 webkit_context_ = new WebKitContext( |
| 718 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(), |
| 719 false, quota_manager_->proxy(), |
| 720 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT)); |
| 720 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); | 721 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); |
| 721 BrowserThread::PostTask( | 722 BrowserThread::PostTask( |
| 722 BrowserThread::IO, FROM_HERE, | 723 BrowserThread::IO, FROM_HERE, |
| 723 NewRunnableMethod( | 724 NewRunnableMethod( |
| 724 appcache_service_.get(), | 725 appcache_service_.get(), |
| 725 &ChromeAppCacheService::InitializeOnIOThread, | 726 &ChromeAppCacheService::InitializeOnIOThread, |
| 726 IsOffTheRecord() | 727 IsOffTheRecord() |
| 727 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), | 728 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), |
| 728 &GetResourceContext(), | 729 &GetResourceContext(), |
| 729 make_scoped_refptr(GetExtensionSpecialStoragePolicy()), | 730 make_scoped_refptr(GetExtensionSpecialStoragePolicy()), |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 }; | 820 }; |
| 820 #endif | 821 #endif |
| 821 | 822 |
| 822 Profile* Profile::CreateOffTheRecordProfile() { | 823 Profile* Profile::CreateOffTheRecordProfile() { |
| 823 #if defined(OS_CHROMEOS) | 824 #if defined(OS_CHROMEOS) |
| 824 if (Profile::IsGuestSession()) | 825 if (Profile::IsGuestSession()) |
| 825 return new GuestSessionProfile(this); | 826 return new GuestSessionProfile(this); |
| 826 #endif | 827 #endif |
| 827 return new OffTheRecordProfileImpl(this); | 828 return new OffTheRecordProfileImpl(this); |
| 828 } | 829 } |
| OLD | NEW |