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