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 GetExtensionSpecialStoragePolicy()); | 702 GetExtensionSpecialStoragePolicy()); |
706 | 703 |
707 // Each consumer is responsible for registering its QuotaClient during | 704 // Each consumer is responsible for registering its QuotaClient during |
708 // its construction. | 705 // its construction. |
709 file_system_context_ = CreateFileSystemContext( | 706 file_system_context_ = CreateFileSystemContext( |
710 GetPath(), IsOffTheRecord(), | 707 GetPath(), IsOffTheRecord(), |
711 GetExtensionSpecialStoragePolicy(), | 708 GetExtensionSpecialStoragePolicy(), |
712 quota_manager_->proxy()); | 709 quota_manager_->proxy()); |
713 db_tracker_ = new webkit_database::DatabaseTracker( | 710 db_tracker_ = new webkit_database::DatabaseTracker( |
714 GetPath(), IsOffTheRecord(), GetExtensionSpecialStoragePolicy(), | 711 GetPath(), IsOffTheRecord(), GetExtensionSpecialStoragePolicy(), |
715 quota_manager_->proxy(), | 712 quota_manager_->proxy(), |
716 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 713 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
| 714 webkit_context_ = new WebKitContext( |
| 715 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(), |
| 716 false, quota_manager_->proxy(), |
| 717 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT)); |
717 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); | 718 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); |
718 BrowserThread::PostTask( | 719 BrowserThread::PostTask( |
719 BrowserThread::IO, FROM_HERE, | 720 BrowserThread::IO, FROM_HERE, |
720 NewRunnableMethod( | 721 NewRunnableMethod( |
721 appcache_service_.get(), | 722 appcache_service_.get(), |
722 &ChromeAppCacheService::InitializeOnIOThread, | 723 &ChromeAppCacheService::InitializeOnIOThread, |
723 IsOffTheRecord() | 724 IsOffTheRecord() |
724 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), | 725 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), |
725 &GetResourceContext(), | 726 &GetResourceContext(), |
726 make_scoped_refptr(GetExtensionSpecialStoragePolicy()), | 727 make_scoped_refptr(GetExtensionSpecialStoragePolicy()), |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 }; | 817 }; |
817 #endif | 818 #endif |
818 | 819 |
819 Profile* Profile::CreateOffTheRecordProfile() { | 820 Profile* Profile::CreateOffTheRecordProfile() { |
820 #if defined(OS_CHROMEOS) | 821 #if defined(OS_CHROMEOS) |
821 if (Profile::IsGuestSession()) | 822 if (Profile::IsGuestSession()) |
822 return new GuestSessionProfile(this); | 823 return new GuestSessionProfile(this); |
823 #endif | 824 #endif |
824 return new OffTheRecordProfileImpl(this); | 825 return new OffTheRecordProfileImpl(this); |
825 } | 826 } |
OLD | NEW |