OLD | NEW |
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/managed_mode/managed_mode_interstitial.h" | 5 #include "chrome/browser/managed_mode/managed_mode_interstitial.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.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/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 web_contents, true, url_, this); | 45 web_contents, true, url_, this); |
46 interstitial_page_->Show(); | 46 interstitial_page_->Show(); |
47 } | 47 } |
48 | 48 |
49 ManagedModeInterstitial::~ManagedModeInterstitial() {} | 49 ManagedModeInterstitial::~ManagedModeInterstitial() {} |
50 | 50 |
51 std::string ManagedModeInterstitial::GetHTMLContents() { | 51 std::string ManagedModeInterstitial::GetHTMLContents() { |
52 DictionaryValue strings; | 52 DictionaryValue strings; |
53 strings.SetString("blockPageTitle", | 53 strings.SetString("blockPageTitle", |
54 l10n_util::GetStringUTF16(IDS_BLOCK_INTERSTITIAL_TITLE)); | 54 l10n_util::GetStringUTF16(IDS_BLOCK_INTERSTITIAL_TITLE)); |
55 strings.SetString("blockPageMessage", | 55 |
56 l10n_util::GetStringUTF16(IDS_BLOCK_INTERSTITIAL_MESSAGE)); | 56 Profile* profile = |
| 57 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 58 ManagedUserService* managed_user_service = |
| 59 ManagedUserServiceFactory::GetForProfile(profile); |
| 60 string16 custodian = UTF8ToUTF16(managed_user_service->GetCustodianName()); |
| 61 strings.SetString( |
| 62 "blockPageMessage", |
| 63 l10n_util::GetStringFUTF16(IDS_BLOCK_INTERSTITIAL_MESSAGE, custodian)); |
| 64 |
57 strings.SetString("backButton", l10n_util::GetStringUTF16(IDS_BACK_BUTTON)); | 65 strings.SetString("backButton", l10n_util::GetStringUTF16(IDS_BACK_BUTTON)); |
58 strings.SetString( | 66 strings.SetString( |
59 "requestAccessButton", | 67 "requestAccessButton", |
60 l10n_util::GetStringUTF16(IDS_BLOCK_INTERSTITIAL_REQUEST_ACCESS_BUTTON)); | 68 l10n_util::GetStringUTF16(IDS_BLOCK_INTERSTITIAL_REQUEST_ACCESS_BUTTON)); |
61 | 69 |
62 // TODO(sergiu): Set name to real value here. | |
63 std::string custodian_name("John Doe"); | |
64 strings.SetString( | 70 strings.SetString( |
65 "requestSentMessage", | 71 "requestSentMessage", |
66 l10n_util::GetStringFUTF16(IDS_BLOCK_INTERSTITIAL_REQUEST_SENT_MESSAGE, | 72 l10n_util::GetStringFUTF16(IDS_BLOCK_INTERSTITIAL_REQUEST_SENT_MESSAGE, |
67 ASCIIToUTF16(custodian_name))); | 73 custodian)); |
68 | 74 |
69 webui::SetFontAndTextDirection(&strings); | 75 webui::SetFontAndTextDirection(&strings); |
70 | 76 |
71 base::StringPiece html( | 77 base::StringPiece html( |
72 ResourceBundle::GetSharedInstance().GetRawDataResource( | 78 ResourceBundle::GetSharedInstance().GetRawDataResource( |
73 IDR_MANAGED_MODE_BLOCK_INTERSTITIAL_HTML)); | 79 IDR_MANAGED_MODE_BLOCK_INTERSTITIAL_HTML)); |
74 | 80 |
75 webui::UseVersion2 version; | 81 webui::UseVersion2 version; |
76 return webui::GetI18nTemplateHtml(html, &strings); | 82 return webui::GetI18nTemplateHtml(html, &strings); |
77 } | 83 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 123 } |
118 | 124 |
119 void ManagedModeInterstitial::OnDontProceed() { | 125 void ManagedModeInterstitial::OnDontProceed() { |
120 DispatchContinueRequest(false); | 126 DispatchContinueRequest(false); |
121 } | 127 } |
122 | 128 |
123 void ManagedModeInterstitial::DispatchContinueRequest(bool continue_request) { | 129 void ManagedModeInterstitial::DispatchContinueRequest(bool continue_request) { |
124 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 130 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
125 base::Bind(callback_, continue_request)); | 131 base::Bind(callback_, continue_request)); |
126 } | 132 } |
OLD | NEW |