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

Side by Side Diff: chrome/browser/push_messaging/push_messaging_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: 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/push_messaging/push_messaging_notification_manager.h" 5 #include "chrome/browser/push_messaging/push_messaging_notification_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <bitset> 9 #include <bitset>
10 10
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/notifications/platform_notification_service_impl.h" 15 #include "chrome/browser/notifications/platform_notification_service_impl.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/push_messaging/push_messaging_constants.h" 17 #include "chrome/browser/push_messaging/push_messaging_constants.h"
18 #include "chrome/common/features.h" 18 #include "chrome/common/features.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/grit/generated_resources.h" 20 #include "chrome/grit/generated_resources.h"
21 #include "components/rappor/rappor_utils.h" 21 #include "components/rappor/rappor_utils.h"
22 #include "components/url_formatter/elide_url.h" 22 #include "components/url_formatter/elide_url.h"
23 #include "content/public/browser/browser_context.h" 23 #include "content/public/browser/browser_context.h"
24 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/platform_notification_context.h" 25 #include "content/public/browser/platform_notification_context.h"
26 #include "content/public/browser/push_messaging_service.h" 26 #include "content/public/browser/push_messaging_service.h"
27 #include "content/public/browser/render_frame_host.h" 27 #include "content/public/browser/render_frame_host.h"
28 #include "content/public/browser/storage_partition.h" 28 #include "content/public/browser/storage_partition.h"
29 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
30 #include "content/public/common/notification_resources.h"
30 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 31 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
31 #include "third_party/skia/include/core/SkBitmap.h"
32 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
33 #include "url/gurl.h" 33 #include "url/gurl.h"
34 34
35 #if BUILDFLAG(ANDROID_JAVA_UI) 35 #if BUILDFLAG(ANDROID_JAVA_UI)
36 #include "chrome/browser/ui/android/tab_model/tab_model.h" 36 #include "chrome/browser/ui/android/tab_model/tab_model.h"
37 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" 37 #include "chrome/browser/ui/android/tab_model/tab_model_list.h"
38 #else 38 #else
39 #include "chrome/browser/ui/browser.h" 39 #include "chrome/browser/ui/browser.h"
40 #include "chrome/browser/ui/browser_iterator.h" 40 #include "chrome/browser/ui/browser_iterator.h"
41 #include "chrome/browser/ui/tabs/tab_strip_model.h" 41 #include "chrome/browser/ui/tabs/tab_strip_model.h"
42 #endif 42 #endif
43 43
44 using content::BrowserThread; 44 using content::BrowserThread;
45 using content::NotificationDatabaseData; 45 using content::NotificationDatabaseData;
46 using content::NotificationResources;
46 using content::PlatformNotificationContext; 47 using content::PlatformNotificationContext;
47 using content::PlatformNotificationData; 48 using content::PlatformNotificationData;
48 using content::PushMessagingService; 49 using content::PushMessagingService;
49 using content::ServiceWorkerContext; 50 using content::ServiceWorkerContext;
50 using content::WebContents; 51 using content::WebContents;
51 52
52 namespace { 53 namespace {
53 54
54 void RecordUserVisibleStatus(content::PushUserVisibleStatus status) { 55 void RecordUserVisibleStatus(content::PushUserVisibleStatus status) {
55 UMA_HISTOGRAM_ENUMERATION("PushMessaging.UserVisibleStatus", status, 56 UMA_HISTOGRAM_ENUMERATION("PushMessaging.UserVisibleStatus", status,
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 bool success, 329 bool success,
329 int64_t persistent_notification_id) { 330 int64_t persistent_notification_id) {
330 DCHECK_CURRENTLY_ON(BrowserThread::UI); 331 DCHECK_CURRENTLY_ON(BrowserThread::UI);
331 if (!success) { 332 if (!success) {
332 DLOG(ERROR) << "Writing forced notification to database should not fail"; 333 DLOG(ERROR) << "Writing forced notification to database should not fail";
333 message_handled_closure.Run(); 334 message_handled_closure.Run();
334 return; 335 return;
335 } 336 }
336 337
337 PlatformNotificationServiceImpl::GetInstance()->DisplayPersistentNotification( 338 PlatformNotificationServiceImpl::GetInstance()->DisplayPersistentNotification(
338 profile_, persistent_notification_id, origin, SkBitmap() /* icon */, 339 profile_, persistent_notification_id, origin, notification_data,
339 notification_data); 340 content::NotificationResources());
Peter Beverloo 2016/01/26 15:43:23 s/content::// (you have a using declaration above)
Michael van Ouwerkerk 2016/01/26 16:24:21 Done.
340 341
341 message_handled_closure.Run(); 342 message_handled_closure.Run();
342 } 343 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698