Commit 490cbadc authored by Xi Cheng's avatar Xi Cheng Committed by Commit Bot

Fix passing activation information from startup to NotificationPlatformBridgeWin

This should fix the issue that notification activation is not working in some cases.

Bug: 734095, 821793
Change-Id: If19f1c802b7da3b1cd0476c0a585138a2d2edcaa
Reviewed-on: https://chromium-review.googlesource.com/963685Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Reviewed-by: default avatarTommy Martino <tmartino@chromium.org>
Commit-Queue: Xi Cheng <chengx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543461}
parent e1b5cb94
......@@ -739,19 +739,18 @@ void NotificationPlatformBridgeWin::SetReadyCallback(
}
// static
bool NotificationPlatformBridgeWin::HandleActivation() {
bool NotificationPlatformBridgeWin::HandleActivation(
const base::CommandLine& command_line) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
std::string launch_id_str =
command_line->GetSwitchValueASCII(switches::kNotificationLaunchId);
NotificationLaunchId launch_id(launch_id_str);
NotificationLaunchId launch_id(
command_line.GetSwitchValueASCII(switches::kNotificationLaunchId));
if (!launch_id.is_valid())
return false;
base::Optional<base::string16> reply;
base::string16 inline_reply =
command_line->GetSwitchValueNative(switches::kNotificationInlineReply);
command_line.GetSwitchValueNative(switches::kNotificationInlineReply);
if (!inline_reply.empty())
reply = inline_reply;
......
......@@ -14,6 +14,10 @@
#include "base/sequenced_task_runner.h"
#include "chrome/browser/notifications/notification_platform_bridge.h"
namespace base {
class CommandLine;
}
class NotificationPlatformBridgeWinImpl;
class NotificationTemplateBuilder;
......@@ -38,9 +42,11 @@ class NotificationPlatformBridgeWin : public NotificationPlatformBridge {
const GetDisplayedNotificationsCallback& callback) const override;
void SetReadyCallback(NotificationBridgeReadyCallback callback) override;
// Handles notification activation from the notification_helper process.
// Returns false if the launch id, passed via the command line, is invalid.
static bool HandleActivation();
// Handles notification activation encoded in |command_line| from the
// notification_helper process.
// Returns false if |command_line| does not contain a valid
// notification-launch-id switch.
static bool HandleActivation(const base::CommandLine& command_line);
// Extracts the profile ID from |launch_id_str|.
static std::string GetProfileIdFromLaunchId(const std::string& launch_id_str);
......
......@@ -399,7 +399,7 @@ bool StartupBrowserCreatorImpl::Launch(Profile* profile,
// Launch() call is from notification_helper.exe to process toast activation.
// Delegate to the notification system; do not open a browser window here.
if (command_line_.HasSwitch(switches::kNotificationLaunchId)) {
if (NotificationPlatformBridgeWin::HandleActivation()) {
if (NotificationPlatformBridgeWin::HandleActivation(command_line_)) {
RecordLaunchModeHistogram(LM_WIN_PLATFORM_NOTIFICATION);
return true;
}
......
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