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

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

Issue 9691032: Use OffTheRecord profile in case of GuestLogin for AppList. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <set> 5 #include <set>
6 6
7 #include "chrome/browser/profiles/profile_manager.h" 7 #include "chrome/browser/profiles/profile_manager.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "grit/generated_resources.h" 44 #include "grit/generated_resources.h"
45 #include "net/http/http_transaction_factory.h" 45 #include "net/http/http_transaction_factory.h"
46 #include "net/url_request/url_request_context.h" 46 #include "net/url_request/url_request_context.h"
47 #include "net/url_request/url_request_context_getter.h" 47 #include "net/url_request/url_request_context_getter.h"
48 #include "net/url_request/url_request_job.h" 48 #include "net/url_request/url_request_job.h"
49 #include "ui/base/l10n/l10n_util.h" 49 #include "ui/base/l10n/l10n_util.h"
50 50
51 #if defined(OS_CHROMEOS) 51 #if defined(OS_CHROMEOS)
52 #include "chrome/browser/chromeos/cros/cros_library.h" 52 #include "chrome/browser/chromeos/cros/cros_library.h"
53 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 53 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
54 #include "chrome/browser/chromeos/login/user_manager.h"
54 #endif 55 #endif
55 56
56 using content::BrowserThread; 57 using content::BrowserThread;
57 using content::UserMetricsAction; 58 using content::UserMetricsAction;
58 59
59 namespace { 60 namespace {
60 61
61 // Profiles that should be deleted on shutdown. 62 // Profiles that should be deleted on shutdown.
62 std::vector<FilePath>& ProfilesToDelete() { 63 std::vector<FilePath>& ProfilesToDelete() {
63 CR_DEFINE_STATIC_LOCAL(std::vector<FilePath>, profiles_to_delete, ()); 64 CR_DEFINE_STATIC_LOCAL(std::vector<FilePath>, profiles_to_delete, ());
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 ProfilesToDelete().clear(); 177 ProfilesToDelete().clear();
177 } 178 }
178 179
179 // static 180 // static
180 Profile* ProfileManager::GetDefaultProfile() { 181 Profile* ProfileManager::GetDefaultProfile() {
181 ProfileManager* profile_manager = g_browser_process->profile_manager(); 182 ProfileManager* profile_manager = g_browser_process->profile_manager();
182 return profile_manager->GetDefaultProfile(profile_manager->user_data_dir_); 183 return profile_manager->GetDefaultProfile(profile_manager->user_data_dir_);
183 } 184 }
184 185
185 // static 186 // static
187 Profile* ProfileManager::GetDefaultProfileOrOffTheRecord() {
188 // TODO (mukai,nkostylev): In the long term we should fix those cases that
189 // crash on Guest mode and have only one GetDefaultProfile() method.
190 Profile* profile = GetDefaultProfile();
191 #if defined(OS_CHROMEOS)
192 if (chromeos::UserManager::Get()->IsLoggedInAsGuest())
193 profile = profile->GetOffTheRecordProfile();
194 #endif
195 return profile;
196 }
197
198 // static
186 Profile* ProfileManager::GetLastUsedProfile() { 199 Profile* ProfileManager::GetLastUsedProfile() {
187 ProfileManager* profile_manager = g_browser_process->profile_manager(); 200 ProfileManager* profile_manager = g_browser_process->profile_manager();
188 return profile_manager->GetLastUsedProfile(profile_manager->user_data_dir_); 201 return profile_manager->GetLastUsedProfile(profile_manager->user_data_dir_);
189 } 202 }
190 203
191 // static 204 // static
192 std::vector<Profile*> ProfileManager::GetLastOpenedProfiles() { 205 std::vector<Profile*> ProfileManager::GetLastOpenedProfiles() {
193 ProfileManager* profile_manager = g_browser_process->profile_manager(); 206 ProfileManager* profile_manager = g_browser_process->profile_manager();
194 return profile_manager->GetLastOpenedProfiles( 207 return profile_manager->GetLastOpenedProfiles(
195 profile_manager->user_data_dir_); 208 profile_manager->user_data_dir_);
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 AddProfileToCache(profile); 957 AddProfileToCache(profile);
945 } 958 }
946 } 959 }
947 960
948 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, 961 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks,
949 Profile* profile, 962 Profile* profile,
950 Profile::CreateStatus status) { 963 Profile::CreateStatus status) {
951 for (size_t i = 0; i < callbacks.size(); ++i) 964 for (size_t i = 0; i < callbacks.size(); ++i)
952 callbacks[i].Run(profile, status); 965 callbacks[i].Run(profile, status);
953 } 966 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/ui/views/ash/app_list/app_list_view_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698