diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-06 21:16:05 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-06 21:16:05 +0000 |
commit | 9aa11d8b293a1553cd7e76d8381d0b21bf43e309 (patch) | |
tree | 925b4b2545355836d5329b3e7335e3ecc9fae979 /chrome/browser/notifications/notification.h | |
parent | a03ceecb67f6dd1ba48a7b6b136d37438ef60a60 (diff) | |
download | chromium_src-9aa11d8b293a1553cd7e76d8381d0b21bf43e309.zip chromium_src-9aa11d8b293a1553cd7e76d8381d0b21bf43e309.tar.gz chromium_src-9aa11d8b293a1553cd7e76d8381d0b21bf43e309.tar.bz2 |
Add a separate Notification constructor to differentiate between text and HTML notifications.
BUG=120677
TEST=Covered by tests.
Review URL: http://codereview.chromium.org/9981009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131188 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications/notification.h')
-rw-r--r-- | chrome/browser/notifications/notification.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/chrome/browser/notifications/notification.h b/chrome/browser/notifications/notification.h index 2040cf3..f6b41d4 100644 --- a/chrome/browser/notifications/notification.h +++ b/chrome/browser/notifications/notification.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -9,8 +9,10 @@ #include <string> #include "base/basictypes.h" +#include "base/string16.h" #include "chrome/browser/notifications/notification_object_proxy.h" #include "googleurl/src/gurl.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" class NotificationDelegate; @@ -19,18 +21,37 @@ class NotificationDelegate; // data: URLs representing simple text+icon notifications. class Notification { public: + // Initializes a notification with HTML content. Notification(const GURL& origin_url, const GURL& content_url, const string16& display_source, const string16& replace_id, NotificationDelegate* delegate); + // Initializes a notification with text content, and then creates a + // HTML representation of it for display (satisfying the invariant outlined + // at the top of this class). + Notification(const GURL& origin_url, + const GURL& icon_url, + const string16& title, + const string16& body, + WebKit::WebTextDirection dir, + const string16& display_source, + const string16& replace_id, + NotificationDelegate* delegate); Notification(const Notification& notification); ~Notification(); Notification& operator=(const Notification& notification); + // If this is a HTML notification. + bool is_html() const { return is_html_; } + // The URL (may be data:) containing the contents for the notification. const GURL& content_url() const { return content_url_; } + // Parameters for text-only notifications. + const string16& title() const { return title_; } + const string16& body() const { return body_; } + // The origin URL of the script which requested the notification. const GURL& origin_url() const { return origin_url_; } @@ -52,10 +73,18 @@ class Notification { // The Origin of the page/worker which created this notification. GURL origin_url_; + // If this is a HTML notification, the content is in |content_url_|. If + // false, the data is in |title_| and |body_|. + bool is_html_; + // The URL of the HTML content of the toast (may be a data: URL for simple // string-based notifications). GURL content_url_; + // The content for a text notification. + string16 title_; + string16 body_; + // The display string for the source of the notification. Could be // the same as origin_url_, or the name of an extension. string16 display_source_; |