diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-12 01:59:17 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-12 01:59:17 +0000 |
commit | 0ee57e2fd0130dea13c030e340c41f72a36840a5 (patch) | |
tree | 979d3d25bfcc6733fde72f97f99cf53085e7733f /content | |
parent | 455a6168fdb26900460987080579734103c96f6e (diff) | |
download | chromium_src-0ee57e2fd0130dea13c030e340c41f72a36840a5.zip chromium_src-0ee57e2fd0130dea13c030e340c41f72a36840a5.tar.gz chromium_src-0ee57e2fd0130dea13c030e340c41f72a36840a5.tar.bz2 |
Move the struct used when showing a desktop notification to content/public/common, so that chrome code doesn't include desktop_notification_messages.h which is an internal detail of content.
BUG=98716
Review URL: http://codereview.chromium.org/8511075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109757 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/mock_content_browser_client.cc | 2 | ||||
-rw-r--r-- | content/browser/mock_content_browser_client.h | 2 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host.cc | 2 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host.h | 13 | ||||
-rw-r--r-- | content/common/desktop_notification_messages.h | 41 | ||||
-rw-r--r-- | content/content_common.gypi | 2 | ||||
-rw-r--r-- | content/public/browser/content_browser_client.h | 4 | ||||
-rw-r--r-- | content/public/common/show_desktop_notification_params.cc | 16 | ||||
-rw-r--r-- | content/public/common/show_desktop_notification_params.h | 46 | ||||
-rw-r--r-- | content/renderer/notification_provider.cc | 4 | ||||
-rw-r--r-- | content/shell/shell_content_browser_client.cc | 2 | ||||
-rw-r--r-- | content/shell/shell_content_browser_client.h | 2 |
12 files changed, 94 insertions, 42 deletions
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; |