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" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/infobars/infobar_service.h" | 15 #include "chrome/browser/infobars/infobar_service.h" |
15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/supervised_user/supervised_user_service.h" | 17 #include "chrome/browser/supervised_user/supervised_user_service.h" |
17 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 18 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
18 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
19 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
20 #include "components/infobars/core/infobar.h" | 21 #include "components/infobars/core/infobar.h" |
21 #include "components/infobars/core/infobar_delegate.h" | 22 #include "components/infobars/core/infobar_delegate.h" |
22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/browser/interstitial_page.h" | 24 #include "content/public/browser/interstitial_page.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 261 } |
261 } else { | 262 } else { |
262 request_sent_message = l10n_util::GetStringFUTF16( | 263 request_sent_message = l10n_util::GetStringFUTF16( |
263 IDS_BLOCK_INTERSTITIAL_REQUEST_SENT_MESSAGE, custodian); | 264 IDS_BLOCK_INTERSTITIAL_REQUEST_SENT_MESSAGE, custodian); |
264 request_failed_message = l10n_util::GetStringFUTF16( | 265 request_failed_message = l10n_util::GetStringFUTF16( |
265 IDS_BLOCK_INTERSTITIAL_REQUEST_FAILED_MESSAGE, custodian); | 266 IDS_BLOCK_INTERSTITIAL_REQUEST_FAILED_MESSAGE, custodian); |
266 } | 267 } |
267 strings.SetString("requestSentMessage", request_sent_message); | 268 strings.SetString("requestSentMessage", request_sent_message); |
268 strings.SetString("requestFailedMessage", request_failed_message); | 269 strings.SetString("requestFailedMessage", request_failed_message); |
269 | 270 |
270 webui::SetFontAndTextDirection(&strings); | 271 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
| 272 webui::SetLoadTimeDataDefaults(app_locale, &strings); |
271 | 273 |
272 std::string html = | 274 std::string html = |
273 ResourceBundle::GetSharedInstance() | 275 ResourceBundle::GetSharedInstance() |
274 .GetRawDataResource(IDR_SUPERVISED_USER_BLOCK_INTERSTITIAL_HTML) | 276 .GetRawDataResource(IDR_SUPERVISED_USER_BLOCK_INTERSTITIAL_HTML) |
275 .as_string(); | 277 .as_string(); |
276 webui::AppendWebUiCssTextDefaults(&html); | 278 webui::AppendWebUiCssTextDefaults(&html); |
277 | 279 |
278 return webui::GetI18nTemplateHtml(html, &strings); | 280 return webui::GetI18nTemplateHtml(html, &strings); |
279 } | 281 } |
280 | 282 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 SupervisedUserServiceFactory::GetForProfile(profile_); | 385 SupervisedUserServiceFactory::GetForProfile(profile_); |
384 supervised_user_service->RemoveObserver(this); | 386 supervised_user_service->RemoveObserver(this); |
385 | 387 |
386 BrowserThread::PostTask( | 388 BrowserThread::PostTask( |
387 BrowserThread::IO, FROM_HERE, base::Bind(callback_, continue_request)); | 389 BrowserThread::IO, FROM_HERE, base::Bind(callback_, continue_request)); |
388 | 390 |
389 // After this, the WebContents may be destroyed. Make sure we don't try to use | 391 // After this, the WebContents may be destroyed. Make sure we don't try to use |
390 // it again. | 392 // it again. |
391 web_contents_ = NULL; | 393 web_contents_ = NULL; |
392 } | 394 } |
OLD | NEW |