diff options
author | peter <peter@chromium.org> | 2015-04-15 06:09:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-15 13:09:46 +0000 |
commit | 2ee1f3c08f9d1e46bdeb42dc8435dd30d81f0ae6 (patch) | |
tree | 50acd39f06b897fb54a4e168fbd8686fcb515a1e /content/child/notifications/notification_manager.cc | |
parent | 6c047d636359cd9136acf509839ac9c2d3fcaf2e (diff) | |
download | chromium_src-2ee1f3c08f9d1e46bdeb42dc8435dd30d81f0ae6.zip chromium_src-2ee1f3c08f9d1e46bdeb42dc8435dd30d81f0ae6.tar.gz chromium_src-2ee1f3c08f9d1e46bdeb42dc8435dd30d81f0ae6.tar.bz2 |
Integrate the notification database with the normal code path.
This patch actually integrates the Web Notification database with the
existing code paths, which means that it will be used for any persistent
notification being shown from this patch forward.
The database is completely tested with a series of unit tests, whereas
all existing browser tests, layout tests and instrumentation tests will
continue to exercise the full flows.
Please mind that this is the first part in a series. I realize that
there's a fair amount of TODOs in the code. Resolving these takes larger
refactorings (in case of reducing PlatformNotificationService
knowledge) or three-sided patches (in case of the Blink API). These
will be addressed in follow-ups.
Design document:
http://goo.gl/TciXVp
BUG=447628
Review URL: https://codereview.chromium.org/1026853002
Cr-Commit-Position: refs/heads/master@{#325232}
Diffstat (limited to 'content/child/notifications/notification_manager.cc')
-rw-r--r-- | content/child/notifications/notification_manager.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/content/child/notifications/notification_manager.cc b/content/child/notifications/notification_manager.cc index 6f5e8fe..96963df 100644 --- a/content/child/notifications/notification_manager.cc +++ b/content/child/notifications/notification_manager.cc @@ -5,6 +5,7 @@ #include "content/child/notifications/notification_manager.h" #include "base/lazy_instance.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/thread_task_runner_handle.h" #include "base/threading/thread_local.h" @@ -164,10 +165,23 @@ void NotificationManager::close(blink::WebNotificationDelegate* delegate) { void NotificationManager::closePersistent( const blink::WebSerializedOrigin& origin, - const blink::WebString& persistent_notification_id) { + const blink::WebString& persistent_notification_id_string) { + // TODO(peter): Blink should store the persistent_notification_id as an + // int64_t instead of a string. The id, created by Chromium, is a decimal + // number that fits in an int64_t, so convert it until the API updates. + base::string16 string_value = persistent_notification_id_string; + + int64_t persistent_notification_id = 0; + if (!base::StringToInt64(string_value, + &persistent_notification_id)) { + NOTREACHED() << "Unable to close persistent notification; invalid id: " + << string_value; + return; + } + thread_safe_sender_->Send(new PlatformNotificationHostMsg_ClosePersistent( GURL(origin.string()), - base::UTF16ToUTF8(persistent_notification_id))); + persistent_notification_id)); } void NotificationManager::notifyDelegateDestroyed( |