Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(506)

Side by Side Diff: chrome/browser/profiles/profile.cc

Issue 7791031: Move the otr profile into its own .cc file. Like what was done with the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 // A pointer to the request context for the default profile. See comments on 76 // A pointer to the request context for the default profile. See comments on
77 // Profile::GetDefaultRequestContext. 77 // Profile::GetDefaultRequestContext.
78 net::URLRequestContextGetter* Profile::default_request_context_; 78 net::URLRequestContextGetter* Profile::default_request_context_;
79 79
80 namespace { 80 namespace {
81 81
82 // Used to tag the first profile launched in a Chrome session. 82 // Used to tag the first profile launched in a Chrome session.
83 bool g_first_profile_launched = true; 83 bool g_first_profile_launched = true;
84 84
85 void NotifyOTRProfileCreatedOnIOThread(void* original_profile,
86 void* otr_profile) {
87 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileCreated(
88 original_profile, otr_profile);
89 }
90
91 void NotifyOTRProfileDestroyedOnIOThread(void* original_profile,
92 void* otr_profile) {
93 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileDestroyed(
94 original_profile, otr_profile);
95 }
96
97 } // namespace 85 } // namespace
98 86
99 Profile::Profile() 87 Profile::Profile()
100 : restored_last_session_(false), 88 : restored_last_session_(false),
101 first_launched_(g_first_profile_launched), 89 first_launched_(g_first_profile_launched),
102 accessibility_pause_level_(0) { 90 accessibility_pause_level_(0) {
103 g_first_profile_launched = false; 91 g_first_profile_launched = false;
104 } 92 }
105 93
106 // static 94 // static
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 196 }
209 197
210 std::string Profile::GetDebugName() { 198 std::string Profile::GetDebugName() {
211 std::string name = GetPath().BaseName().MaybeAsASCII(); 199 std::string name = GetPath().BaseName().MaybeAsASCII();
212 if (name.empty()) { 200 if (name.empty()) {
213 name = "UnknownProfile"; 201 name = "UnknownProfile";
214 } 202 }
215 return name; 203 return name;
216 } 204 }
217 205
206 // static
218 bool Profile::IsGuestSession() { 207 bool Profile::IsGuestSession() {
219 #if defined(OS_CHROMEOS) 208 #if defined(OS_CHROMEOS)
220 static bool is_guest_session = 209 static bool is_guest_session =
221 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); 210 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession);
222 return is_guest_session; 211 return is_guest_session;
223 #else 212 #else
224 return false; 213 return false;
225 #endif 214 #endif
226 } 215 }
227 216
228 bool Profile::IsSyncAccessible() { 217 bool Profile::IsSyncAccessible() {
229 ProfileSyncService* syncService = GetProfileSyncService(); 218 ProfileSyncService* syncService = GetProfileSyncService();
230 return syncService && !syncService->IsManaged(); 219 return syncService && !syncService->IsManaged();
231 } 220 }
232
233 ////////////////////////////////////////////////////////////////////////////////
234 //
235 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile
236 // to make it suitable for the incognito mode.
237 //
238 ////////////////////////////////////////////////////////////////////////////////
239 class OffTheRecordProfileImpl : public Profile,
240 public BrowserList::Observer {
241 public:
242 explicit OffTheRecordProfileImpl(Profile* real_profile)
243 : profile_(real_profile),
244 prefs_(real_profile->GetOffTheRecordPrefs()),
245 ALLOW_THIS_IN_INITIALIZER_LIST(io_data_(this)),
246 start_time_(Time::Now()) {
247 extension_process_manager_.reset(ExtensionProcessManager::Create(this));
248
249 BrowserList::AddObserver(this);
250
251 ProfileDependencyManager::GetInstance()->CreateProfileServices(this, false);
252
253 DCHECK_NE(IncognitoModePrefs::DISABLED,
254 IncognitoModePrefs::GetAvailability(real_profile->GetPrefs()));
255
256 // TODO(oshima): Remove the need to eagerly initialize the request context
257 // getter. chromeos::OnlineAttempt is illegally trying to access this
258 // Profile member from a thread other than the UI thread, so we need to
259 // prevent a race.
260 #if defined(OS_CHROMEOS)
261 GetRequestContext();
262 #endif // defined(OS_CHROMEOS)
263
264 // Make the chrome//extension-icon/ resource available.
265 ExtensionIconSource* icon_source = new ExtensionIconSource(real_profile);
266 GetChromeURLDataManager()->AddDataSource(icon_source);
267
268 BrowserThread::PostTask(
269 BrowserThread::IO, FROM_HERE,
270 NewRunnableFunction(&NotifyOTRProfileCreatedOnIOThread, profile_, this));
271 }
272
273 virtual ~OffTheRecordProfileImpl() {
274 NotificationService::current()->Notify(
275 chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(this),
276 NotificationService::NoDetails());
277
278 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this);
279
280 BrowserThread::PostTask(
281 BrowserThread::IO, FROM_HERE,
282 NewRunnableFunction(
283 &NotifyOTRProfileDestroyedOnIOThread, profile_, this));
284
285 // Clean up all DB files/directories
286 if (db_tracker_) {
287 BrowserThread::PostTask(
288 BrowserThread::FILE, FROM_HERE,
289 NewRunnableMethod(
290 db_tracker_.get(),
291 &webkit_database::DatabaseTracker::Shutdown));
292 }
293
294 BrowserList::RemoveObserver(this);
295
296 if (host_content_settings_map_)
297 host_content_settings_map_->ShutdownOnUIThread();
298
299 if (pref_proxy_config_tracker_)
300 pref_proxy_config_tracker_->DetachFromPrefService();
301
302 ExtensionService* extension_service = GetExtensionService();
303 if (extension_service) {
304 ExtensionPrefs* extension_prefs = extension_service->extension_prefs();
305 extension_prefs->ClearIncognitoSessionOnlyContentSettings();
306 }
307 }
308
309 virtual std::string GetProfileName() {
310 // Incognito profile should not return the profile name.
311 return std::string();
312 }
313
314 virtual FilePath GetPath() { return profile_->GetPath(); }
315
316 virtual bool IsOffTheRecord() {
317 return true;
318 }
319
320 virtual Profile* GetOffTheRecordProfile() {
321 return this;
322 }
323
324 virtual void DestroyOffTheRecordProfile() {
325 // Suicide is bad!
326 NOTREACHED();
327 }
328
329 virtual bool HasOffTheRecordProfile() {
330 return true;
331 }
332
333 virtual Profile* GetOriginalProfile() {
334 return profile_;
335 }
336
337 virtual ChromeAppCacheService* GetAppCacheService() {
338 CreateQuotaManagerAndClients();
339 return appcache_service_;
340 }
341
342 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() {
343 CreateQuotaManagerAndClients();
344 return db_tracker_;
345 }
346
347 virtual VisitedLinkMaster* GetVisitedLinkMaster() {
348 // We don't provide access to the VisitedLinkMaster when we're OffTheRecord
349 // because we don't want to leak the sites that the user has visited before.
350 return NULL;
351 }
352
353 virtual ExtensionService* GetExtensionService() {
354 return GetOriginalProfile()->GetExtensionService();
355 }
356
357 virtual UserScriptMaster* GetUserScriptMaster() {
358 return GetOriginalProfile()->GetUserScriptMaster();
359 }
360
361 virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() {
362 // TODO(mpcomplete): figure out whether we should return the original
363 // profile's version.
364 return NULL;
365 }
366
367 virtual ExtensionProcessManager* GetExtensionProcessManager() {
368 return extension_process_manager_.get();
369 }
370
371 virtual ExtensionMessageService* GetExtensionMessageService() {
372 return GetOriginalProfile()->GetExtensionMessageService();
373 }
374
375 virtual ExtensionEventRouter* GetExtensionEventRouter() {
376 return GetOriginalProfile()->GetExtensionEventRouter();
377 }
378
379 virtual ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() {
380 return GetOriginalProfile()->GetExtensionSpecialStoragePolicy();
381 }
382
383 virtual SSLHostState* GetSSLHostState() {
384 if (!ssl_host_state_.get())
385 ssl_host_state_.reset(new SSLHostState());
386
387 DCHECK(ssl_host_state_->CalledOnValidThread());
388 return ssl_host_state_.get();
389 }
390
391 virtual net::TransportSecurityState* GetTransportSecurityState() {
392 if (!transport_security_state_.get()) {
393 transport_security_state_ = new net::TransportSecurityState(
394 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
395 switches::kHstsHosts));
396 transport_security_loader_ =
397 new TransportSecurityPersister(true /* readonly */);
398 transport_security_loader_->Initialize(transport_security_state_.get(),
399 GetOriginalProfile()->GetPath());
400 }
401
402 return transport_security_state_.get();
403 }
404
405 virtual HistoryService* GetHistoryService(ServiceAccessType sat) {
406 if (sat == EXPLICIT_ACCESS)
407 return profile_->GetHistoryService(sat);
408
409 NOTREACHED() << "This profile is OffTheRecord";
410 return NULL;
411 }
412
413 virtual HistoryService* GetHistoryServiceWithoutCreating() {
414 return profile_->GetHistoryServiceWithoutCreating();
415 }
416
417 virtual FaviconService* GetFaviconService(ServiceAccessType sat) {
418 if (sat == EXPLICIT_ACCESS)
419 return profile_->GetFaviconService(sat);
420
421 NOTREACHED() << "This profile is OffTheRecord";
422 return NULL;
423 }
424
425 virtual AutocompleteClassifier* GetAutocompleteClassifier() {
426 return profile_->GetAutocompleteClassifier();
427 }
428
429 virtual history::ShortcutsBackend* GetShortcutsBackend() {
430 return NULL;
431 }
432
433 virtual WebDataService* GetWebDataService(ServiceAccessType sat) {
434 if (sat == EXPLICIT_ACCESS)
435 return profile_->GetWebDataService(sat);
436
437 NOTREACHED() << "This profile is OffTheRecord";
438 return NULL;
439 }
440
441 virtual WebDataService* GetWebDataServiceWithoutCreating() {
442 return profile_->GetWebDataServiceWithoutCreating();
443 }
444
445 virtual PasswordStore* GetPasswordStore(ServiceAccessType sat) {
446 if (sat == EXPLICIT_ACCESS)
447 return profile_->GetPasswordStore(sat);
448
449 NOTREACHED() << "This profile is OffTheRecord";
450 return NULL;
451 }
452
453 virtual PrefService* GetPrefs() {
454 return prefs_;
455 }
456
457 virtual PrefService* GetOffTheRecordPrefs() {
458 return prefs_;
459 }
460
461 virtual TemplateURLFetcher* GetTemplateURLFetcher() {
462 return profile_->GetTemplateURLFetcher();
463 }
464
465 virtual DownloadManager* GetDownloadManager() {
466 if (!download_manager_.get()) {
467 download_manager_delegate_ = new ChromeDownloadManagerDelegate(this);
468 scoped_refptr<DownloadManager> dlm(
469 new DownloadManager(download_manager_delegate_,
470 g_browser_process->download_status_updater()));
471 dlm->Init(this);
472 download_manager_delegate_->SetDownloadManager(dlm);
473 download_manager_.swap(dlm);
474 }
475 return download_manager_.get();
476 }
477
478 virtual bool HasCreatedDownloadManager() const {
479 return (download_manager_.get() != NULL);
480 }
481
482 virtual PersonalDataManager* GetPersonalDataManager() {
483 return NULL;
484 }
485
486 virtual fileapi::FileSystemContext* GetFileSystemContext() {
487 CreateQuotaManagerAndClients();
488 return file_system_context_.get();
489 }
490
491 virtual net::URLRequestContextGetter* GetRequestContext() {
492 return io_data_.GetMainRequestContextGetter();
493 }
494
495 virtual quota::QuotaManager* GetQuotaManager() {
496 CreateQuotaManagerAndClients();
497 return quota_manager_.get();
498 }
499
500 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
501 int renderer_child_id) {
502 if (GetExtensionService()) {
503 const Extension* installed_app = GetExtensionService()->
504 GetInstalledAppForRenderer(renderer_child_id);
505 if (installed_app != NULL && installed_app->is_storage_isolated() &&
506 installed_app->HasAPIPermission(
507 ExtensionAPIPermission::kExperimental)) {
508 return GetRequestContextForIsolatedApp(installed_app->id());
509 }
510 }
511 return GetRequestContext();
512 }
513
514 virtual net::URLRequestContextGetter* GetRequestContextForMedia() {
515 // In OTR mode, media request context is the same as the original one.
516 return io_data_.GetMainRequestContextGetter();
517 }
518
519 virtual net::URLRequestContextGetter* GetRequestContextForExtensions() {
520 return io_data_.GetExtensionsRequestContextGetter();
521 }
522
523 virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp(
524 const std::string& app_id) {
525 return io_data_.GetIsolatedAppRequestContextGetter(app_id);
526 }
527
528 virtual const content::ResourceContext& GetResourceContext() {
529 return io_data_.GetResourceContext();
530 }
531
532 virtual net::SSLConfigService* GetSSLConfigService() {
533 return profile_->GetSSLConfigService();
534 }
535
536 virtual HostContentSettingsMap* GetHostContentSettingsMap() {
537 // Retrieve the host content settings map of the parent profile in order to
538 // ensure the preferences have been migrated.
539 profile_->GetHostContentSettingsMap();
540 if (!host_content_settings_map_.get()) {
541 host_content_settings_map_ = new HostContentSettingsMap(
542 GetPrefs(), GetExtensionService(), true);
543 }
544 return host_content_settings_map_.get();
545 }
546
547 virtual HostZoomMap* GetHostZoomMap() {
548 if (!host_zoom_map_)
549 host_zoom_map_ = new HostZoomMap();
550 return host_zoom_map_.get();
551 }
552
553 virtual GeolocationPermissionContext* GetGeolocationPermissionContext() {
554 return profile_->GetGeolocationPermissionContext();
555 }
556
557 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() {
558 return profile_->GetUserStyleSheetWatcher();
559 }
560
561 virtual FindBarState* GetFindBarState() {
562 if (!find_bar_state_.get())
563 find_bar_state_.reset(new FindBarState());
564 return find_bar_state_.get();
565 }
566
567 virtual bool HasProfileSyncService() const {
568 // We never have a profile sync service.
569 return false;
570 }
571
572 virtual bool DidLastSessionExitCleanly() {
573 return profile_->DidLastSessionExitCleanly();
574 }
575
576 virtual BookmarkModel* GetBookmarkModel() {
577 return profile_->GetBookmarkModel();
578 }
579
580 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() {
581 return profile_->GetProtocolHandlerRegistry();
582 }
583
584 virtual TokenService* GetTokenService() {
585 return NULL;
586 }
587
588 virtual ProfileSyncService* GetProfileSyncService() {
589 return NULL;
590 }
591
592 virtual ProfileSyncService* GetProfileSyncService(
593 const std::string& cros_user) {
594 return NULL;
595 }
596
597 virtual bool IsSameProfile(Profile* profile) {
598 return (profile == this) || (profile == profile_);
599 }
600
601 virtual Time GetStartTime() const {
602 return start_time_;
603 }
604
605 virtual SpellCheckHost* GetSpellCheckHost() {
606 return profile_->GetSpellCheckHost();
607 }
608
609 virtual void ReinitializeSpellCheckHost(bool force) {
610 profile_->ReinitializeSpellCheckHost(force);
611 }
612
613 virtual WebKitContext* GetWebKitContext() {
614 CreateQuotaManagerAndClients();
615 return webkit_context_.get();
616 }
617
618 virtual history::TopSites* GetTopSitesWithoutCreating() {
619 return NULL;
620 }
621
622 virtual history::TopSites* GetTopSites() {
623 return NULL;
624 }
625
626 virtual void MarkAsCleanShutdown() {
627 }
628
629 virtual void InitExtensions(bool extensions_enabled) {
630 NOTREACHED();
631 }
632
633 virtual void InitPromoResources() {
634 NOTREACHED();
635 }
636
637 virtual void InitRegisteredProtocolHandlers() {
638 NOTREACHED();
639 }
640
641 virtual FilePath last_selected_directory() {
642 const FilePath& directory = last_selected_directory_;
643 if (directory.empty()) {
644 return profile_->last_selected_directory();
645 }
646 return directory;
647 }
648
649 virtual void set_last_selected_directory(const FilePath& path) {
650 last_selected_directory_ = path;
651 }
652
653 #if defined(OS_CHROMEOS)
654 virtual void SetupChromeOSEnterpriseExtensionObserver() {
655 profile_->SetupChromeOSEnterpriseExtensionObserver();
656 }
657
658 virtual void InitChromeOSPreferences() {
659 // The incognito profile shouldn't have Chrome OS's preferences.
660 // The preferences are associated with the regular user profile.
661 }
662 #endif // defined(OS_CHROMEOS)
663
664 virtual void ExitedOffTheRecordMode() {
665 // DownloadManager is lazily created, so check before accessing it.
666 if (download_manager_.get()) {
667 // Drop our download manager so we forget about all the downloads made
668 // in incognito mode.
669 download_manager_->Shutdown();
670 download_manager_ = NULL;
671 }
672 }
673
674 virtual void OnBrowserAdded(const Browser* browser) {
675 }
676
677 virtual void OnBrowserRemoved(const Browser* browser) {
678 if (BrowserList::GetBrowserCount(this) == 0)
679 ExitedOffTheRecordMode();
680 }
681
682 virtual ChromeBlobStorageContext* GetBlobStorageContext() {
683 if (!blob_storage_context_) {
684 blob_storage_context_ = new ChromeBlobStorageContext();
685 BrowserThread::PostTask(
686 BrowserThread::IO, FROM_HERE,
687 NewRunnableMethod(
688 blob_storage_context_.get(),
689 &ChromeBlobStorageContext::InitializeOnIOThread));
690 }
691 return blob_storage_context_;
692 }
693
694 virtual ExtensionInfoMap* GetExtensionInfoMap() {
695 return profile_->GetExtensionInfoMap();
696 }
697
698 virtual ChromeURLDataManager* GetChromeURLDataManager() {
699 if (!chrome_url_data_manager_.get())
700 chrome_url_data_manager_.reset(new ChromeURLDataManager(
701 io_data_.GetChromeURLDataManagerBackendGetter()));
702 return chrome_url_data_manager_.get();
703 }
704
705 virtual PromoCounter* GetInstantPromoCounter() {
706 return NULL;
707 }
708
709 #if defined(OS_CHROMEOS)
710 virtual void ChangeAppLocale(const std::string& locale, AppLocaleChangedVia) {
711 }
712 virtual void OnLogin() {
713 }
714 #endif // defined(OS_CHROMEOS)
715
716 virtual PrefProxyConfigTracker* GetProxyConfigTracker() {
717 if (!pref_proxy_config_tracker_)
718 pref_proxy_config_tracker_ = new PrefProxyConfigTracker(GetPrefs());
719
720 return pref_proxy_config_tracker_;
721 }
722
723 virtual prerender::PrerenderManager* GetPrerenderManager() {
724 // We do not allow prerendering in OTR profiles at this point.
725 // TODO(tburkard): Figure out if we want to support this, and how, at some
726 // point in the future.
727 return NULL;
728 }
729
730 private:
731 void CreateQuotaManagerAndClients() {
732 if (quota_manager_.get()) {
733 DCHECK(file_system_context_.get());
734 DCHECK(db_tracker_.get());
735 DCHECK(webkit_context_.get());
736 return;
737 }
738
739 // All of the clients have to be created and registered with the
740 // QuotaManager prior to the QuotaManger being used. So we do them
741 // all together here prior to handing out a reference to anything
742 // that utlizes the QuotaManager.
743 quota_manager_ = new quota::QuotaManager(
744 IsOffTheRecord(),
745 GetPath(),
746 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
747 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
748 GetExtensionSpecialStoragePolicy());
749
750 // Each consumer is responsible for registering its QuotaClient during
751 // its construction.
752 file_system_context_ = CreateFileSystemContext(
753 GetPath(), IsOffTheRecord(),
754 GetExtensionSpecialStoragePolicy(),
755 quota_manager_->proxy());
756 db_tracker_ = new webkit_database::DatabaseTracker(
757 GetPath(), IsOffTheRecord(), false, GetExtensionSpecialStoragePolicy(),
758 quota_manager_->proxy(),
759 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
760 webkit_context_ = new WebKitContext(
761 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(),
762 false, quota_manager_->proxy(),
763 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT));
764 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy());
765 BrowserThread::PostTask(
766 BrowserThread::IO, FROM_HERE,
767 NewRunnableMethod(
768 appcache_service_.get(),
769 &ChromeAppCacheService::InitializeOnIOThread,
770 IsOffTheRecord()
771 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname),
772 &GetResourceContext(),
773 make_scoped_refptr(GetExtensionSpecialStoragePolicy())));
774 }
775
776 NotificationRegistrar registrar_;
777
778 // The real underlying profile.
779 Profile* profile_;
780
781 // Weak pointer owned by |profile_|.
782 PrefService* prefs_;
783
784 scoped_ptr<ExtensionProcessManager> extension_process_manager_;
785
786 OffTheRecordProfileIOData::Handle io_data_;
787
788 // Used so that Chrome code can influence how content module's DownloadManager
789 // functions.
790 scoped_refptr<ChromeDownloadManagerDelegate> download_manager_delegate_;
791
792 // The download manager that only stores downloaded items in memory.
793 scoped_refptr<DownloadManager> download_manager_;
794
795 // We use a non-persistent content settings map for OTR.
796 scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
797
798 // Use a separate zoom map for OTR.
799 scoped_refptr<HostZoomMap> host_zoom_map_;
800
801 // Use a special WebKit context for OTR browsing.
802 scoped_refptr<WebKitContext> webkit_context_;
803
804 // We don't want SSLHostState from the OTR profile to leak back to the main
805 // profile because then the main profile would learn some of the host names
806 // the user visited while OTR.
807 scoped_ptr<SSLHostState> ssl_host_state_;
808
809 // Use a separate FindBarState so search terms do not leak back to the main
810 // profile.
811 scoped_ptr<FindBarState> find_bar_state_;
812
813 // The TransportSecurityState that only stores enabled sites in memory.
814 scoped_refptr<net::TransportSecurityState>
815 transport_security_state_;
816
817 // Time we were started.
818 Time start_time_;
819
820 scoped_refptr<ChromeAppCacheService> appcache_service_;
821
822 // The main database tracker for this profile.
823 // Should be used only on the file thread.
824 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_;
825
826 FilePath last_selected_directory_;
827
828 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
829
830 // The file_system context for this profile.
831 scoped_refptr<fileapi::FileSystemContext> file_system_context_;
832
833 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
834
835 scoped_ptr<ChromeURLDataManager> chrome_url_data_manager_;
836
837 scoped_refptr<quota::QuotaManager> quota_manager_;
838
839 // Used read-only.
840 scoped_refptr<TransportSecurityPersister> transport_security_loader_;
841
842 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl);
843 };
844
845 #if defined(OS_CHROMEOS)
846 // Special case of the OffTheRecordProfileImpl which is used while Guest
847 // session in CrOS.
848 class GuestSessionProfile : public OffTheRecordProfileImpl {
849 public:
850 explicit GuestSessionProfile(Profile* real_profile)
851 : OffTheRecordProfileImpl(real_profile) {
852 }
853
854 virtual PersonalDataManager* GetPersonalDataManager() {
855 return GetOriginalProfile()->GetPersonalDataManager();
856 }
857
858 virtual void InitChromeOSPreferences() {
859 chromeos_preferences_.reset(new chromeos::Preferences());
860 chromeos_preferences_->Init(GetPrefs());
861 }
862
863 private:
864 // The guest user should be able to customize Chrome OS preferences.
865 scoped_ptr<chromeos::Preferences> chromeos_preferences_;
866 };
867 #endif
868
869 Profile* Profile::CreateOffTheRecordProfile() {
870 #if defined(OS_CHROMEOS)
871 if (Profile::IsGuestSession())
872 return new GuestSessionProfile(this);
873 #endif
874 return new OffTheRecordProfileImpl(this);
875 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698