Chromium Code Reviews| Index: chrome/browser/supervised_user/supervised_user_interstitial.cc |
| diff --git a/chrome/browser/supervised_user/supervised_user_interstitial.cc b/chrome/browser/supervised_user/supervised_user_interstitial.cc |
| index 84dbe66db813077b9652bc545ca4aa7afbfda4a7..1a3207bc26d036d65667a36c9525bbc73da64f15 100644 |
| --- a/chrome/browser/supervised_user/supervised_user_interstitial.cc |
| +++ b/chrome/browser/supervised_user/supervised_user_interstitial.cc |
| @@ -23,6 +23,8 @@ |
| #include "content/public/browser/navigation_controller.h" |
| #include "content/public/browser/navigation_details.h" |
| #include "content/public/browser/navigation_entry.h" |
| +#include "content/public/browser/render_frame_host.h" |
| +#include "content/public/browser/render_view_host.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_contents_user_data.h" |
| #include "content/public/browser/web_ui.h" |
| @@ -229,17 +231,24 @@ std::string SupervisedUserInterstitial::GetHTMLContents() { |
| ? IDS_CHILD_BLOCK_INTERSTITIAL_REQUEST_ACCESS_BUTTON |
| : IDS_BLOCK_INTERSTITIAL_REQUEST_ACCESS_BUTTON)); |
| - base::string16 request_sent_message; |
| + base::string16 request_sent_message, request_failed_message; |
|
Bernhard Bauer
2014/12/17 17:05:18
Declare each variable on its own line.
khannan
2014/12/17 17:39:09
Done.
|
| if (is_child_account) { |
| request_sent_message = l10n_util::GetStringUTF16( |
| second_custodian.empty() |
| ? IDS_CHILD_BLOCK_INTERSTITIAL_REQUEST_SENT_MESSAGE_SINGLE_PARENT |
| : IDS_CHILD_BLOCK_INTERSTITIAL_REQUEST_SENT_MESSAGE_MULTI_PARENT); |
| + request_failed_message = l10n_util::GetStringUTF16( |
|
Bernhard Bauer
2014/12/17 17:05:18
I think it starts making sense to add another case
khannan
2014/12/17 17:39:09
Done.
|
| + second_custodian.empty() |
| + ? IDS_CHILD_BLOCK_INTERSTITIAL_REQUEST_FAILED_MESSAGE_SINGLE_PARENT |
| + : IDS_CHILD_BLOCK_INTERSTITIAL_REQUEST_FAILED_MESSAGE_MULTI_PARENT); |
| } else { |
| request_sent_message = l10n_util::GetStringFUTF16( |
| IDS_BLOCK_INTERSTITIAL_REQUEST_SENT_MESSAGE, custodian); |
| + request_failed_message = l10n_util::GetStringFUTF16( |
| + IDS_BLOCK_INTERSTITIAL_REQUEST_FAILED_MESSAGE, custodian); |
| } |
| strings.SetString("requestSentMessage", request_sent_message); |
| + strings.SetString("requestFailedMessage", request_failed_message); |
| webui::SetFontAndTextDirection(&strings); |
| @@ -303,11 +312,14 @@ void SupervisedUserInterstitial::OnURLFilterChanged() { |
| } |
| void SupervisedUserInterstitial::OnAccessRequestAdded(bool success) { |
| - // TODO(akuegel): Figure out how to show the result of issuing the permission |
| - // request in the UI. Currently, we assume the permission request was created |
| - // successfully. |
| VLOG(1) << "Sent access request for " << url_.spec() |
| << (success ? " successfully" : " unsuccessfully"); |
| + std::stringstream jsFunc; |
|
Bernhard Bauer
2014/12/17 17:05:18
Don't use string streams. Just concatenate the str
khannan
2014/12/17 17:39:09
Done.
|
| + jsFunc << "requestStatus(" << success << ");"; |
| + interstitial_page_->GetRenderViewHostForTesting() |
|
Bernhard Bauer
2014/12/17 17:05:18
I assume you are going to ensure this method will
khannan
2014/12/17 17:39:09
Yes.
|
| + ->GetMainFrame() |
| + ->ExecuteJavaScript(base::ASCIIToUTF16(jsFunc.str())); |
| + VLOG(1) << "Executed: " + jsFunc.str(); |
|
Bernhard Bauer
2014/12/17 17:05:18
I don't think this log statement is going to be us
khannan
2014/12/17 17:39:09
Yup. Test code.
|
| } |
| bool SupervisedUserInterstitial::ShouldProceed() { |