Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: chrome/browser/notifications/desktop_notification_service_win.cc

Issue 243703003: Removes win8_util (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/notifications/desktop_notification_service.h"
6
7 #include "base/logging.h"
8 #include "base/win/metro.h"
9 #include "chrome/browser/notifications/notification.h"
10 #include "chrome/browser/notifications/notification_object_proxy.h"
11 #include "chrome/browser/notifications/notification_ui_manager.h"
12 #include "chrome/browser/notifications/notification_ui_manager.h"
13 #include "win8/util/win8_util.h"
14
15 bool DesktopNotificationService::CancelDesktopNotification(
16 int process_id, int route_id, int notification_id) {
17 scoped_refptr<NotificationObjectProxy> proxy(
18 new NotificationObjectProxy(process_id, route_id, notification_id));
19 if (win8::IsSingleWindowMetroMode()) {
20 base::win::MetroCancelNotification cancel_metro_notification =
21 reinterpret_cast<base::win::MetroCancelNotification>(GetProcAddress(
22 base::win::GetMetroModule(), "CancelNotification"));
23 DCHECK(cancel_metro_notification);
24 if (cancel_metro_notification(proxy->id().c_str()))
25 return true;
26 }
27 return GetUIManager()->CancelById(proxy->id());
28 }
29
30 void DesktopNotificationService::ShowNotification(
31 const Notification& notification) {
32 if (win8::IsSingleWindowMetroMode()) {
33 base::win::MetroNotification display_metro_notification =
34 reinterpret_cast<base::win::MetroNotification>(GetProcAddress(
35 base::win::GetMetroModule(), "DisplayNotification"));
36 DCHECK(display_metro_notification);
37 if (!notification.is_html()) {
38 display_metro_notification(notification.origin_url().spec().c_str(),
39 notification.content_url().spec().c_str(),
40 notification.title().c_str(),
41 notification.message().c_str(),
42 notification.display_source().c_str(),
43 notification.notification_id().c_str(),
44 NULL, NULL);
45 return;
46 } else {
47 NOTREACHED() << "We don't support HTML notifications in Windows 8 metro";
48 }
49 }
50 GetUIManager()->Add(notification, profile_);
51 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/desktop_notification_service.cc ('k') | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698