| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ui/webui/supervised_user_internals_message_handler.h" | 5 #include "chrome/browser/ui/webui/supervised_user_internals_message_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 case supervised_user_error_page::DEFAULT: | 98 case supervised_user_error_page::DEFAULT: |
| 99 return "Default"; | 99 return "Default"; |
| 100 case supervised_user_error_page::ASYNC_CHECKER: | 100 case supervised_user_error_page::ASYNC_CHECKER: |
| 101 return "AsyncChecker"; | 101 return "AsyncChecker"; |
| 102 case supervised_user_error_page::BLACKLIST: | 102 case supervised_user_error_page::BLACKLIST: |
| 103 return "Blacklist"; | 103 return "Blacklist"; |
| 104 case supervised_user_error_page::MANUAL: | 104 case supervised_user_error_page::MANUAL: |
| 105 return "Manual"; | 105 return "Manual"; |
| 106 case supervised_user_error_page::WHITELIST: | 106 case supervised_user_error_page::WHITELIST: |
| 107 return "Whitelist"; | 107 return "Whitelist"; |
| 108 case supervised_user_error_page::NOT_SIGNED_IN: |
| 109 // Should never happen, only used for requests from WebView |
| 110 NOTREACHED(); |
| 108 } | 111 } |
| 109 return "Unknown/invalid"; | 112 return "Unknown/invalid"; |
| 110 } | 113 } |
| 111 | 114 |
| 112 } // namespace | 115 } // namespace |
| 113 | 116 |
| 114 // Helper class that lives on the IO thread, listens to the | 117 // Helper class that lives on the IO thread, listens to the |
| 115 // SupervisedUserURLFilter there, and posts results back to the UI thread. | 118 // SupervisedUserURLFilter there, and posts results back to the UI thread. |
| 116 class SupervisedUserInternalsMessageHandler::IOThreadHelper | 119 class SupervisedUserInternalsMessageHandler::IOThreadHelper |
| 117 : public base::RefCountedThreadSafe<IOThreadHelper, | 120 : public base::RefCountedThreadSafe<IOThreadHelper, |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 supervised_user_error_page::FilteringBehaviorReason reason, | 333 supervised_user_error_page::FilteringBehaviorReason reason, |
| 331 bool uncertain) { | 334 bool uncertain) { |
| 332 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 335 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 333 base::DictionaryValue result; | 336 base::DictionaryValue result; |
| 334 result.SetString("url", url.possibly_invalid_spec()); | 337 result.SetString("url", url.possibly_invalid_spec()); |
| 335 result.SetString("result", FilteringBehaviorToString(behavior, uncertain)); | 338 result.SetString("result", FilteringBehaviorToString(behavior, uncertain)); |
| 336 result.SetString("reason", FilteringBehaviorReasonToString(reason)); | 339 result.SetString("reason", FilteringBehaviorReasonToString(reason)); |
| 337 web_ui()->CallJavascriptFunctionUnsafe( | 340 web_ui()->CallJavascriptFunctionUnsafe( |
| 338 "chrome.supervised_user_internals.receiveFilteringResult", result); | 341 "chrome.supervised_user_internals.receiveFilteringResult", result); |
| 339 } | 342 } |
| OLD | NEW |