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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile.h ('k') | chrome/browser/ui/browser_navigator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile.cc
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
index ac869eb64697d21df4fab9bf2c0b313e6654ba09..85c71add6605df0949f327b104494cdb12d49a6b 100644
--- a/chrome/browser/profiles/profile.cc
+++ b/chrome/browser/profiles/profile.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/ui/find_bar/find_bar_state.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/json_pref_store.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
@@ -126,6 +127,16 @@ URLRequestContextGetter* Profile::GetDefaultRequestContext() {
return default_request_context_;
}
+bool Profile::IsGuestSession() {
+#if defined(OS_CHROMEOS)
+ static bool is_guest_session =
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession);
+ return is_guest_session;
+#else
+ return false;
+#endif
+}
+
bool Profile::IsSyncAccessible() {
ProfileSyncService* syncService = GetProfileSyncService();
return syncService && !syncService->IsManaged();
@@ -711,6 +722,25 @@ class OffTheRecordProfileImpl : public Profile,
DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl);
};
+#if defined(OS_CHROMEOS)
+// Special case of the OffTheRecordProfileImpl which is used while Guest
+// session in CrOS.
+class GuestSessionProfile : public OffTheRecordProfileImpl {
+ public:
+ explicit GuestSessionProfile(Profile* real_profile)
+ : OffTheRecordProfileImpl(real_profile) {
+ }
+
+ virtual PersonalDataManager* GetPersonalDataManager() {
+ return GetOriginalProfile()->GetPersonalDataManager();
+ }
+};
+#endif
+
Profile* Profile::CreateOffTheRecordProfile() {
+#if defined(OS_CHROMEOS)
+ if (Profile::IsGuestSession())
+ return new GuestSessionProfile(this);
+#endif
return new OffTheRecordProfileImpl(this);
}
« 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