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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
682 // We do not allow prerendering in OTR profiles at this point. | 678 // We do not allow prerendering in OTR profiles at this point. |
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()); |
michaeln
2011/05/26 03:48:41
DCHECK(webkit_context_.get()) to be consistent
dgrogan
2011/05/26 05:41:19
Done.
| |
693 return; | 689 return; |
694 } | 690 } |
695 | 691 |
696 // All of the clients have to be created and registered with the | 692 // All of the clients have to be created and registered with the |
697 // QuotaManager prior to the QuotaManger being used. So we do them | 693 // QuotaManager prior to the QuotaManger being used. So we do them |
698 // all together here prior to handing out a reference to anything | 694 // all together here prior to handing out a reference to anything |
699 // that utlizes the QuotaManager. | 695 // that utlizes the QuotaManager. |
700 quota_manager_ = new quota::QuotaManager( | 696 quota_manager_ = new quota::QuotaManager( |
701 IsOffTheRecord(), | 697 IsOffTheRecord(), |
702 GetPath(), | 698 GetPath(), |
703 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 699 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
704 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)); | 700 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)); |
705 | 701 |
706 // Each consumer is responsible for registering its QuotaClient during | 702 // Each consumer is responsible for registering its QuotaClient during |
707 // its construction. | 703 // its construction. |
708 file_system_context_ = CreateFileSystemContext( | 704 file_system_context_ = CreateFileSystemContext( |
709 GetPath(), IsOffTheRecord(), | 705 GetPath(), IsOffTheRecord(), |
710 GetExtensionSpecialStoragePolicy(), | 706 GetExtensionSpecialStoragePolicy(), |
711 quota_manager_->proxy()); | 707 quota_manager_->proxy()); |
712 db_tracker_ = new webkit_database::DatabaseTracker( | 708 db_tracker_ = new webkit_database::DatabaseTracker( |
713 GetPath(), IsOffTheRecord(), GetExtensionSpecialStoragePolicy(), | 709 GetPath(), IsOffTheRecord(), GetExtensionSpecialStoragePolicy(), |
714 quota_manager_->proxy(), | 710 quota_manager_->proxy(), |
715 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 711 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
716 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); | 712 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); |
713 webkit_context_ = new WebKitContext( | |
714 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(), | |
715 false, quota_manager_->proxy(), | |
716 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT)); | |
717 BrowserThread::PostTask( | 717 BrowserThread::PostTask( |
michaeln
2011/05/26 03:48:41
since this PostTask is really part of the appcache
dgrogan
2011/05/26 05:41:19
Done.
| |
718 BrowserThread::IO, FROM_HERE, | 718 BrowserThread::IO, FROM_HERE, |
719 NewRunnableMethod( | 719 NewRunnableMethod( |
720 appcache_service_.get(), | 720 appcache_service_.get(), |
721 &ChromeAppCacheService::InitializeOnIOThread, | 721 &ChromeAppCacheService::InitializeOnIOThread, |
722 IsOffTheRecord() | 722 IsOffTheRecord() |
723 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), | 723 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), |
724 &GetResourceContext(), | 724 &GetResourceContext(), |
725 make_scoped_refptr(GetExtensionSpecialStoragePolicy()), | 725 make_scoped_refptr(GetExtensionSpecialStoragePolicy()), |
726 false)); | 726 false)); |
727 } | 727 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
815 }; | 815 }; |
816 #endif | 816 #endif |
817 | 817 |
818 Profile* Profile::CreateOffTheRecordProfile() { | 818 Profile* Profile::CreateOffTheRecordProfile() { |
819 #if defined(OS_CHROMEOS) | 819 #if defined(OS_CHROMEOS) |
820 if (Profile::IsGuestSession()) | 820 if (Profile::IsGuestSession()) |
821 return new GuestSessionProfile(this); | 821 return new GuestSessionProfile(this); |
822 #endif | 822 #endif |
823 return new OffTheRecordProfileImpl(this); | 823 return new OffTheRecordProfileImpl(this); |
824 } | 824 } |
OLD | NEW |