diff options
21 files changed, 149 insertions, 78 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index eef9057..f8398cb 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -71,7 +71,6 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/worker_host/worker_process_host.h" -#include "content/common/desktop_notification_messages.h" #include "content/public/browser/browser_main_parts.h" #include "grit/generated_resources.h" #include "grit/ui_resources.h" @@ -911,7 +910,7 @@ WebKit::WebNotificationPresenter::Permission } void ChromeContentBrowserClient::ShowDesktopNotification( - const DesktopNotificationHostMsg_Show_Params& params, + const content::ShowDesktopNotificationHostMsgParams& params, int render_process_id, int render_view_id, bool worker) { diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 2366fe3..50aed5d 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -104,7 +104,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { const content::ResourceContext& context, int render_process_id) OVERRIDE; virtual void ShowDesktopNotification( - const DesktopNotificationHostMsg_Show_Params& params, + const content::ShowDesktopNotificationHostMsgParams& params, int render_process_id, int render_view_id, bool worker) OVERRIDE; diff --git a/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc b/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc index 68cafc9..90625bb 100644 --- a/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc +++ b/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc @@ -8,7 +8,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/pref_service.h" -#include "content/common/desktop_notification_messages.h" +#include "content/public/common/show_desktop_notification_params.h" using content::BrowserThread; @@ -96,9 +96,9 @@ void DesktopNotificationsTest::TearDown() { profile_.reset(NULL); } -DesktopNotificationHostMsg_Show_Params +content::ShowDesktopNotificationHostMsgParams DesktopNotificationsTest::StandardTestNotification() { - DesktopNotificationHostMsg_Show_Params params; + content::ShowDesktopNotificationHostMsgParams params; params.notification_id = 0; params.origin = GURL("http://www.google.com"); params.is_html = false; @@ -110,7 +110,8 @@ DesktopNotificationsTest::StandardTestNotification() { } TEST_F(DesktopNotificationsTest, TestShow) { - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); params.notification_id = 1; EXPECT_TRUE(service_->ShowDesktopNotification( params, 0, 0, DesktopNotificationService::PageNotification)); @@ -118,7 +119,7 @@ TEST_F(DesktopNotificationsTest, TestShow) { MessageLoopForUI::current()->RunAllPending(); EXPECT_EQ(1, balloon_collection_->count()); - DesktopNotificationHostMsg_Show_Params params2; + content::ShowDesktopNotificationHostMsgParams params2; params2.origin = GURL("http://www.google.com"); params2.is_html = true; params2.contents_url = GURL("http://www.google.com/notification.html"); @@ -135,7 +136,8 @@ TEST_F(DesktopNotificationsTest, TestShow) { } TEST_F(DesktopNotificationsTest, TestClose) { - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); params.notification_id = 1; // Request a notification; should open a balloon. @@ -164,7 +166,8 @@ TEST_F(DesktopNotificationsTest, TestCancel) { int route_id = 0; int notification_id = 1; - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); params.notification_id = notification_id; // Request a notification; should open a balloon. @@ -195,7 +198,8 @@ TEST_F(DesktopNotificationsTest, TestManyNotifications) { const int kLotsOfToasts = 20; for (int id = 1; id <= kLotsOfToasts; ++id) { SCOPED_TRACE(base::StringPrintf("Creation loop: id=%d", id)); - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); params.notification_id = id; EXPECT_TRUE(service_->ShowDesktopNotification( params, process_id, route_id, @@ -256,7 +260,8 @@ TEST_F(DesktopNotificationsTest, TestEarlyDestruction) { TEST_F(DesktopNotificationsTest, TestUserInputEscaping) { // Create a test script with some HTML; assert that it doesn't get into the // data:// URL that's produced for the balloon. - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); params.title = ASCIIToUTF16("<script>window.alert('uh oh');</script>"); params.body = ASCIIToUTF16("<i>this text is in italics</i>"); params.notification_id = 1; diff --git a/chrome/browser/chromeos/notifications/desktop_notifications_unittest.h b/chrome/browser/chromeos/notifications/desktop_notifications_unittest.h index 498ad31..94372fd 100644 --- a/chrome/browser/chromeos/notifications/desktop_notifications_unittest.h +++ b/chrome/browser/chromeos/notifications/desktop_notifications_unittest.h @@ -24,7 +24,9 @@ #include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -struct DesktopNotificationHostMsg_Show_Params; +namespace content { +struct ShowDesktopNotificationHostMsgParams; +} namespace chromeos { @@ -86,7 +88,7 @@ class DesktopNotificationsTest : public testing::Test { } // Constructs a notification parameter structure for use in tests. - DesktopNotificationHostMsg_Show_Params StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams StandardTestNotification(); // Create a message loop to allow notifications code to post tasks, // and a thread so that notifications code runs on the expected thread. diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index dd8e23d..c9d144d 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -31,9 +31,9 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/site_instance.h" #include "content/browser/worker_host/worker_process_host.h" -#include "content/common/desktop_notification_messages.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" +#include "content/public/common/show_desktop_notification_params.h" #include "grit/browser_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -386,7 +386,7 @@ bool DesktopNotificationService::CancelDesktopNotification( } bool DesktopNotificationService::ShowDesktopNotification( - const DesktopNotificationHostMsg_Show_Params& params, + const content::ShowDesktopNotificationHostMsgParams& params, int process_id, int route_id, DesktopNotificationSource source) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); const GURL& origin = params.origin; diff --git a/chrome/browser/notifications/desktop_notification_service.h b/chrome/browser/notifications/desktop_notification_service.h index 7dcd133..2ae0c4b 100644 --- a/chrome/browser/notifications/desktop_notification_service.h +++ b/chrome/browser/notifications/desktop_notification_service.h @@ -30,7 +30,10 @@ class NotificationUIManager; class PrefService; class Profile; class TabContents; -struct DesktopNotificationHostMsg_Show_Params; + +namespace content { +struct ShowDesktopNotificationHostMsgParams; +} // The DesktopNotificationService is an object, owned by the Profile, // which provides the creation of desktop "toasts" to web pages and workers. @@ -65,7 +68,7 @@ class DesktopNotificationService : public content::NotificationObserver, // whether the script is in a worker or page. |params| contains all the // other parameters supplied by the worker or page. bool ShowDesktopNotification( - const DesktopNotificationHostMsg_Show_Params& params, + const content::ShowDesktopNotificationHostMsgParams& params, int process_id, int route_id, DesktopNotificationSource source); // Cancels a notification. If it has already been shown, it will be diff --git a/chrome/browser/notifications/desktop_notifications_unittest.cc b/chrome/browser/notifications/desktop_notifications_unittest.cc index 028cd87..b3470cd 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.cc +++ b/chrome/browser/notifications/desktop_notifications_unittest.cc @@ -9,7 +9,7 @@ #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service.h" -#include "content/common/desktop_notification_messages.h" +#include "content/public/common/show_desktop_notification_params.h" using content::BrowserThread; @@ -99,9 +99,9 @@ void DesktopNotificationsTest::TearDown() { profile_.reset(NULL); } -DesktopNotificationHostMsg_Show_Params +content::ShowDesktopNotificationHostMsgParams DesktopNotificationsTest::StandardTestNotification() { - DesktopNotificationHostMsg_Show_Params params; + content::ShowDesktopNotificationHostMsgParams params; params.notification_id = 0; params.origin = GURL("http://www.google.com"); params.is_html = false; @@ -113,7 +113,8 @@ DesktopNotificationsTest::StandardTestNotification() { } TEST_F(DesktopNotificationsTest, TestShow) { - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); params.notification_id = 1; EXPECT_TRUE(service_->ShowDesktopNotification( @@ -121,7 +122,7 @@ TEST_F(DesktopNotificationsTest, TestShow) { MessageLoopForUI::current()->RunAllPending(); EXPECT_EQ(1, balloon_collection_->count()); - DesktopNotificationHostMsg_Show_Params params2; + content::ShowDesktopNotificationHostMsgParams params2; params2.origin = GURL("http://www.google.com"); params2.is_html = true; params2.contents_url = GURL("http://www.google.com/notification.html"); @@ -138,7 +139,8 @@ TEST_F(DesktopNotificationsTest, TestShow) { } TEST_F(DesktopNotificationsTest, TestClose) { - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); params.notification_id = 1; // Request a notification; should open a balloon. @@ -162,7 +164,8 @@ TEST_F(DesktopNotificationsTest, TestCancel) { int route_id = 0; int notification_id = 1; - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); params.notification_id = notification_id; // Request a notification; should open a balloon. @@ -187,7 +190,8 @@ TEST_F(DesktopNotificationsTest, TestCancel) { #if defined(OS_WIN) || defined(TOOLKIT_VIEWS) TEST_F(DesktopNotificationsTest, TestPositioning) { - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); std::string expected_log; // Create some toasts. After each but the first, make sure there // is a minimum separation between the toasts. @@ -207,7 +211,7 @@ TEST_F(DesktopNotificationsTest, TestPositioning) { } TEST_F(DesktopNotificationsTest, TestVariableSize) { - DesktopNotificationHostMsg_Show_Params params; + content::ShowDesktopNotificationHostMsgParams params; params.origin = GURL("http://long.google.com"); params.is_html = false; params.icon_url = GURL("/icon.png"); @@ -254,7 +258,8 @@ TEST_F(DesktopNotificationsTest, TestQueueing) { int route_id = 0; // Request lots of identical notifications. - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); const int kLotsOfToasts = 20; for (int id = 1; id <= kLotsOfToasts; ++id) { params.notification_id = id; @@ -308,7 +313,8 @@ TEST_F(DesktopNotificationsTest, TestQueueing) { TEST_F(DesktopNotificationsTest, TestEarlyDestruction) { // Create some toasts and then prematurely delete the notification service, // just to make sure nothing crashes/leaks. - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); for (int id = 0; id <= 3; ++id) { params.notification_id = id; EXPECT_TRUE(service_->ShowDesktopNotification( @@ -320,7 +326,8 @@ TEST_F(DesktopNotificationsTest, TestEarlyDestruction) { TEST_F(DesktopNotificationsTest, TestUserInputEscaping) { // Create a test script with some HTML; assert that it doesn't get into the // data:// URL that's produced for the balloon. - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); params.title = ASCIIToUTF16("<script>window.alert('uh oh');</script>"); params.body = ASCIIToUTF16("<i>this text is in italics</i>"); params.notification_id = 1; @@ -340,7 +347,8 @@ TEST_F(DesktopNotificationsTest, TestUserInputEscaping) { TEST_F(DesktopNotificationsTest, TestBoundingBox) { // Create some notifications. - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); for (int id = 0; id <= 3; ++id) { params.notification_id = id; EXPECT_TRUE(service_->ShowDesktopNotification( @@ -377,7 +385,8 @@ TEST_F(DesktopNotificationsTest, TestPositionPreference) { BalloonCollection::LOWER_RIGHT); // Create some notifications. - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); for (int id = 0; id <= 3; ++id) { params.notification_id = id; EXPECT_TRUE(service_->ShowDesktopNotification( diff --git a/chrome/browser/notifications/desktop_notifications_unittest.h b/chrome/browser/notifications/desktop_notifications_unittest.h index 44c64f8..646511b 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.h +++ b/chrome/browser/notifications/desktop_notifications_unittest.h @@ -91,7 +91,7 @@ class DesktopNotificationsTest : public testing::Test { } // Constructs a notification parameter structure for use in tests. - DesktopNotificationHostMsg_Show_Params StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams StandardTestNotification(); // Create a message loop to allow notifications code to post tasks, // and a thread so that notifications code runs on the expected thread. diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc index 8b146be..7a74259 100644 --- a/chrome/browser/ui/panels/panel_browsertest.cc +++ b/chrome/browser/ui/panels/panel_browsertest.cc @@ -1608,8 +1608,8 @@ class PanelAndNotificationTest : public PanelBrowserTest { PanelBrowserTest::CleanUpOnMainThread(); } - DesktopNotificationHostMsg_Show_Params StandardTestNotification() { - DesktopNotificationHostMsg_Show_Params params; + content::ShowDesktopNotificationHostMsgParams StandardTestNotification() { + content::ShowDesktopNotificationHostMsgParams params; params.notification_id = 0; params.origin = GURL("http://www.google.com"); params.is_html = false; @@ -1648,7 +1648,8 @@ IN_PROC_BROWSER_TEST_F(PanelAndNotificationTest, NoOverlapping) { const int kShortPanelHeight = 150; const int kTallPanelHeight = 200; - DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); + content::ShowDesktopNotificationHostMsgParams params = + StandardTestNotification(); EXPECT_TRUE(service()->ShowDesktopNotification( params, 0, 0, DesktopNotificationService::PageNotification)); MessageLoopForUI::current()->RunAllPending(); diff --git a/content/browser/mock_content_browser_client.cc b/content/browser/mock_content_browser_client.cc index c36e92a..8af17b3 100644 --- a/content/browser/mock_content_browser_client.cc +++ b/content/browser/mock_content_browser_client.cc @@ -211,7 +211,7 @@ WebKit::WebNotificationPresenter::Permission } void MockContentBrowserClient::ShowDesktopNotification( - const DesktopNotificationHostMsg_Show_Params& params, + const content::ShowDesktopNotificationHostMsgParams& params, int render_process_id, int render_view_id, bool worker) { diff --git a/content/browser/mock_content_browser_client.h b/content/browser/mock_content_browser_client.h index e8cb53d..cdc8406 100644 --- a/content/browser/mock_content_browser_client.h +++ b/content/browser/mock_content_browser_client.h @@ -111,7 +111,7 @@ class MockContentBrowserClient : public ContentBrowserClient { const content::ResourceContext& context, int render_process_id) OVERRIDE; virtual void ShowDesktopNotification( - const DesktopNotificationHostMsg_Show_Params& params, + const content::ShowDesktopNotificationHostMsgParams& params, int render_process_id, int render_view_id, bool worker) OVERRIDE; diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index 2228aaf..7e9dc10 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -1457,7 +1457,7 @@ void RenderViewHost::OnRequestDesktopNotificationPermission( } void RenderViewHost::OnShowDesktopNotification( - const DesktopNotificationHostMsg_Show_Params& params) { + const content::ShowDesktopNotificationHostMsgParams& params) { // Disallow HTML notifications from javascript: and file: schemes as this // allows unwanted cross-domain access. GURL url = params.contents_url; diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h index aba2240..5adbd58 100644 --- a/content/browser/renderer_host/render_view_host.h +++ b/content/browser/renderer_host/render_view_host.h @@ -28,22 +28,21 @@ #include "webkit/glue/window_open_disposition.h" class ChildProcessSecurityPolicy; -struct ContextMenuParams; -struct DesktopNotificationHostMsg_Show_Params; class FilePath; class GURL; -struct MediaPlayerAction; class PowerSaveBlocker; class RenderViewHostDelegate; class RenderViewHostObserver; class SessionStorageNamespace; class SiteInstance; class SkBitmap; +class ViewMsg_Navigate; +struct ContextMenuParams; +struct MediaPlayerAction; struct ViewHostMsg_AccessibilityNotification_Params; struct ViewHostMsg_CreateWindow_Params; struct ViewHostMsg_RunFileChooser_Params; struct ViewHostMsg_ShowPopup_Params; -class ViewMsg_Navigate; struct ViewMsg_Navigate_Params; struct ViewMsg_StopFinding_Params; struct WebDropData; @@ -53,6 +52,10 @@ namespace base { class ListValue; } +namespace content { +struct ShowDesktopNotificationHostMsgParams; +} + namespace gfx { class Point; } // namespace gfx @@ -573,7 +576,7 @@ class CONTENT_EXPORT RenderViewHost : public RenderWidgetHost { void OnRequestDesktopNotificationPermission(const GURL& origin, int callback_id); void OnShowDesktopNotification( - const DesktopNotificationHostMsg_Show_Params& params); + const content::ShowDesktopNotificationHostMsgParams& params); void OnCancelDesktopNotification(int notification_id); void OnRunFileChooser(const ViewHostMsg_RunFileChooser_Params& params); diff --git a/content/common/desktop_notification_messages.h b/content/common/desktop_notification_messages.h index cc4f127..562c22b 100644 --- a/content/common/desktop_notification_messages.h +++ b/content/common/desktop_notification_messages.h @@ -5,37 +5,22 @@ // IPC messages for desktop notification. // Multiply-included message file, hence no include guard. +#include "content/public/common/show_desktop_notification_params.h" #include "ipc/ipc_message_macros.h" -#include "googleurl/src/gurl.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" #define IPC_MESSAGE_START DesktopNotificationMsgStart -IPC_STRUCT_BEGIN(DesktopNotificationHostMsg_Show_Params) - // URL which is the origin that created this notification. - IPC_STRUCT_MEMBER(GURL, origin) - - // True if this is HTML - IPC_STRUCT_MEMBER(bool, is_html) - - // URL which contains the HTML contents (if is_html is true), otherwise empty. - IPC_STRUCT_MEMBER(GURL, contents_url) - - // Contents of the notification if is_html is false. - IPC_STRUCT_MEMBER(GURL, icon_url) - IPC_STRUCT_MEMBER(string16, title) - IPC_STRUCT_MEMBER(string16, body) - - // Directionality of the notification. - IPC_STRUCT_MEMBER(WebKit::WebTextDirection, direction) - - // ReplaceID if this notification should replace an existing one) may be - // empty if no replacement is called for. - IPC_STRUCT_MEMBER(string16, replace_id) - - // Notification ID for sending events back for this notification. - IPC_STRUCT_MEMBER(int, notification_id) -IPC_STRUCT_END() +IPC_STRUCT_TRAITS_BEGIN(content::ShowDesktopNotificationHostMsgParams) + IPC_STRUCT_TRAITS_MEMBER(origin) + IPC_STRUCT_TRAITS_MEMBER(is_html) + IPC_STRUCT_TRAITS_MEMBER(contents_url) + IPC_STRUCT_TRAITS_MEMBER(icon_url) + IPC_STRUCT_TRAITS_MEMBER(title) + IPC_STRUCT_TRAITS_MEMBER(body) + IPC_STRUCT_TRAITS_MEMBER(direction) + IPC_STRUCT_TRAITS_MEMBER(replace_id) + IPC_STRUCT_TRAITS_MEMBER(notification_id) +IPC_STRUCT_TRAITS_END() // Messages sent from the browser to the renderer. @@ -66,7 +51,7 @@ IPC_MESSAGE_ROUTED1(DesktopNotificationMsg_PermissionRequestDone, // Messages sent from the renderer to the browser. IPC_MESSAGE_ROUTED1(DesktopNotificationHostMsg_Show, - DesktopNotificationHostMsg_Show_Params) + content::ShowDesktopNotificationHostMsgParams) IPC_MESSAGE_ROUTED1(DesktopNotificationHostMsg_Cancel, int /* notification_id */) diff --git a/content/content_common.gypi b/content/content_common.gypi index a061c25f..9e9ca78 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -55,6 +55,8 @@ 'public/common/security_style.h', 'public/common/serialized_script_value.cc', 'public/common/serialized_script_value.h', + 'public/common/show_desktop_notification_params.cc', + 'public/common/show_desktop_notification_params.h', 'public/common/url_constants.cc', 'public/common/url_constants.h', 'public/common/url_fetcher.h', diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index 6ab3c87..bc4c32a 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -36,12 +36,12 @@ class SkBitmap; class TabContents; class TabContentsView; class WorkerProcessHost; -struct DesktopNotificationHostMsg_Show_Params; struct WebPreferences; namespace content { class BrowserMainParts; struct MainFunctionParams; +struct ShowDesktopNotificationHostMsgParams; } namespace crypto { @@ -278,7 +278,7 @@ class ContentBrowserClient { // Show a desktop notification. If |worker| is true, the request came from an // HTML5 web worker, otherwise, it came from a renderer. virtual void ShowDesktopNotification( - const DesktopNotificationHostMsg_Show_Params& params, + const content::ShowDesktopNotificationHostMsgParams& params, int render_process_id, int render_view_id, bool worker) = 0; diff --git a/content/public/common/show_desktop_notification_params.cc b/content/public/common/show_desktop_notification_params.cc new file mode 100644 index 0000000..e93f7cc --- /dev/null +++ b/content/public/common/show_desktop_notification_params.cc @@ -0,0 +1,16 @@ +// Copyright (c) 2011 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 "content/public/common/show_desktop_notification_params.h" + +namespace content { + +ShowDesktopNotificationHostMsgParams::ShowDesktopNotificationHostMsgParams() + : is_html(false), notification_id(0) { +} + +ShowDesktopNotificationHostMsgParams::~ShowDesktopNotificationHostMsgParams() { +} + +} // namespace content diff --git a/content/public/common/show_desktop_notification_params.h b/content/public/common/show_desktop_notification_params.h new file mode 100644 index 0000000..2f19079 --- /dev/null +++ b/content/public/common/show_desktop_notification_params.h @@ -0,0 +1,46 @@ +// Copyright (c) 2011 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 CONTENT_PUBLIC_COMMON_SHOW_DESKTOP_NOTIFICATION_PARAMS_H_ +#define CONTENT_PUBLIC_COMMON_SHOW_DESKTOP_NOTIFICATION_PARAMS_H_ +#pragma once + +#include "googleurl/src/gurl.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" + +namespace content { + +// Parameters used when showing an HTML5 notification. +struct ShowDesktopNotificationHostMsgParams { + ShowDesktopNotificationHostMsgParams(); + ~ShowDesktopNotificationHostMsgParams(); + + // URL which is the origin that created this notification. + GURL origin; + + // True if this is HTML + bool is_html; + + // URL which contains the HTML contents (if is_html is true), otherwise empty. + GURL contents_url; + + // Contents of the notification if is_html is false. + GURL icon_url; + string16 title; + string16 body; + + // Directionality of the notification. + WebKit::WebTextDirection direction; + + // ReplaceID if this notification should replace an existing one; may be + // empty if no replacement is called for. + string16 replace_id; + + // Notification ID for sending events back for this notification. + int notification_id; +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_COMMON_SHOW_DESKTOP_NOTIFICATION_PARAMS_H_ diff --git a/content/renderer/notification_provider.cc b/content/renderer/notification_provider.cc index 7bf733f..337d7cc 100644 --- a/content/renderer/notification_provider.cc +++ b/content/renderer/notification_provider.cc @@ -100,7 +100,7 @@ bool NotificationProvider::OnMessageReceived(const IPC::Message& message) { bool NotificationProvider::ShowHTML(const WebNotification& notification, int id) { DCHECK(notification.isHTML()); - DesktopNotificationHostMsg_Show_Params params; + content::ShowDesktopNotificationHostMsgParams params; WebDocument document = render_view()->GetWebView()->mainFrame()->document(); params.origin = GURL(document.securityOrigin().toString()); params.is_html = true; @@ -113,7 +113,7 @@ bool NotificationProvider::ShowHTML(const WebNotification& notification, bool NotificationProvider::ShowText(const WebNotification& notification, int id) { DCHECK(!notification.isHTML()); - DesktopNotificationHostMsg_Show_Params params; + content::ShowDesktopNotificationHostMsgParams params; params.is_html = false; WebDocument document = render_view()->GetWebView()->mainFrame()->document(); params.origin = GURL(document.securityOrigin().toString()); diff --git a/content/shell/shell_content_browser_client.cc b/content/shell/shell_content_browser_client.cc index 74ff4aa..923b780 100644 --- a/content/shell/shell_content_browser_client.cc +++ b/content/shell/shell_content_browser_client.cc @@ -226,7 +226,7 @@ WebKit::WebNotificationPresenter::Permission } void ShellContentBrowserClient::ShowDesktopNotification( - const DesktopNotificationHostMsg_Show_Params& params, + const content::ShowDesktopNotificationHostMsgParams& params, int render_process_id, int render_view_id, bool worker) { diff --git a/content/shell/shell_content_browser_client.h b/content/shell/shell_content_browser_client.h index 3c60622..1fde62a 100644 --- a/content/shell/shell_content_browser_client.h +++ b/content/shell/shell_content_browser_client.h @@ -124,7 +124,7 @@ class ShellContentBrowserClient : public ContentBrowserClient const content::ResourceContext& context, int render_process_id) OVERRIDE; virtual void ShowDesktopNotification( - const DesktopNotificationHostMsg_Show_Params& params, + const content::ShowDesktopNotificationHostMsgParams& params, int render_process_id, int render_view_id, bool worker) OVERRIDE; |