Commit 5e651a67 authored by Xing Liu's avatar Xing Liu Committed by Commit Bot

Notification: Setup code structure for notification scheduler.

All the notification scheduler code lives in
chrome/browser/notifications/scheduler.


Bug: 930968
Change-Id: Idfe8fd3ba7b3e8f3e9b295b2f4e8d7b14ce5df9a
Reviewed-on: https://chromium-review.googlesource.com/c/1464456
Commit-Queue: Xing Liu <xingliu@chromium.org>
Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632723}
parent dfb31870
......@@ -914,6 +914,10 @@ jumbo_split_static_library("browser") {
"notifications/persistent_notification_handler.h",
"notifications/platform_notification_service_impl.cc",
"notifications/platform_notification_service_impl.h",
"notifications/scheduler/notification_data.cc",
"notifications/scheduler/notification_data.h",
"notifications/scheduler/schedule_params.cc",
"notifications/scheduler/schedule_params.h",
"notifications/system_notification_helper.cc",
"notifications/system_notification_helper.h",
"ntp_snippets/bookmark_last_visit_updater.cc",
......
dtrainor@chromium.org
xingliu@chromium.org
\ No newline at end of file
// 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/notification_data.h"
#include "chrome/browser/notifications/scheduler/schedule_params.h"
NotificationData::NotificationData(
Type type,
std::unique_ptr<message_center::Notification> notification,
std::unique_ptr<ScheduleParams> schedule_params)
: type_(type),
notification_(std::move(notification)),
schedule_params_(std::move(schedule_params)) {}
NotificationData::~NotificationData() = 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_NOTIFICATIONS_SCHEDULER_NOTIFICATION_DATA_H_
#define CHROME_BROWSER_NOTIFICATIONS_SCHEDULER_NOTIFICATION_DATA_H_
#include <memory>
#include "base/macros.h"
#include "ui/message_center/public/cpp/notification.h"
struct ScheduleParams;
// Struct used to schedule a notification.
class NotificationData {
public:
enum class Type {
PLACE_HOLDER,
};
NotificationData(Type type,
std::unique_ptr<message_center::Notification> notification,
std::unique_ptr<ScheduleParams> schedule_params);
~NotificationData();
Type type() const { return type_; }
private:
Type type_;
// Notification data that the client can optionally choose to use when showing
// a notification. Client should only use this when the data is dynamically
// generated, such as URL to navigate when the user clicks the notification.
std::unique_ptr<message_center::Notification> notification_;
std::unique_ptr<ScheduleParams> schedule_params_;
DISALLOW_COPY_AND_ASSIGN(NotificationData);
};
#endif // CHROME_BROWSER_NOTIFICATIONS_SCHEDULER_NOTIFICATION_DATA_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/notifications/scheduler/schedule_params.h"
ScheduleParams::ScheduleParams() = default;
ScheduleParams::~ScheduleParams() = 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_NOTIFICATIONS_SCHEDULER_SCHEDULE_PARAMS_H_
#define CHROME_BROWSER_NOTIFICATIONS_SCHEDULER_SCHEDULE_PARAMS_H_
// Specifies when to show the scheduled notification, and throttling details.
struct ScheduleParams {
enum class Priority {
// No notification throttling logic is applied, every notification scheduled
// will be delivered.
NO_THROTTLE,
// Notification may be delivered if picked by display decision layer. Has
// higher chance to pick as the next notification to deliver than low
// priority.
HIGH,
// Notification may be delivered if picked by display decision layer. Most
// notification types should use this priority.
LOW,
};
ScheduleParams();
~ScheduleParams();
Priority priority;
};
#endif // CHROME_BROWSER_NOTIFICATIONS_SCHEDULER_SCHEDULE_PARAMS_H_
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