Commit ccb65c00 authored by Xing Liu's avatar Xing Liu Committed by Commit Bot

Notification: Add chrome://notifications-internals web UI.

This CL adds chrome://notifications-internals, which can be served as
a place to debug notification related features.

Bug: 963289
Change-Id: Ib13d99c5acd9e6b5025c74d230ade98e1e2b6c47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1659690
Commit-Queue: Xing Liu <xingliu@chromium.org>
Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#670209}
parent 67f4fd19
...@@ -153,6 +153,10 @@ ...@@ -153,6 +153,10 @@
<include name="IDR_DOWNLOAD_INTERNALS_JS" file="resources\download_internals\download_internals.js" type="BINDATA" compress="gzip" /> <include name="IDR_DOWNLOAD_INTERNALS_JS" file="resources\download_internals\download_internals.js" type="BINDATA" compress="gzip" />
<include name="IDR_DOWNLOAD_INTERNALS_BROWSER_PROXY_JS" file="resources\download_internals\download_internals_browser_proxy.js" type="BINDATA" compress="gzip" /> <include name="IDR_DOWNLOAD_INTERNALS_BROWSER_PROXY_JS" file="resources\download_internals\download_internals_browser_proxy.js" type="BINDATA" compress="gzip" />
<include name="IDR_DOWNLOAD_INTERNALS_VISUALS_JS" file="resources\download_internals\download_internals_visuals.js" type="BINDATA" compress="gzip" /> <include name="IDR_DOWNLOAD_INTERNALS_VISUALS_JS" file="resources\download_internals\download_internals_visuals.js" type="BINDATA" compress="gzip" />
<include name="IDR_NOTIFICATIONS_INTERNALS_HTML" file="resources\notifications_internals\notifications_internals.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_NOTIFICATIONS_INTERNALS_CSS" file="resources\notifications_internals\notifications_internals.css" type="BINDATA" compress="gzip" />
<include name="IDR_NOTIFICATIONS_INTERNALS_JS" file="resources\notifications_internals\notifications_internals.js" type="BINDATA" compress="gzip" />
<include name="IDR_NOTIFICATIONS_INTERNALS_BROWSER_PROXY_JS" file="resources\notifications_internals\notifications_internals_browser_proxy.js" type="BINDATA" compress="gzip" />
<include name="IDR_UKM_INTERNALS_HTML" file="../../components/ukm/debug/ukm_internals.html" flattenhtml="true" allowexternalscript="true" compress="gzip" type="BINDATA" /> <include name="IDR_UKM_INTERNALS_HTML" file="../../components/ukm/debug/ukm_internals.html" flattenhtml="true" allowexternalscript="true" compress="gzip" type="BINDATA" />
<include name="IDR_UKM_INTERNALS_JS" file="../../components/ukm/debug/ukm_internals.js" flattenhtml="true" compress="gzip" type="BINDATA" /> <include name="IDR_UKM_INTERNALS_JS" file="../../components/ukm/debug/ukm_internals.js" flattenhtml="true" compress="gzip" type="BINDATA" />
<include name="IDR_UKM_INTERNALS_CSS" file="../../components/ukm/debug/ukm_internals.css" flattenhtml="true" compress="gzip" type="BINDATA" /> <include name="IDR_UKM_INTERNALS_CSS" file="../../components/ukm/debug/ukm_internals.css" flattenhtml="true" compress="gzip" type="BINDATA" />
......
...@@ -16,6 +16,7 @@ enum SchedulerClientType { ...@@ -16,6 +16,7 @@ enum SchedulerClientType {
TEST_2 = -2; TEST_2 = -2;
TEST_3 = -3; TEST_3 = -3;
UNKNOWN = 0; UNKNOWN = 0;
WEBUI = 1;
} }
// Contains details about supression and recovery after suppression expired. // Contains details about supression and recovery after suppression expired.
......
dtrainor@chromium.org dtrainor@chromium.org
xingliu@chromium.org xingliu@chromium.org
\ No newline at end of file
# COMPONENT: UI>Notifications
...@@ -55,6 +55,8 @@ source_set("lib") { ...@@ -55,6 +55,8 @@ source_set("lib") {
"scheduler_config.h", "scheduler_config.h",
"scheduler_utils.cc", "scheduler_utils.cc",
"scheduler_utils.h", "scheduler_utils.h",
"webui_client.cc",
"webui_client.h",
] ]
# This target should not depend on anything in //chrome/* except the proto library. # This target should not depend on anything in //chrome/* except the proto library.
......
...@@ -31,6 +31,8 @@ std::string ToDatabaseKey(SchedulerClientType type) { ...@@ -31,6 +31,8 @@ std::string ToDatabaseKey(SchedulerClientType type) {
case SchedulerClientType::kUnknown: case SchedulerClientType::kUnknown:
NOTREACHED(); NOTREACHED();
return std::string(); return std::string();
case SchedulerClientType::kWebUI:
return "WebUI";
} }
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/notifications/scheduler/internal/notification_scheduler_context.h" #include "chrome/browser/notifications/scheduler/internal/notification_scheduler_context.h"
#include <memory>
#include <utility> #include <utility>
#include "base/time/default_clock.h" #include "base/time/default_clock.h"
...@@ -13,7 +14,9 @@ ...@@ -13,7 +14,9 @@
#include "chrome/browser/notifications/scheduler/internal/impression_history_tracker.h" #include "chrome/browser/notifications/scheduler/internal/impression_history_tracker.h"
#include "chrome/browser/notifications/scheduler/internal/scheduled_notification_manager.h" #include "chrome/browser/notifications/scheduler/internal/scheduled_notification_manager.h"
#include "chrome/browser/notifications/scheduler/internal/scheduler_config.h" #include "chrome/browser/notifications/scheduler/internal/scheduler_config.h"
#include "chrome/browser/notifications/scheduler/internal/webui_client.h"
#include "chrome/browser/notifications/scheduler/public/notification_background_task_scheduler.h" #include "chrome/browser/notifications/scheduler/public/notification_background_task_scheduler.h"
#include "chrome/browser/notifications/scheduler/public/notification_scheduler_client.h"
#include "chrome/browser/notifications/scheduler/public/notification_scheduler_client_registrar.h" #include "chrome/browser/notifications/scheduler/public/notification_scheduler_client_registrar.h"
namespace notifications { namespace notifications {
...@@ -34,7 +37,10 @@ NotificationSchedulerContext::NotificationSchedulerContext( ...@@ -34,7 +37,10 @@ NotificationSchedulerContext::NotificationSchedulerContext(
background_task_coordinator_(std::make_unique<BackgroundTaskCoordinator>( background_task_coordinator_(std::make_unique<BackgroundTaskCoordinator>(
std::move(background_task), std::move(background_task),
config_.get(), config_.get(),
base::DefaultClock::GetInstance())) {} base::DefaultClock::GetInstance())) {
client_registrar_->RegisterClient(SchedulerClientType::kWebUI,
std::make_unique<WebUIClient>());
}
NotificationSchedulerContext::~NotificationSchedulerContext() = default; NotificationSchedulerContext::~NotificationSchedulerContext() = default;
......
...@@ -49,6 +49,8 @@ proto::SchedulerClientType ToSchedulerClientType(SchedulerClientType type) { ...@@ -49,6 +49,8 @@ proto::SchedulerClientType ToSchedulerClientType(SchedulerClientType type) {
return proto::SchedulerClientType::TEST_3; return proto::SchedulerClientType::TEST_3;
case SchedulerClientType::kUnknown: case SchedulerClientType::kUnknown:
return proto::SchedulerClientType::UNKNOWN; return proto::SchedulerClientType::UNKNOWN;
case SchedulerClientType::kWebUI:
return proto::SchedulerClientType::WEBUI;
} }
NOTREACHED(); NOTREACHED();
} }
...@@ -65,6 +67,8 @@ SchedulerClientType FromSchedulerClientType( ...@@ -65,6 +67,8 @@ SchedulerClientType FromSchedulerClientType(
return SchedulerClientType::kTest3; return SchedulerClientType::kTest3;
case proto::SchedulerClientType::UNKNOWN: case proto::SchedulerClientType::UNKNOWN:
return SchedulerClientType::kUnknown; return SchedulerClientType::kUnknown;
case proto::SchedulerClientType::WEBUI:
return SchedulerClientType::kWebUI;
} }
NOTREACHED(); NOTREACHED();
} }
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/notifications/scheduler/internal/webui_client.h"
#include "base/logging.h"
namespace notifications {
WebUIClient::WebUIClient() = default;
WebUIClient::~WebUIClient() = default;
void WebUIClient::ShowNotification(std::unique_ptr<DisplayData> display_data,
DisplayCallback callback) {
NOTIMPLEMENTED();
}
void WebUIClient::OnSchedulerInitialized(bool success,
std::set<std::string> guids) {
NOTIMPLEMENTED();
}
void WebUIClient::OnUserAction(UserActionType action_type,
const std::string& notification_id,
base::Optional<ButtonClickInfo> button_info) {
NOTIMPLEMENTED();
}
} // namespace notifications
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_NOTIFICATIONS_SCHEDULER_INTERNAL_WEBUI_CLIENT_H_
#define CHROME_BROWSER_NOTIFICATIONS_SCHEDULER_INTERNAL_WEBUI_CLIENT_H_
#include <memory>
#include <set>
#include <string>
#include "chrome/browser/notifications/scheduler/public/notification_scheduler_client.h"
namespace notifications {
// The client used in chrome://notifications-internals for debugging purposes.
class WebUIClient : public NotificationSchedulerClient {
public:
WebUIClient();
~WebUIClient() override;
private:
// NotificationSchedulerClient implementation.
void ShowNotification(std::unique_ptr<DisplayData> display_data,
DisplayCallback callback) override;
void OnSchedulerInitialized(bool success,
std::set<std::string> guids) override;
void OnUserAction(UserActionType action_type,
const std::string& notification_id,
base::Optional<ButtonClickInfo> button_info) override;
DISALLOW_COPY_AND_ASSIGN(WebUIClient);
};
} // namespace notifications
#endif // CHROME_BROWSER_NOTIFICATIONS_SCHEDULER_INTERNAL_WEBUI_CLIENT_H_
...@@ -49,8 +49,8 @@ class NotificationSchedulerClient { ...@@ -49,8 +49,8 @@ class NotificationSchedulerClient {
using DisplayCallback = using DisplayCallback =
base::OnceCallback<void(std::unique_ptr<DisplayData>)>; base::OnceCallback<void(std::unique_ptr<DisplayData>)>;
NotificationSchedulerClient(); NotificationSchedulerClient() = default;
virtual ~NotificationSchedulerClient(); virtual ~NotificationSchedulerClient() = default;
// Called when the notification should be displayed to the user. The clients // Called when the notification should be displayed to the user. The clients
// can overwrite data in |display_data| and return the updated data in // can overwrite data in |display_data| and return the updated data in
......
...@@ -30,7 +30,9 @@ enum class SchedulerClientType { ...@@ -30,7 +30,9 @@ enum class SchedulerClientType {
// Default value of client type. // Default value of client type.
kUnknown = 0, kUnknown = 0,
kMaxValue = kUnknown // Client used in chrome://notifications-internals for debugging.
kWebUI = 1,
kMaxValue = kWebUI
}; };
// The type of user feedback from a displayed notification. // The type of user feedback from a displayed notification.
......
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
deps = [
":notifications_internals",
":notifications_internals_browser_proxy",
]
}
js_library("notifications_internals") {
deps = [
":notifications_internals_browser_proxy",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:util",
]
}
js_library("notifications_internals_browser_proxy") {
deps = [
"//ui/webui/resources/js:cr",
]
}
/* Copyright 2019 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. */
h1 {
color: rgb(74, 142, 230);
margin: 0;
padding: 0;
}
\ No newline at end of file
<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Notifications Internals</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="chrome://resources/css/list.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
<link rel="stylesheet" href="notifications_internals.css">
</head>
<body>
<h1>Notifications Internals</h1>
<h4>Notification Scheduler</h4>
<table id="notification-scheduler-request">
<tr>
<td>Url:</td>
<td>
<input id="notification-scheduler-url" type="url"
placeholder="http://www.example.com">
</td>
</tr>
<tr>
<td>Title:</td><td><input id="notification-scheduler-title"
type="text" placeholder="Notification title">
</td>
</tr>
<tr>
<td>Message:</td><td><input id="notification-scheduler-message"
type="text" placeholder="Notification message">
</td>
</tr>
</table>
<div>
<button id="schedule-notification">Schedule</button>
</div>
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://resources/js/promise_resolver.js"></script>
<script src="chrome://resources/js/util.js"></script>
<script src="notifications_internals_browser_proxy.js"></script>
<script src="notifications_internals.js"></script>
</body>
</html>
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
cr.define('notificationsInternals', function() {
'use strict';
const browserProxy =
notificationsInternals.NotificationsInternalsBrowserProxyImpl
.getInstance();
function initialize() {
// Register all event listeners.
$('schedule-notification').onclick = function() {
browserProxy.scheduleNotification(
$('notification-scheduler-url').value,
$('notification-scheduler-title').value,
$('notification-scheduler-message').value);
};
}
return {
initialize: initialize,
};
});
document.addEventListener(
'DOMContentLoaded', notificationsInternals.initialize);
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
cr.define('notificationsInternals', function() {
/** @interface */
class NotificationsInternalsBrowserProxy {
/**
* Schedules a notification through notification schedule service.
* @param {string} url URL to open after clicking the notification.
* @param {string} title Title of the notification.
* @param {string} message Message of the notification.
*/
scheduleNotification(url, title, message) {}
}
/**
* @implements {notificationsInternals.NotificationsInternalsBrowserProxy}
*/
class NotificationsInternalsBrowserProxyImpl {
/** @override */
scheduleNotification(url, title, message) {
return cr.sendWithPromise('scheduleNotification', url, title, message);
}
}
cr.addSingletonGetter(NotificationsInternalsBrowserProxyImpl);
return {
NotificationsInternalsBrowserProxy: NotificationsInternalsBrowserProxy,
NotificationsInternalsBrowserProxyImpl:
NotificationsInternalsBrowserProxyImpl
};
});
...@@ -269,6 +269,10 @@ jumbo_split_static_library("ui") { ...@@ -269,6 +269,10 @@ jumbo_split_static_library("ui") {
"webui/net_export_ui.h", "webui/net_export_ui.h",
"webui/net_internals/net_internals_ui.cc", "webui/net_internals/net_internals_ui.cc",
"webui/net_internals/net_internals_ui.h", "webui/net_internals/net_internals_ui.h",
"webui/notifications_internals/notifications_internals_ui.cc",
"webui/notifications_internals/notifications_internals_ui.h",
"webui/notifications_internals/notifications_internals_ui_message_handler.cc",
"webui/notifications_internals/notifications_internals_ui_message_handler.h",
"webui/ntp_tiles_internals_ui.cc", "webui/ntp_tiles_internals_ui.cc",
"webui/ntp_tiles_internals_ui.h", "webui/ntp_tiles_internals_ui.h",
"webui/omnibox/omnibox_page_handler.cc", "webui/omnibox/omnibox_page_handler.cc",
...@@ -387,6 +391,7 @@ jumbo_split_static_library("ui") { ...@@ -387,6 +391,7 @@ jumbo_split_static_library("ui") {
"//chrome/browser/devtools", "//chrome/browser/devtools",
"//chrome/browser/engagement:mojo_bindings", "//chrome/browser/engagement:mojo_bindings",
"//chrome/browser/media:mojo_bindings", "//chrome/browser/media:mojo_bindings",
"//chrome/browser/notifications/scheduler/public",
"//chrome/browser/profiling_host", "//chrome/browser/profiling_host",
"//chrome/browser/safe_browsing", "//chrome/browser/safe_browsing",
"//chrome/browser/ssl:proto", "//chrome/browser/ssl:proto",
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "chrome/browser/ui/webui/memory_internals_ui.h" #include "chrome/browser/ui/webui/memory_internals_ui.h"
#include "chrome/browser/ui/webui/net_export_ui.h" #include "chrome/browser/ui/webui/net_export_ui.h"
#include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h"
#include "chrome/browser/ui/webui/notifications_internals/notifications_internals_ui.h"
#include "chrome/browser/ui/webui/ntp_tiles_internals_ui.h" #include "chrome/browser/ui/webui/ntp_tiles_internals_ui.h"
#include "chrome/browser/ui/webui/omnibox/omnibox_ui.h" #include "chrome/browser/ui/webui/omnibox/omnibox_ui.h"
#include "chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.h" #include "chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.h"
...@@ -393,6 +394,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui, ...@@ -393,6 +394,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<NetExportUI>; return &NewWebUI<NetExportUI>;
if (url.host_piece() == chrome::kChromeUINetInternalsHost) if (url.host_piece() == chrome::kChromeUINetInternalsHost)
return &NewWebUI<NetInternalsUI>; return &NewWebUI<NetInternalsUI>;
if (url.host_piece() == chrome::kChromeUINotificationsInternalsHost)
return &NewWebUI<NotificationsInternalsUI>;
if (url.host_piece() == chrome::kChromeUINTPTilesInternalsHost) if (url.host_piece() == chrome::kChromeUINTPTilesInternalsHost)
return &NewWebUI<NTPTilesInternalsUI>; return &NewWebUI<NTPTilesInternalsUI>;
if (url.host_piece() == chrome::kChromeUIOmniboxHost) if (url.host_piece() == chrome::kChromeUIOmniboxHost)
......
file://chrome/browser/notifications/OWNERS
file://chrome/browser/notifications/scheduler/OWNERS
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/notifications_internals/notifications_internals_ui.h"
#include <memory>
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/notifications_internals/notifications_internals_ui_message_handler.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_data_source.h"
NotificationsInternalsUI::NotificationsInternalsUI(content::WebUI* web_ui)
: content::WebUIController(web_ui) {
content::WebUIDataSource* html_source = content::WebUIDataSource::Create(
chrome::kChromeUINotificationsInternalsHost);
html_source->AddResourcePath("notifications_internals.css",
IDR_NOTIFICATIONS_INTERNALS_CSS);
html_source->AddResourcePath("notifications_internals.js",
IDR_NOTIFICATIONS_INTERNALS_JS);
html_source->AddResourcePath("notifications_internals_browser_proxy.js",
IDR_NOTIFICATIONS_INTERNALS_BROWSER_PROXY_JS);
html_source->SetDefaultResource(IDR_NOTIFICATIONS_INTERNALS_HTML);
Profile* profile = Profile::FromWebUI(web_ui);
content::WebUIDataSource::Add(profile, html_source);
web_ui->AddMessageHandler(
std::make_unique<NotificationsInternalsUIMessageHandler>(profile));
}
NotificationsInternalsUI::~NotificationsInternalsUI() = default;
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_NOTIFICATIONS_INTERNALS_NOTIFICATIONS_INTERNALS_UI_H_
#define CHROME_BROWSER_UI_WEBUI_NOTIFICATIONS_INTERNALS_NOTIFICATIONS_INTERNALS_UI_H_
#include "base/macros.h"
#include "content/public/browser/web_ui_controller.h"
namespace content {
class WebUI;
} // namespace content
// The WebUI for chrome://notifications-internals.
class NotificationsInternalsUI : public content::WebUIController {
public:
explicit NotificationsInternalsUI(content::WebUI* web_ui);
~NotificationsInternalsUI() override;
private:
DISALLOW_COPY_AND_ASSIGN(NotificationsInternalsUI);
};
#endif // CHROME_BROWSER_UI_WEBUI_NOTIFICATIONS_INTERNALS_NOTIFICATIONS_INTERNALS_UI_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/notifications_internals/notifications_internals_ui_message_handler.h"
#include <memory>
#include <string>
#include <utility>
#include "base/bind.h"
#include "base/values.h"
#include "chrome/browser/notifications/scheduler/notification_schedule_service_factory.h"
#include "chrome/browser/notifications/scheduler/public/notification_params.h"
#include "chrome/browser/notifications/scheduler/public/notification_schedule_service.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/web_ui.h"
NotificationsInternalsUIMessageHandler::NotificationsInternalsUIMessageHandler(
Profile* profile)
: schedule_service_(
NotificationScheduleServiceFactory::GetForBrowserContext(profile)) {}
NotificationsInternalsUIMessageHandler::
~NotificationsInternalsUIMessageHandler() = default;
void NotificationsInternalsUIMessageHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback(
"scheduleNotification",
base::BindRepeating(
&NotificationsInternalsUIMessageHandler::HandleScheduleNotification,
base::Unretained(this)));
}
void NotificationsInternalsUIMessageHandler::HandleScheduleNotification(
const base::ListValue* args) {
CHECK_EQ(args->GetList().size(), 4u);
notifications::ScheduleParams schedule_params;
notifications::NotificationData data;
data.url = args->GetList()[1].GetString();
data.title = args->GetList()[2].GetString();
data.message = args->GetList()[3].GetString();
auto params = std::make_unique<notifications::NotificationParams>(
notifications::SchedulerClientType::kWebUI, std::move(data),
std::move(schedule_params));
schedule_service_->Schedule(std::move(params));
}
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_NOTIFICATIONS_INTERNALS_NOTIFICATIONS_INTERNALS_UI_MESSAGE_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_NOTIFICATIONS_INTERNALS_NOTIFICATIONS_INTERNALS_UI_MESSAGE_HANDLER_H_
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/web_ui_message_handler.h"
namespace base {
class ListValue;
} // namespace base
namespace notifications {
class NotificationScheduleService;
} // namespace notifications
class Profile;
// Routes html events to native notification systems in
// chrome://notifications-internals.
class NotificationsInternalsUIMessageHandler
: public content::WebUIMessageHandler {
public:
explicit NotificationsInternalsUIMessageHandler(Profile* profile);
~NotificationsInternalsUIMessageHandler() override;
// content::WebUIMessageHandler implementation.
void RegisterMessages() override;
private:
void HandleScheduleNotification(const base::ListValue* args);
notifications::NotificationScheduleService* schedule_service_;
DISALLOW_COPY_AND_ASSIGN(NotificationsInternalsUIMessageHandler);
};
#endif // CHROME_BROWSER_UI_WEBUI_NOTIFICATIONS_INTERNALS_NOTIFICATIONS_INTERNALS_UI_MESSAGE_HANDLER_H_
...@@ -107,6 +107,7 @@ const char kChromeUINetInternalsURL[] = "chrome://net-internals/"; ...@@ -107,6 +107,7 @@ const char kChromeUINetInternalsURL[] = "chrome://net-internals/";
const char kChromeUINewTabHost[] = "newtab"; const char kChromeUINewTabHost[] = "newtab";
const char kChromeUINewTabIconHost[] = "ntpicon"; const char kChromeUINewTabIconHost[] = "ntpicon";
const char kChromeUINewTabURL[] = "chrome://newtab/"; const char kChromeUINewTabURL[] = "chrome://newtab/";
const char kChromeUINotificationsInternalsHost[] = "notifications-internals";
const char kChromeUIOmniboxHost[] = "omnibox"; const char kChromeUIOmniboxHost[] = "omnibox";
const char kChromeUIOmniboxURL[] = "chrome://omnibox/"; const char kChromeUIOmniboxURL[] = "chrome://omnibox/";
const char kChromeUIPasswordManagerInternalsHost[] = const char kChromeUIPasswordManagerInternalsHost[] =
......
...@@ -112,6 +112,7 @@ extern const char kChromeUINetInternalsURL[]; ...@@ -112,6 +112,7 @@ extern const char kChromeUINetInternalsURL[];
extern const char kChromeUINewTabHost[]; extern const char kChromeUINewTabHost[];
extern const char kChromeUINewTabIconHost[]; extern const char kChromeUINewTabIconHost[];
extern const char kChromeUINewTabURL[]; extern const char kChromeUINewTabURL[];
extern const char kChromeUINotificationsInternalsHost[];
extern const char kChromeUIOfflineInternalsHost[]; extern const char kChromeUIOfflineInternalsHost[];
extern const char kChromeUIOmniboxHost[]; extern const char kChromeUIOmniboxHost[];
extern const char kChromeUIOmniboxURL[]; extern const char kChromeUIOmniboxURL[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment