| 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/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 } | 260 } |
| 261 } else { | 261 } else { |
| 262 request_sent_message = l10n_util::GetStringFUTF16( | 262 request_sent_message = l10n_util::GetStringFUTF16( |
| 263 IDS_BLOCK_INTERSTITIAL_REQUEST_SENT_MESSAGE, custodian); | 263 IDS_BLOCK_INTERSTITIAL_REQUEST_SENT_MESSAGE, custodian); |
| 264 request_failed_message = l10n_util::GetStringFUTF16( | 264 request_failed_message = l10n_util::GetStringFUTF16( |
| 265 IDS_BLOCK_INTERSTITIAL_REQUEST_FAILED_MESSAGE, custodian); | 265 IDS_BLOCK_INTERSTITIAL_REQUEST_FAILED_MESSAGE, custodian); |
| 266 } | 266 } |
| 267 strings.SetString("requestSentMessage", request_sent_message); | 267 strings.SetString("requestSentMessage", request_sent_message); |
| 268 strings.SetString("requestFailedMessage", request_failed_message); | 268 strings.SetString("requestFailedMessage", request_failed_message); |
| 269 | 269 |
| 270 webui::SetFontAndTextDirection(&strings); | 270 webui::SetTextDirection(&strings); |
| 271 | 271 |
| 272 base::StringPiece html(ResourceBundle::GetSharedInstance().GetRawDataResource( | 272 std::string html = |
| 273 IDR_SUPERVISED_USER_BLOCK_INTERSTITIAL_HTML)); | 273 ResourceBundle::GetSharedInstance() |
| 274 .GetRawDataResource(IDR_SUPERVISED_USER_BLOCK_INTERSTITIAL_HTML) |
| 275 .as_string(); |
| 276 webui::AppendWebUiCssTextDefaults(&html); |
| 274 | 277 |
| 275 return webui::GetI18nTemplateHtml(html, &strings); | 278 return webui::GetI18nTemplateHtml(html, &strings); |
| 276 } | 279 } |
| 277 | 280 |
| 278 void SupervisedUserInterstitial::CommandReceived(const std::string& command) { | 281 void SupervisedUserInterstitial::CommandReceived(const std::string& command) { |
| 279 // For use in histograms. | 282 // For use in histograms. |
| 280 enum Commands { | 283 enum Commands { |
| 281 PREVIEW, | 284 PREVIEW, |
| 282 BACK, | 285 BACK, |
| 283 NTP, | 286 NTP, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 SupervisedUserServiceFactory::GetForProfile(profile_); | 383 SupervisedUserServiceFactory::GetForProfile(profile_); |
| 381 supervised_user_service->RemoveObserver(this); | 384 supervised_user_service->RemoveObserver(this); |
| 382 | 385 |
| 383 BrowserThread::PostTask( | 386 BrowserThread::PostTask( |
| 384 BrowserThread::IO, FROM_HERE, base::Bind(callback_, continue_request)); | 387 BrowserThread::IO, FROM_HERE, base::Bind(callback_, continue_request)); |
| 385 | 388 |
| 386 // After this, the WebContents may be destroyed. Make sure we don't try to use | 389 // After this, the WebContents may be destroyed. Make sure we don't try to use |
| 387 // it again. | 390 // it again. |
| 388 web_contents_ = NULL; | 391 web_contents_ = NULL; |
| 389 } | 392 } |
| OLD | NEW |