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

Side by Side Diff: content/shell/browser/layout_test/layout_test_notification_manager.cc

Issue 1634933006: Use NotificationResources instead of a bare SkBitmap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests. Created 4 years, 11 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
« no previous file with comments | « content/shell/browser/layout_test/layout_test_notification_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/shell/browser/layout_test/layout_test_notification_manager.h" 5 #include "content/shell/browser/layout_test/layout_test_notification_manager.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/desktop_notification_delegate.h" 10 #include "content/public/browser/desktop_notification_delegate.h"
(...skipping 30 matching lines...) Expand all
41 } // namespace 41 } // namespace
42 42
43 LayoutTestNotificationManager::LayoutTestNotificationManager() 43 LayoutTestNotificationManager::LayoutTestNotificationManager()
44 : weak_factory_(this) {} 44 : weak_factory_(this) {}
45 45
46 LayoutTestNotificationManager::~LayoutTestNotificationManager() {} 46 LayoutTestNotificationManager::~LayoutTestNotificationManager() {}
47 47
48 void LayoutTestNotificationManager::DisplayNotification( 48 void LayoutTestNotificationManager::DisplayNotification(
49 BrowserContext* browser_context, 49 BrowserContext* browser_context,
50 const GURL& origin, 50 const GURL& origin,
51 const SkBitmap& icon,
52 const PlatformNotificationData& notification_data, 51 const PlatformNotificationData& notification_data,
52 const NotificationResources& notification_resources,
53 scoped_ptr<DesktopNotificationDelegate> delegate, 53 scoped_ptr<DesktopNotificationDelegate> delegate,
54 base::Closure* cancel_callback) { 54 base::Closure* cancel_callback) {
55 DCHECK_CURRENTLY_ON(BrowserThread::UI); 55 DCHECK_CURRENTLY_ON(BrowserThread::UI);
56 std::string title = base::UTF16ToUTF8(notification_data.title); 56 std::string title = base::UTF16ToUTF8(notification_data.title);
57 57
58 DCHECK(cancel_callback); 58 DCHECK(cancel_callback);
59 *cancel_callback = base::Bind(&LayoutTestNotificationManager::Close, 59 *cancel_callback = base::Bind(&LayoutTestNotificationManager::Close,
60 weak_factory_.GetWeakPtr(), 60 weak_factory_.GetWeakPtr(),
61 title); 61 title);
62 62
63 ReplaceNotificationIfNeeded(notification_data); 63 ReplaceNotificationIfNeeded(notification_data);
64 64
65 page_notifications_[title] = delegate.release(); 65 page_notifications_[title] = delegate.release();
66 page_notifications_[title]->NotificationDisplayed(); 66 page_notifications_[title]->NotificationDisplayed();
67 } 67 }
68 68
69 void LayoutTestNotificationManager::DisplayPersistentNotification( 69 void LayoutTestNotificationManager::DisplayPersistentNotification(
70 BrowserContext* browser_context, 70 BrowserContext* browser_context,
71 int64_t persistent_notification_id, 71 int64_t persistent_notification_id,
72 const GURL& origin, 72 const GURL& origin,
73 const SkBitmap& icon, 73 const PlatformNotificationData& notification_data,
74 const PlatformNotificationData& notification_data) { 74 const NotificationResources& notification_resources) {
75 DCHECK_CURRENTLY_ON(BrowserThread::UI); 75 DCHECK_CURRENTLY_ON(BrowserThread::UI);
76 std::string title = base::UTF16ToUTF8(notification_data.title); 76 std::string title = base::UTF16ToUTF8(notification_data.title);
77 77
78 ReplaceNotificationIfNeeded(notification_data); 78 ReplaceNotificationIfNeeded(notification_data);
79 79
80 PersistentNotification notification; 80 PersistentNotification notification;
81 notification.browser_context = browser_context; 81 notification.browser_context = browser_context;
82 notification.origin = origin; 82 notification.origin = origin;
83 notification.persistent_id = persistent_notification_id; 83 notification.persistent_id = persistent_notification_id;
84 84
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { 196 LayoutTestNotificationManager::CheckPermission(const GURL& origin) {
197 return ToWebNotificationPermission(LayoutTestContentBrowserClient::Get() 197 return ToWebNotificationPermission(LayoutTestContentBrowserClient::Get()
198 ->GetLayoutTestBrowserContext() 198 ->GetLayoutTestBrowserContext()
199 ->GetLayoutTestPermissionManager() 199 ->GetLayoutTestPermissionManager()
200 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, 200 ->GetPermissionStatus(PermissionType::NOTIFICATIONS,
201 origin, 201 origin,
202 origin)); 202 origin));
203 } 203 }
204 204
205 } // namespace content 205 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/layout_test/layout_test_notification_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698