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

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

Issue 566933005: Do not display lock for hosted domains (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 "chrome/browser/profiles/gaia_info_update_service.h" 5 #include "chrome/browser/profiles/gaia_info_update_service.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_info_cache.h" 12 #include "chrome/browser/profiles/profile_info_cache.h"
12 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/profiles/profiles_state.h"
13 #include "chrome/browser/signin/signin_manager_factory.h" 15 #include "chrome/browser/signin/signin_manager_factory.h"
14 #include "chrome/browser/sync/profile_sync_service.h" 16 #include "chrome/browser/sync/profile_sync_service.h"
15 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
16 #include "components/signin/core/common/profile_management_switches.h" 18 #include "components/signin/core/common/profile_management_switches.h"
17 #include "content/public/browser/notification_details.h" 19 #include "content/public/browser/notification_details.h"
18 #include "third_party/skia/include/core/SkBitmap.h" 20 #include "third_party/skia/include/core/SkBitmap.h"
19 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
20 22
21 namespace { 23 namespace {
22 24
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 DCHECK_NE(profile_index, std::string::npos); 130 DCHECK_NE(profile_index, std::string::npos);
129 131
130 if (picture_status == ProfileDownloader::PICTURE_SUCCESS) { 132 if (picture_status == ProfileDownloader::PICTURE_SUCCESS) {
131 profile_->GetPrefs()->SetString(prefs::kProfileGAIAInfoPictureURL, 133 profile_->GetPrefs()->SetString(prefs::kProfileGAIAInfoPictureURL,
132 picture_url); 134 picture_url);
133 gfx::Image gfx_image = gfx::Image::CreateFrom1xBitmap(bitmap); 135 gfx::Image gfx_image = gfx::Image::CreateFrom1xBitmap(bitmap);
134 cache.SetGAIAPictureOfProfileAtIndex(profile_index, &gfx_image); 136 cache.SetGAIAPictureOfProfileAtIndex(profile_index, &gfx_image);
135 } else if (picture_status == ProfileDownloader::PICTURE_DEFAULT) { 137 } else if (picture_status == ProfileDownloader::PICTURE_DEFAULT) {
136 cache.SetGAIAPictureOfProfileAtIndex(profile_index, NULL); 138 cache.SetGAIAPictureOfProfileAtIndex(profile_index, NULL);
137 } 139 }
140
141 base::string16 hosted_domain = downloader->GetProfileHostedDomain();
142 profile_->GetPrefs()->SetInteger(prefs::kProfileIsLockableVersion,
noms (inactive) 2014/09/12 19:33:25 You should add a comment that this only allows non
Mike Lerman 2014/09/15 14:08:55 Added the comment by the definition of the version
noms (inactive) 2014/09/15 18:52:40 Hmm, but the comment would be useful here as well.
Mike Lerman 2014/09/15 19:51:41 Hmm I wrote some wording I hope is good.
143 profiles::kCurrentLockAlgorithmVersion);
144 if (hosted_domain.empty() || hosted_domain == base::UTF8ToUTF16("google.com"))
145 profile_->GetPrefs()->SetBoolean(prefs::kProfileIsLockable, true);
146 else
147 profile_->GetPrefs()->SetBoolean(prefs::kProfileIsLockable, false);
noms (inactive) 2014/09/12 19:33:25 This could be profile_->GetPrefs()->SetBoolean(pr
Mike Lerman 2014/09/15 14:08:55 Ugh ternaries, so unreadable! Done :P
138 } 148 }
139 149
140 void GAIAInfoUpdateService::OnProfileDownloadFailure( 150 void GAIAInfoUpdateService::OnProfileDownloadFailure(
141 ProfileDownloader* downloader, 151 ProfileDownloader* downloader,
142 ProfileDownloaderDelegate::FailureReason reason) { 152 ProfileDownloaderDelegate::FailureReason reason) {
143 profile_image_downloader_.reset(); 153 profile_image_downloader_.reset();
144 154
145 // Save the last updated time. 155 // Save the last updated time.
146 last_updated_ = base::Time::Now(); 156 last_updated_ = base::Time::Now();
147 profile_->GetPrefs()->SetInt64(prefs::kProfileGAIAInfoUpdateTime, 157 profile_->GetPrefs()->SetInt64(prefs::kProfileGAIAInfoUpdateTime,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 const std::string& account_id, 217 const std::string& account_id,
208 const std::string& username, 218 const std::string& username,
209 const std::string& password) { 219 const std::string& password) {
210 OnUsernameChanged(username); 220 OnUsernameChanged(username);
211 } 221 }
212 222
213 void GAIAInfoUpdateService::GoogleSignedOut(const std::string& account_id, 223 void GAIAInfoUpdateService::GoogleSignedOut(const std::string& account_id,
214 const std::string& username) { 224 const std::string& username) {
215 OnUsernameChanged(std::string()); 225 OnUsernameChanged(std::string());
216 } 226 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile.cc » ('j') | chrome/browser/profiles/profile_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698