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

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

Issue 6272016: Prevent non-Incognito windows in the Guest session. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser
Patch Set: code review Created 9 years, 10 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
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/file_path.h" 10 #include "base/file_path.h"
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/in_process_webkit/webkit_context.h" 25 #include "chrome/browser/in_process_webkit/webkit_context.h"
26 #include "chrome/browser/net/chrome_url_request_context.h" 26 #include "chrome/browser/net/chrome_url_request_context.h"
27 #include "chrome/browser/net/pref_proxy_config_service.h" 27 #include "chrome/browser/net/pref_proxy_config_service.h"
28 #include "chrome/browser/notifications/desktop_notification_service.h" 28 #include "chrome/browser/notifications/desktop_notification_service.h"
29 #include "chrome/browser/ssl/ssl_host_state.h" 29 #include "chrome/browser/ssl/ssl_host_state.h"
30 #include "chrome/browser/sync/profile_sync_service.h" 30 #include "chrome/browser/sync/profile_sync_service.h"
31 #include "chrome/browser/themes/browser_theme_provider.h" 31 #include "chrome/browser/themes/browser_theme_provider.h"
32 #include "chrome/browser/ui/find_bar/find_bar_state.h" 32 #include "chrome/browser/ui/find_bar/find_bar_state.h"
33 #include "chrome/common/chrome_constants.h" 33 #include "chrome/common/chrome_constants.h"
34 #include "chrome/common/chrome_paths.h" 34 #include "chrome/common/chrome_paths.h"
35 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/json_pref_store.h" 36 #include "chrome/common/json_pref_store.h"
36 #include "chrome/common/notification_service.h" 37 #include "chrome/common/notification_service.h"
37 #include "chrome/common/pref_names.h" 38 #include "chrome/common/pref_names.h"
38 #include "chrome/common/render_messages.h" 39 #include "chrome/common/render_messages.h"
39 #include "grit/browser_resources.h" 40 #include "grit/browser_resources.h"
40 #include "grit/locale_settings.h" 41 #include "grit/locale_settings.h"
41 #include "net/base/transport_security_state.h" 42 #include "net/base/transport_security_state.h"
42 #include "ui/base/resource/resource_bundle.h" 43 #include "ui/base/resource/resource_bundle.h"
43 #include "webkit/database/database_tracker.h" 44 #include "webkit/database/database_tracker.h"
44 45
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 prefs->RegisterStringPref(prefs::kApplicationLocaleBackup, ""); 117 prefs->RegisterStringPref(prefs::kApplicationLocaleBackup, "");
117 prefs->RegisterStringPref(prefs::kApplicationLocaleAccepted, ""); 118 prefs->RegisterStringPref(prefs::kApplicationLocaleAccepted, "");
118 #endif 119 #endif
119 } 120 }
120 121
121 // static 122 // static
122 URLRequestContextGetter* Profile::GetDefaultRequestContext() { 123 URLRequestContextGetter* Profile::GetDefaultRequestContext() {
123 return default_request_context_; 124 return default_request_context_;
124 } 125 }
125 126
127 bool Profile::IsGuestSession() {
128 #if defined(OS_CHROMEOS)
129 static bool is_guest_session =
130 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession);
131 return is_guest_session;
132 #else
133 return false;
134 #endif
135 }
136
126 bool Profile::IsSyncAccessible() { 137 bool Profile::IsSyncAccessible() {
127 ProfileSyncService* syncService = GetProfileSyncService(); 138 ProfileSyncService* syncService = GetProfileSyncService();
128 return syncService && !syncService->IsManaged(); 139 return syncService && !syncService->IsManaged();
129 } 140 }
130 141
131 //////////////////////////////////////////////////////////////////////////////// 142 ////////////////////////////////////////////////////////////////////////////////
132 // 143 //
133 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile 144 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile
134 // to make it suitable for the off the record mode. 145 // to make it suitable for the off the record mode.
135 // 146 //
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; 708 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
698 709
699 // The file_system context for this profile. 710 // The file_system context for this profile.
700 scoped_refptr<fileapi::SandboxedFileSystemContext> file_system_context_; 711 scoped_refptr<fileapi::SandboxedFileSystemContext> file_system_context_;
701 712
702 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; 713 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
703 714
704 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); 715 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl);
705 }; 716 };
706 717
718 #if defined(OS_CHROMEOS)
719 // Special case of the OffTheRecordProfileImpl which is used while Guest
720 // session in CrOS.
721 class GuestSessionProfile : public OffTheRecordProfileImpl {
722 public:
723 explicit GuestSessionProfile(Profile* real_profile)
724 : OffTheRecordProfileImpl(real_profile) {
725 }
726
727 virtual PersonalDataManager* GetPersonalDataManager() {
728 return GetOriginalProfile()->GetPersonalDataManager();
729 }
730 };
731 #endif
732
707 Profile* Profile::CreateOffTheRecordProfile() { 733 Profile* Profile::CreateOffTheRecordProfile() {
734 #if defined(OS_CHROMEOS)
735 if (Profile::IsGuestSession())
736 return new GuestSessionProfile(this);
737 #endif
708 return new OffTheRecordProfileImpl(this); 738 return new OffTheRecordProfileImpl(this);
709 } 739 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698