Move NotificationContents into Notification
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Mar 2012 23:07:37 +0000 (23:07 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Mar 2012 23:07:37 +0000 (23:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=80487
<rdar://problem/10965519>

Reviewed by Jian Li.

Source/WebCore:

* notifications/Notification.cpp: Alter signature of constructor to take the fields directly instead of
a NotificationContents instance.
(WebCore::Notification::Notification): Derive KURL from string representation of icon.
(WebCore::Notification::create):
* notifications/Notification.h:
(Notification): Remove contents() accessor and replace with get for title and body. iconURL()
already existed, but use local variable instead of going through NotificationContents.
(WebCore::Notification::iconURL):
(WebCore::Notification::title):
(WebCore::Notification::body):
* notifications/NotificationCenter.h:
(WebCore::NotificationCenter::createNotification): Refactor to use new constructor.
* notifications/NotificationContents.h: Removed.

Remove NotificationContents.h from project files
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:

Source/WebKit/chromium:

Refactor to use accessor methods on Notification.
* src/WebNotification.cpp:
(WebKit::WebNotification::title):
(WebKit::WebNotification::body):

Source/WebKit/mac:

* WebView/WebNotification.mm: Refactor to use accessor methods on Notification.
(-[WebNotification title]):
(-[WebNotification body]):

Source/WebKit/qt:

Refactor to use accessor methods on Notification.
* WebCoreSupport/NotificationPresenterClientQt.cpp:
(WebCore::NotificationWrapper::title):
(WebCore::NotificationWrapper::message):
(WebCore::NotificationPresenterClientQt::displayNotification):
(WebCore::NotificationPresenterClientQt::cancel):
(WebCore::NotificationPresenterClientQt::notificationClicked):
(WebCore::NotificationPresenterClientQt::dumpReplacedIdText):
(WebCore::NotificationPresenterClientQt::dumpShowText):

Source/WebKit2:

* UIProcess/Notifications/WebNotificationManagerProxy.cpp: Remove extraneous include.
* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::show): Refactor to use accessor methods on Notification.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110903 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/notifications/Notification.cpp
Source/WebCore/notifications/Notification.h
Source/WebCore/notifications/NotificationCenter.h
Source/WebCore/notifications/NotificationContents.h [deleted file]
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebNotification.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebNotification.mm
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp
Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp

index c8f51da..ad7e511 100644 (file)
@@ -1,3 +1,32 @@
+2012-03-07  Jon Lee  <jonlee@apple.com>
+
+        Move NotificationContents into Notification
+        https://bugs.webkit.org/show_bug.cgi?id=80487
+        <rdar://problem/10965519>
+
+        Reviewed by Jian Li.
+
+        * notifications/Notification.cpp: Alter signature of constructor to take the fields directly instead of
+        a NotificationContents instance.
+        (WebCore::Notification::Notification): Derive KURL from string representation of icon.
+        (WebCore::Notification::create):
+        * notifications/Notification.h:
+        (Notification): Remove contents() accessor and replace with get for title and body. iconURL()
+        already existed, but use local variable instead of going through NotificationContents.
+        (WebCore::Notification::iconURL):
+        (WebCore::Notification::title):
+        (WebCore::Notification::body):
+        * notifications/NotificationCenter.h:
+        (WebCore::NotificationCenter::createNotification): Refactor to use new constructor.
+        * notifications/NotificationContents.h: Removed.
+
+        Remove NotificationContents.h from project files
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2012-03-13  Jon Lee  <jonlee@apple.com>
 
         Deprecate ondisplay()
index 9c039d8..070b87e 100644 (file)
@@ -2826,7 +2826,6 @@ webcore_sources += \
        Source/WebCore/notifications/NotificationCenter.cpp \
        Source/WebCore/notifications/NotificationCenter.h \
        Source/WebCore/notifications/NotificationClient.h \
-       Source/WebCore/notifications/NotificationContents.h \
        Source/WebCore/notifications/NotificationController.cpp \
        Source/WebCore/notifications/NotificationController.h \
        Source/WebCore/notifications/Notification.cpp \
index 063aa40..5875cfb 100644 (file)
@@ -2076,7 +2076,6 @@ HEADERS += \
     notifications/Notification.h \
     notifications/NotificationCenter.h \
     notifications/NotificationClient.h \
-    notifications/NotificationContents.h \
     notifications/NotificationController.h \
     page/animation/AnimationBase.h \
     page/animation/AnimationController.h \
index ba14133..0cb4fbb 100644 (file)
             'Modules/webdatabase/StorageTracker.h',
             'Modules/webdatabase/StorageTrackerClient.h',
             'notifications/NotificationClient.h',
-            'notifications/NotificationContents.h',
             'notifications/NotificationController.h',
             'page/Chrome.h',
             'page/ChromeClient.h',
index f5d7977..a69efe8 100755 (executable)
                                RelativePath="..\notifications\NotificationClient.h"
                                >
                        </File>
-                       <File
-                               RelativePath="..\notifications\NotificationContents.h"
-                               >
-                       </File>
                </Filter>
                <Filter
                        Name="editing"
index 51fbf42..7a8b061 100644 (file)
                33503CC71017A1B1003B47E1 /* Notification.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33503CC61017A1B1003B47E1 /* Notification.cpp */; };
                3390CA550FFC157B00921962 /* NotificationCenter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3390CA510FFC157B00921962 /* NotificationCenter.cpp */; };
                3390CA560FFC157B00921962 /* NotificationCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3390CA520FFC157B00921962 /* NotificationCenter.h */; };
-               3390CA580FFC157B00921962 /* NotificationContents.h in Headers */ = {isa = PBXBuildFile; fileRef = 3390CA540FFC157B00921962 /* NotificationContents.h */; settings = {ATTRIBUTES = (Private, ); }; };
                339B5B63131DAA3200F48D02 /* CookiesStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 339B5B62131DAA3200F48D02 /* CookiesStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; };
                33C0CCD4112C5E6200CE057D /* SecureTextInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33C0CCD2112C5E6200CE057D /* SecureTextInput.cpp */; };
                33C0CCD5112C5E6200CE057D /* SecureTextInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 33C0CCD3112C5E6200CE057D /* SecureTextInput.h */; };
                3390CA510FFC157B00921962 /* NotificationCenter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NotificationCenter.cpp; path = notifications/NotificationCenter.cpp; sourceTree = "<group>"; };
                3390CA520FFC157B00921962 /* NotificationCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotificationCenter.h; path = notifications/NotificationCenter.h; sourceTree = "<group>"; };
                3390CA530FFC157B00921962 /* NotificationCenter.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = NotificationCenter.idl; path = notifications/NotificationCenter.idl; sourceTree = "<group>"; };
-               3390CA540FFC157B00921962 /* NotificationContents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotificationContents.h; path = notifications/NotificationContents.h; sourceTree = "<group>"; };
                339B5B62131DAA3200F48D02 /* CookiesStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CookiesStrategy.h; sourceTree = "<group>"; };
                33C0CCD2112C5E6200CE057D /* SecureTextInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecureTextInput.cpp; sourceTree = "<group>"; };
                33C0CCD3112C5E6200CE057D /* SecureTextInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecureTextInput.h; sourceTree = "<group>"; };
                                3390CA520FFC157B00921962 /* NotificationCenter.h */,
                                3390CA530FFC157B00921962 /* NotificationCenter.idl */,
                                33503C9910179A74003B47E1 /* NotificationClient.h */,
-                               3390CA540FFC157B00921962 /* NotificationContents.h */,
                                3128CA67147331520074C72A /* NotificationController.cpp */,
                                3128CA6A147331630074C72A /* NotificationController.h */,
                        );
                                A8EA7EBE0A1945D000A8EF5F /* Notation.h in Headers */,
                                312C0C41146DC6CC0016C911 /* Notification.h in Headers */,
                                3390CA560FFC157B00921962 /* NotificationCenter.h in Headers */,
-                               3390CA580FFC157B00921962 /* NotificationContents.h in Headers */,
                                3128CA6B147331630074C72A /* NotificationController.h in Headers */,
                                33503C9A10179A74003B47E1 /* NotificationClient.h in Headers */,
                                98EB1F951313FE0500D0E1EA /* NotImplemented.h in Headers */,
index 603e0cf..03c8244 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
- * Copyright (C) 2009, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2011, 2012 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -40,7 +40,6 @@
 #include "EventNames.h"
 #include "NotificationCenter.h"
 #include "NotificationClient.h"
-#include "NotificationContents.h"
 #include "ResourceRequest.h"
 #include "ResourceResponse.h"
 #include "ThreadableLoader.h"
@@ -73,10 +72,11 @@ Notification::Notification(const KURL& url, ScriptExecutionContext* context, Exc
     m_notificationURL = url;
 }
 
-Notification::Notification(const NotificationContents& contents, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider)
+Notification::Notification(const String& title, const String& body, const String& iconURI, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider)
     : ActiveDOMObject(context, this)
     , m_isHTML(false)
-    , m_contents(contents)
+    , m_title(title)
+    , m_body(body)
     , m_state(Idle)
     , m_notificationCenter(provider)
 {
@@ -86,7 +86,8 @@ Notification::Notification(const NotificationContents& contents, ScriptExecution
         return;
     }
 
-    if (!contents.icon.isEmpty() && !contents.icon.isValid()) {
+    m_icon = iconURI.isEmpty() ? KURL() : scriptExecutionContext()->completeURL(iconURI);
+    if (!m_icon.isEmpty() && !m_icon.isValid()) {
         ec = SYNTAX_ERR;
         return;
     }
@@ -107,9 +108,9 @@ PassRefPtr<Notification> Notification::create(const KURL& url, ScriptExecutionCo
     return notification.release();
 }
 
-PassRefPtr<Notification> Notification::create(const NotificationContents& contents, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider) 
+PassRefPtr<Notification> Notification::create(const String& title, const String& body, const String& iconURI, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider) 
 { 
-    RefPtr<Notification> notification(adoptRef(new Notification(contents, context, ec, provider)));
+    RefPtr<Notification> notification(adoptRef(new Notification(title, body, iconURI, context, ec, provider)));
     notification->suspendIfNeeded();
     return notification.release();
 }
index cbd819b..19d8e69 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
- * Copyright (C) 2009, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2011, 2012 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -36,7 +36,6 @@
 #include "EventNames.h"
 #include "EventTarget.h"
 #include "KURL.h"
-#include "NotificationContents.h"
 #include "SharedBuffer.h"
 #include "TextDirection.h"
 #include "ThreadableLoaderClient.h"
@@ -62,7 +61,7 @@ class Notification : public RefCounted<Notification>, public ActiveDOMObject, pu
 public:
     Notification();
     static PassRefPtr<Notification> create(const KURL&, ScriptExecutionContext*, ExceptionCode&, PassRefPtr<NotificationCenter> provider);
-    static PassRefPtr<Notification> create(const NotificationContents&, ScriptExecutionContext*, ExceptionCode&, PassRefPtr<NotificationCenter> provider);
+    static PassRefPtr<Notification> create(const String& title, const String& body, const String& iconURI, ScriptExecutionContext*, ExceptionCode&, PassRefPtr<NotificationCenter> provider);
     
     virtual ~Notification();
 
@@ -75,10 +74,9 @@ public:
     KURL url() const { return m_notificationURL; }
     void setURL(KURL url) { m_notificationURL = url; }
     
-    KURL iconURL() { return m_contents.icon; }
-    
-    const NotificationContents& contents() const { return m_contents; }
-    NotificationContents& contents() { return m_contents; }
+    KURL iconURL() const { return m_icon; }
+    String title() const { return m_title; }
+    String body() const { return m_body; }
 
     String dir() const { return m_direction; }
     void setDir(const String& dir) { m_direction = dir; }
@@ -127,7 +125,7 @@ public:
 
 private:
     Notification(const KURL&, ScriptExecutionContext*, ExceptionCode&, PassRefPtr<NotificationCenter>);
-    Notification(const NotificationContents&, ScriptExecutionContext*, ExceptionCode&, PassRefPtr<NotificationCenter>);
+    Notification(const String& title, const String& body, const String& iconURI, ScriptExecutionContext*, ExceptionCode&, PassRefPtr<NotificationCenter>);
 
     // EventTarget interface
     virtual void refEventTarget() { ref(); }
@@ -139,8 +137,13 @@ private:
     void finishLoading();
 
     bool m_isHTML;
+
+    // Text notifications.
+    KURL m_icon;
+    String m_title;
+    String m_body;
+    // FIXME: Deprecate HTML Notifications.
     KURL m_notificationURL;
-    NotificationContents m_contents;
 
     String m_direction;
     String m_replaceId;
index 2cedac8..a084560 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -34,7 +34,6 @@
 
 #include "ExceptionCode.h"
 #include "Notification.h"
-#include "NotificationContents.h"
 #include "ScriptExecutionContext.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/PassRefPtr.h>
@@ -71,8 +70,7 @@ public:
             ec = INVALID_STATE_ERR;
             return 0;
         }
-        NotificationContents contents(iconURI.isEmpty() ? KURL() : scriptExecutionContext()->completeURL(iconURI), title, body);
-        return Notification::create(contents, scriptExecutionContext(), ec, this);
+        return Notification::create(title, body, iconURI, scriptExecutionContext(), ec, this);
     }
 
     NotificationClient* client() const { return m_client; }
diff --git a/Source/WebCore/notifications/NotificationContents.h b/Source/WebCore/notifications/NotificationContents.h
deleted file mode 100644 (file)
index 68add50..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef NotificationContents_h
-#define NotificationContents_h
-
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-
-#include "KURL.h"
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-struct NotificationContents { 
-public:
-    NotificationContents() { }
-    NotificationContents(const KURL& iconUrl, const String& notificationTitle, const String& notificationBody)
-        : icon(iconUrl)
-        , title(notificationTitle)
-        , body(notificationBody)
-    { }
-
-    KURL icon;
-    String title;
-    String body;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-
-#endif // NotificationContents_h
index 2d9a3de..8aa596d 100644 (file)
@@ -1,3 +1,16 @@
+2012-03-07  Jon Lee  <jonlee@apple.com>
+
+        Move NotificationContents into Notification
+        https://bugs.webkit.org/show_bug.cgi?id=80487
+        <rdar://problem/10965519>
+
+        Reviewed by Jian Li.
+
+        Refactor to use accessor methods on Notification.
+        * src/WebNotification.cpp:
+        (WebKit::WebNotification::title):
+        (WebKit::WebNotification::body):
+
 2012-03-13  Jon Lee  <jonlee@apple.com>
 
         Deprecate ondisplay()
index 747376d..9294f31 100644 (file)
@@ -88,13 +88,13 @@ WebURL WebNotification::iconURL() const
 WebString WebNotification::title() const
 {
     ASSERT(!isHTML());
-    return m_private->contents().title;
+    return m_private->title();
 }
 
 WebString WebNotification::body() const
 {
     ASSERT(!isHTML());
-    return m_private->contents().body;
+    return m_private->body();
 }
 
 WebTextDirection WebNotification::direction() const
index 0a08510..6ae662e 100644 (file)
@@ -1,3 +1,15 @@
+2012-03-07  Jon Lee  <jonlee@apple.com>
+
+        Move NotificationContents into Notification
+        https://bugs.webkit.org/show_bug.cgi?id=80487
+        <rdar://problem/10965519>
+
+        Reviewed by Jian Li.
+
+        * WebView/WebNotification.mm: Refactor to use accessor methods on Notification.
+        (-[WebNotification title]):
+        (-[WebNotification body]):
+
 2012-03-15  David Hyatt  <hyatt@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=81258
index 882552b..cb35f50 100644 (file)
@@ -85,7 +85,7 @@ Notification* core(WebNotification *notification)
 {
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
     ASSERT(core(self));
-    return core(self)->contents().title;
+    return core(self)->title();
 #else
     return nil;
 #endif
@@ -95,7 +95,7 @@ Notification* core(WebNotification *notification)
 {
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
     ASSERT(core(self));
-    return core(self)->contents().body;
+    return core(self)->body();
 #else
     return nil;
 #endif
index 8067d19..e60192a 100644 (file)
@@ -1,3 +1,21 @@
+2012-03-07  Jon Lee  <jonlee@apple.com>
+
+        Move NotificationContents into Notification
+        https://bugs.webkit.org/show_bug.cgi?id=80487
+        <rdar://problem/10965519>
+
+        Reviewed by Jian Li.
+
+        Refactor to use accessor methods on Notification.
+        * WebCoreSupport/NotificationPresenterClientQt.cpp:
+        (WebCore::NotificationWrapper::title):
+        (WebCore::NotificationWrapper::message):
+        (WebCore::NotificationPresenterClientQt::displayNotification):
+        (WebCore::NotificationPresenterClientQt::cancel):
+        (WebCore::NotificationPresenterClientQt::notificationClicked):
+        (WebCore::NotificationPresenterClientQt::dumpReplacedIdText):
+        (WebCore::NotificationPresenterClientQt::dumpShowText):
+
 2012-03-13  Jon Lee  <jonlee@apple.com>
 
         Separate NOTIFICATIONS and LEGACY_NOTIFICATIONS
index 0c5ea16..453c2a6 100644 (file)
@@ -91,7 +91,7 @@ const QString NotificationWrapper::title() const
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
     Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this);
     if (notification)
-        return notification->contents().title;
+        return notification->title();
 #endif
     return QString();
 }
@@ -101,7 +101,7 @@ const QString NotificationWrapper::message() const
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
     Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this);
     if (notification)
-        return notification->contents().body;
+        return notification->body();
 #endif
     return QString();
 }
@@ -197,8 +197,8 @@ void NotificationPresenterClientQt::displayNotification(Notification* notificati
     if (notification->isHTML())
         message = notification->url().string();
     else {
-        title = notification->contents().title;
-        message = notification->contents().body;
+        title = notification->title();
+        message = notification->body();
     }
 
     if (m_platformPlugin.plugin() && m_platformPlugin.plugin()->supportsExtension(QWebKitPlatformPlugin::Notifications))
@@ -233,7 +233,7 @@ void NotificationPresenterClientQt::displayNotification(Notification* notificati
 #ifndef QT_NO_SYSTEMTRAYICON
     wrapper->connect(wrapper->m_notificationIcon.get(), SIGNAL(messageClicked()), wrapper, SLOT(notificationClicked()));
     wrapper->m_notificationIcon->show();
-    wrapper->m_notificationIcon->showMessage(notification->contents().title, notification->contents().body);
+    wrapper->m_notificationIcon->showMessage(notification->title(), notification->body());
 #endif
 }
 
@@ -243,7 +243,7 @@ void NotificationPresenterClientQt::cancel(Notification* notification)
         if (notification->isHTML())
             printf("DESKTOP NOTIFICATION CLOSED: %s\n", QString(notification->url().string()).toUtf8().constData());
         else
-            printf("DESKTOP NOTIFICATION CLOSED: %s\n", QString(notification->contents().title).toUtf8().constData());
+            printf("DESKTOP NOTIFICATION CLOSED: %s\n", QString(notification->title()).toUtf8().constData());
     }
 
     NotificationsQueue::Iterator iter = m_notifications.find(notification);
@@ -283,7 +283,7 @@ void NotificationPresenterClientQt::notificationClicked(const QString& title)
         if (notification->isHTML())
             notificationTitle = notification->url().string();
         else
-            notificationTitle = notification->contents().title;
+            notificationTitle = notification->title();
         if (notificationTitle == title)
             break;
         iter++;
@@ -423,7 +423,7 @@ void NotificationPresenterClientQt::detachNotification(Notification* notificatio
 void NotificationPresenterClientQt::dumpReplacedIdText(Notification* notification)
 {
     if (notification)
-        printf("REPLACING NOTIFICATION %s\n", notification->isHTML() ? QString(notification->url().string()).toUtf8().constData() : QString(notification->contents().title).toUtf8().constData());
+        printf("REPLACING NOTIFICATION %s\n", notification->isHTML() ? QString(notification->url().string()).toUtf8().constData() : QString(notification->title()).toUtf8().constData());
 }
 
 void NotificationPresenterClientQt::dumpShowText(Notification* notification)
@@ -433,8 +433,8 @@ void NotificationPresenterClientQt::dumpShowText(Notification* notification)
     else {
         printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n",
                 notification->dir() == "rtl" ? "(RTL)" : "",
-            QString(notification->contents().icon.string()).toUtf8().constData(), QString(notification->contents().title).toUtf8().constData(),
-            QString(notification->contents().body).toUtf8().constData());
+            QString(notification->iconURL().string()).toUtf8().constData(), QString(notification->title()).toUtf8().constData(),
+            QString(notification->body()).toUtf8().constData());
     }
 }
 
index 2e32d90..4b62398 100644 (file)
@@ -1,3 +1,15 @@
+2012-03-07  Jon Lee  <jonlee@apple.com>
+
+        Move NotificationContents into Notification
+        https://bugs.webkit.org/show_bug.cgi?id=80487
+        <rdar://problem/10965519>
+
+        Reviewed by Jian Li.
+
+        * UIProcess/Notifications/WebNotificationManagerProxy.cpp: Remove extraneous include.
+        * WebProcess/Notifications/WebNotificationManager.cpp:
+        (WebKit::WebNotificationManager::show): Refactor to use accessor methods on Notification.
+
 2012-03-15  Brent Fulgham  <bfulgham@webkit.org>
 
         Unreviewed build correction. WinCairo export definitions
index 27a889e..d8051a4 100644 (file)
@@ -33,7 +33,6 @@
 #include "WebNotificationManagerMessages.h"
 #include "WebPageProxy.h"
 #include "WebSecurityOrigin.h"
-#include <WebCore/NotificationContents.h>
 
 using namespace WTF;
 using namespace WebCore;
index 8d11f13..8daf525 100644 (file)
@@ -117,7 +117,7 @@ bool WebNotificationManager::show(Notification* notification, WebPage* page)
     NotificationContextMap::iterator it = m_notificationContextMap.add(notification->scriptExecutionContext(), Vector<uint64_t>()).first;
     it->second.append(notificationID);
     
-    m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->contents().title, notification->contents().body, notification->iconURL().string(), notification->replaceId(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());
+    m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->title(), notification->body(), notification->iconURL().string(), notification->replaceId(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());
     return true;
 #else
     return false;