Commit 6f4884c0 authored by Xi Cheng's avatar Xi Cheng Committed by Commit Bot

Reorder methods in notification_platform_bridge_win.{h,cc}

Bug: 734095
Change-Id: Ied49badaccb894dc7f7637d855788d79ec7c79df
Reviewed-on: https://chromium-review.googlesource.com/920362Reviewed-by: default avatarFinnur Thorarinsson <finnur@chromium.org>
Commit-Queue: Xi Cheng <chengx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537327}
parent 89beef67
...@@ -752,6 +752,12 @@ void NotificationPlatformBridgeWin::SetReadyCallback( ...@@ -752,6 +752,12 @@ void NotificationPlatformBridgeWin::SetReadyCallback(
impl_, base::Passed(&callback))); impl_, base::Passed(&callback)));
} }
void NotificationPlatformBridgeWin::PostTaskToTaskRunnerThread(
base::OnceClosure closure) const {
bool success = task_runner_->PostTask(FROM_HERE, std::move(closure));
DCHECK(success);
}
void NotificationPlatformBridgeWin::ForwardHandleEventForTesting( void NotificationPlatformBridgeWin::ForwardHandleEventForTesting(
NotificationCommon::Operation operation, NotificationCommon::Operation operation,
winui::Notifications::IToastNotification* notification, winui::Notifications::IToastNotification* notification,
...@@ -769,6 +775,15 @@ void NotificationPlatformBridgeWin::SetDisplayedNotificationsForTesting( ...@@ -769,6 +775,15 @@ void NotificationPlatformBridgeWin::SetDisplayedNotificationsForTesting(
NotificationPlatformBridgeWinImpl::notifications_for_testing_ = notifications; NotificationPlatformBridgeWinImpl::notifications_for_testing_ = notifications;
} }
HRESULT NotificationPlatformBridgeWin::GetToastNotificationForTesting(
const message_center::Notification& notification,
const NotificationTemplateBuilder& notification_template_builder,
winui::Notifications::IToastNotification** toast_notification) {
return impl_->GetToastNotification(
notification, notification_template_builder, "UnusedValue",
false /* incognito */, toast_notification);
}
// static // static
bool NotificationPlatformBridgeWin::DecodeTemplateId( bool NotificationPlatformBridgeWin::DecodeTemplateId(
const std::string& encoded, const std::string& encoded,
...@@ -826,18 +841,3 @@ std::string NotificationPlatformBridgeWin::EncodeTemplateId( ...@@ -826,18 +841,3 @@ std::string NotificationPlatformBridgeWin::EncodeTemplateId(
"%d|%s|%d|%s|%s", static_cast<int>(notification_type), profile_id.c_str(), "%d|%s|%d|%s|%s", static_cast<int>(notification_type), profile_id.c_str(),
incognito, origin_url.spec().c_str(), notification_id.c_str()); incognito, origin_url.spec().c_str(), notification_id.c_str());
} }
void NotificationPlatformBridgeWin::PostTaskToTaskRunnerThread(
base::OnceClosure closure) const {
bool success = task_runner_->PostTask(FROM_HERE, std::move(closure));
DCHECK(success);
}
HRESULT NotificationPlatformBridgeWin::GetToastNotificationForTesting(
const message_center::Notification& notification,
const NotificationTemplateBuilder& notification_template_builder,
winui::Notifications::IToastNotification** toast_notification) {
return impl_->GetToastNotification(
notification, notification_template_builder, "UnusedValue",
false /* incognito */, toast_notification);
}
...@@ -46,6 +46,8 @@ class NotificationPlatformBridgeWin : public NotificationPlatformBridge { ...@@ -46,6 +46,8 @@ class NotificationPlatformBridgeWin : public NotificationPlatformBridge {
FRIEND_TEST_ALL_PREFIXES(NotificationPlatformBridgeWinUITest, GetDisplayed); FRIEND_TEST_ALL_PREFIXES(NotificationPlatformBridgeWinUITest, GetDisplayed);
FRIEND_TEST_ALL_PREFIXES(NotificationPlatformBridgeWinUITest, HandleEvent); FRIEND_TEST_ALL_PREFIXES(NotificationPlatformBridgeWinUITest, HandleEvent);
void PostTaskToTaskRunnerThread(base::OnceClosure closure) const;
// Simulates a click/dismiss event. Only for use in testing. // Simulates a click/dismiss event. Only for use in testing.
// Note: Ownership of |notification| and |args| is retained by the caller. // Note: Ownership of |notification| and |args| is retained by the caller.
void ForwardHandleEventForTesting( void ForwardHandleEventForTesting(
...@@ -59,6 +61,13 @@ class NotificationPlatformBridgeWin : public NotificationPlatformBridge { ...@@ -59,6 +61,13 @@ class NotificationPlatformBridgeWin : public NotificationPlatformBridge {
std::vector<ABI::Windows::UI::Notifications::IToastNotification*>* std::vector<ABI::Windows::UI::Notifications::IToastNotification*>*
notifications); notifications);
// Obtain an IToastNotification interface from a given XML (provided by the
// NotificationTemplateBuilder). For testing use only.
HRESULT GetToastNotificationForTesting(
const message_center::Notification& notification,
const NotificationTemplateBuilder& notification_template_builder,
ABI::Windows::UI::Notifications::IToastNotification** toast_notification);
// Takes an |encoded| string as input and decodes it, returning the values in // Takes an |encoded| string as input and decodes it, returning the values in
// the out parameters. |encoded| and |notifiation_id| must be provided. Other // the out parameters. |encoded| and |notifiation_id| must be provided. Other
// pointers can be nullptr. Returns true if successful, but false otherwise. // pointers can be nullptr. Returns true if successful, but false otherwise.
...@@ -77,15 +86,6 @@ class NotificationPlatformBridgeWin : public NotificationPlatformBridge { ...@@ -77,15 +86,6 @@ class NotificationPlatformBridgeWin : public NotificationPlatformBridge {
bool incognito, bool incognito,
const GURL& origin_url); const GURL& origin_url);
// Obtain an IToastNotification interface from a given XML (provided by the
// NotificationTemplateBuilder). For testing use only.
HRESULT GetToastNotificationForTesting(
const message_center::Notification& notification,
const NotificationTemplateBuilder& notification_template_builder,
ABI::Windows::UI::Notifications::IToastNotification** toast_notification);
void PostTaskToTaskRunnerThread(base::OnceClosure closure) const;
scoped_refptr<NotificationPlatformBridgeWinImpl> impl_; scoped_refptr<NotificationPlatformBridgeWinImpl> impl_;
scoped_refptr<base::SequencedTaskRunner> task_runner_; scoped_refptr<base::SequencedTaskRunner> task_runner_;
......
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