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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_SUPERVISED_USER_INTERNALS_MESSAGE_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_SUPERVISED_USER_INTERNALS_MESSAGE_HANDLER_H_
8 #include "base/callback_list.h"
9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/supervised_user/supervised_user_service_observer.h"
12 #include "chrome/browser/supervised_user/supervised_user_url_filter.h"
13 #include "content/public/browser/web_ui_message_handler.h"
19 class SupervisedUserService
;
21 // The implementation for the chrome://supervised-user-internals page.
22 class SupervisedUserInternalsMessageHandler
23 : public content::WebUIMessageHandler
,
24 public SupervisedUserServiceObserver
{
26 SupervisedUserInternalsMessageHandler();
27 ~SupervisedUserInternalsMessageHandler() override
;
32 // content::WebUIMessageHandler:
33 void RegisterMessages() override
;
35 // SupervisedUserServiceObserver:
36 void OnURLFilterChanged() override
;
38 SupervisedUserService
* GetSupervisedUserService();
40 void HandleRegisterForEvents(const base::ListValue
* args
);
41 void HandleGetBasicInfo(const base::ListValue
* args
);
42 void HandleTryURL(const base::ListValue
* args
);
45 void SendSupervisedUserSettings(const base::DictionaryValue
* settings
);
48 SupervisedUserURLFilter::FilteringBehavior behavior
,
49 SupervisedUserURLFilter::FilteringBehaviorReason reason
,
52 void OnURLChecked(const GURL
& url
,
53 SupervisedUserURLFilter::FilteringBehavior behavior
,
54 SupervisedUserURLFilter::FilteringBehaviorReason reason
,
57 scoped_ptr
<base::CallbackList
<void(
58 const base::DictionaryValue
*)>::Subscription
> user_settings_subscription_
;
60 scoped_refptr
<IOThreadHelper
> io_thread_helper_
;
62 base::WeakPtrFactory
<SupervisedUserInternalsMessageHandler
> weak_factory_
;
64 DISALLOW_COPY_AND_ASSIGN(SupervisedUserInternalsMessageHandler
);
67 #endif // CHROME_BROWSER_UI_WEBUI_SUPERVISED_USER_INTERNALS_MESSAGE_HANDLER_H_