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

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: fixed win warning + indent 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
« no previous file with comments | « chrome/browser/profiles/profile.h ('k') | chrome/browser/ui/browser_navigator.cc » ('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/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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 prefs->RegisterStringPref(prefs::kApplicationLocaleBackup, ""); 120 prefs->RegisterStringPref(prefs::kApplicationLocaleBackup, "");
120 prefs->RegisterStringPref(prefs::kApplicationLocaleAccepted, ""); 121 prefs->RegisterStringPref(prefs::kApplicationLocaleAccepted, "");
121 #endif 122 #endif
122 } 123 }
123 124
124 // static 125 // static
125 URLRequestContextGetter* Profile::GetDefaultRequestContext() { 126 URLRequestContextGetter* Profile::GetDefaultRequestContext() {
126 return default_request_context_; 127 return default_request_context_;
127 } 128 }
128 129
130 bool Profile::IsGuestSession() {
131 #if defined(OS_CHROMEOS)
132 static bool is_guest_session =
133 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession);
134 return is_guest_session;
135 #else
136 return false;
137 #endif
138 }
139
129 bool Profile::IsSyncAccessible() { 140 bool Profile::IsSyncAccessible() {
130 ProfileSyncService* syncService = GetProfileSyncService(); 141 ProfileSyncService* syncService = GetProfileSyncService();
131 return syncService && !syncService->IsManaged(); 142 return syncService && !syncService->IsManaged();
132 } 143 }
133 144
134 //////////////////////////////////////////////////////////////////////////////// 145 ////////////////////////////////////////////////////////////////////////////////
135 // 146 //
136 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile 147 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile
137 // to make it suitable for the off the record mode. 148 // to make it suitable for the off the record mode.
138 // 149 //
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; 715 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
705 716
706 // The file_system context for this profile. 717 // The file_system context for this profile.
707 scoped_refptr<fileapi::SandboxedFileSystemContext> file_system_context_; 718 scoped_refptr<fileapi::SandboxedFileSystemContext> file_system_context_;
708 719
709 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; 720 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
710 721
711 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl); 722 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl);
712 }; 723 };
713 724
725 #if defined(OS_CHROMEOS)
726 // Special case of the OffTheRecordProfileImpl which is used while Guest
727 // session in CrOS.
728 class GuestSessionProfile : public OffTheRecordProfileImpl {
729 public:
730 explicit GuestSessionProfile(Profile* real_profile)
731 : OffTheRecordProfileImpl(real_profile) {
732 }
733
734 virtual PersonalDataManager* GetPersonalDataManager() {
735 return GetOriginalProfile()->GetPersonalDataManager();
736 }
737 };
738 #endif
739
714 Profile* Profile::CreateOffTheRecordProfile() { 740 Profile* Profile::CreateOffTheRecordProfile() {
741 #if defined(OS_CHROMEOS)
742 if (Profile::IsGuestSession())
743 return new GuestSessionProfile(this);
744 #endif
715 return new OffTheRecordProfileImpl(this); 745 return new OffTheRecordProfileImpl(this);
716 } 746 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile.h ('k') | chrome/browser/ui/browser_navigator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698