Add ability to gather metrics to BubbleManager.
[chromium-blink-merge.git] / chrome / browser / ui / webui / supervised_user_internals_message_handler.h
blob35574aa18bfe3c93223129474c6d17b698305004
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"
15 namespace base {
16 class ListValue;
17 } // namespace base
19 class SupervisedUserService;
21 // The implementation for the chrome://supervised-user-internals page.
22 class SupervisedUserInternalsMessageHandler
23 : public content::WebUIMessageHandler,
24 public SupervisedUserServiceObserver {
25 public:
26 SupervisedUserInternalsMessageHandler();
27 ~SupervisedUserInternalsMessageHandler() override;
29 private:
30 class IOThreadHelper;
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);
44 void SendBasicInfo();
45 void SendSupervisedUserSettings(const base::DictionaryValue* settings);
47 void OnTryURLResult(
48 SupervisedUserURLFilter::FilteringBehavior behavior,
49 SupervisedUserURLFilter::FilteringBehaviorReason reason,
50 bool uncertain);
52 void OnURLChecked(const GURL& url,
53 SupervisedUserURLFilter::FilteringBehavior behavior,
54 SupervisedUserURLFilter::FilteringBehaviorReason reason,
55 bool uncertain);
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_