Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised_user/supervised_user_interstitial.h" | 5 #include "chrome/browser/supervised_user/supervised_user_interstitial.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 l10n_util::GetStringUTF16(IDS_BLOCK_INTERSTITIAL_TITLE)); | 141 l10n_util::GetStringUTF16(IDS_BLOCK_INTERSTITIAL_TITLE)); |
| 142 | 142 |
| 143 Profile* profile = | 143 Profile* profile = |
| 144 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 144 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 145 SupervisedUserService* supervised_user_service = | 145 SupervisedUserService* supervised_user_service = |
| 146 SupervisedUserServiceFactory::GetForProfile(profile); | 146 SupervisedUserServiceFactory::GetForProfile(profile); |
| 147 | 147 |
| 148 bool allow_access_requests = supervised_user_service->AccessRequestsEnabled(); | 148 bool allow_access_requests = supervised_user_service->AccessRequestsEnabled(); |
| 149 strings.SetBoolean("allowAccessRequests", allow_access_requests); | 149 strings.SetBoolean("allowAccessRequests", allow_access_requests); |
| 150 | 150 |
| 151 GURL profile_url = GURL(profile->GetPrefs()->GetString( | 151 GURL profile_url = GURL(profile->GetPrefs()->GetString( |
|
Bernhard Bauer
2014/08/21 14:48:46
Could we rename this to base_url, now that it migh
Marc Treib
2014/08/21 15:59:08
Done.
| |
| 152 prefs::kSupervisedUserCustodianProfileURL)); | 152 prefs::kSupervisedUserCustodianProfileURL)); |
| 153 if (!profile_url.is_valid()) | |
| 154 profile_url = GURL("https://dummy.url"); | |
| 155 DCHECK(profile_url.is_valid()); | |
| 153 std::string profile_image_url = profile->GetPrefs()->GetString( | 156 std::string profile_image_url = profile->GetPrefs()->GetString( |
| 154 prefs::kSupervisedUserCustodianProfileImageURL); | 157 prefs::kSupervisedUserCustodianProfileImageURL); |
| 155 strings.SetString("avatarURL1x", BuildAvatarImageUrl(profile_image_url, | 158 strings.SetString("avatarURL1x", BuildAvatarImageUrl(profile_image_url, |
| 156 profile_url, | 159 profile_url, |
| 157 kAvatarSize1x)); | 160 kAvatarSize1x)); |
| 158 strings.SetString("avatarURL2x", BuildAvatarImageUrl(profile_image_url, | 161 strings.SetString("avatarURL2x", BuildAvatarImageUrl(profile_image_url, |
| 159 profile_url, | 162 profile_url, |
| 160 kAvatarSize2x)); | 163 kAvatarSize2x)); |
| 161 | 164 |
| 162 GURL profile_url2 = GURL(profile->GetPrefs()->GetString( | 165 GURL profile_url2 = GURL(profile->GetPrefs()->GetString( |
| 163 prefs::kSupervisedUserSecondCustodianProfileURL)); | 166 prefs::kSupervisedUserSecondCustodianProfileURL)); |
| 167 if (!profile_url2.is_valid()) | |
| 168 profile_url2 = GURL("https://dummy.url"); | |
| 169 DCHECK(profile_url2.is_valid()); | |
| 164 std::string profile_image_url2 = profile->GetPrefs()->GetString( | 170 std::string profile_image_url2 = profile->GetPrefs()->GetString( |
| 165 prefs::kSupervisedUserSecondCustodianProfileImageURL); | 171 prefs::kSupervisedUserSecondCustodianProfileImageURL); |
| 166 strings.SetString("secondAvatarURL1x", BuildAvatarImageUrl(profile_image_url2, | 172 strings.SetString("secondAvatarURL1x", BuildAvatarImageUrl(profile_image_url2, |
| 167 profile_url2, | 173 profile_url2, |
| 168 kAvatarSize1x)); | 174 kAvatarSize1x)); |
| 169 strings.SetString("secondAvatarURL2x", BuildAvatarImageUrl(profile_image_url2, | 175 strings.SetString("secondAvatarURL2x", BuildAvatarImageUrl(profile_image_url2, |
| 170 profile_url2, | 176 profile_url2, |
| 171 kAvatarSize2x)); | 177 kAvatarSize2x)); |
| 172 | 178 |
| 173 base::string16 custodian = | 179 base::string16 custodian = |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 265 void SupervisedUserInterstitial::DispatchContinueRequest( | 271 void SupervisedUserInterstitial::DispatchContinueRequest( |
| 266 bool continue_request) { | 272 bool continue_request) { |
| 267 // If there is no history entry to go back to, close the tab instead. | 273 // If there is no history entry to go back to, close the tab instead. |
| 268 int nav_entry_count = web_contents_->GetController().GetEntryCount(); | 274 int nav_entry_count = web_contents_->GetController().GetEntryCount(); |
| 269 if (!continue_request && nav_entry_count == 0) | 275 if (!continue_request && nav_entry_count == 0) |
| 270 web_contents_->Close(); | 276 web_contents_->Close(); |
| 271 | 277 |
| 272 BrowserThread::PostTask( | 278 BrowserThread::PostTask( |
| 273 BrowserThread::IO, FROM_HERE, base::Bind(callback_, continue_request)); | 279 BrowserThread::IO, FROM_HERE, base::Bind(callback_, continue_request)); |
| 274 } | 280 } |
| OLD | NEW |