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

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

Issue 2917923004: Move handler processing to NotificationDisplayService
Patch Set: Created 3 years, 6 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 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 "chrome/browser/notifications/notification_platform_bridge_android.h" 5 #include "chrome/browser/notifications/notification_platform_bridge_android.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/strings/nullable_string16.h" 15 #include "base/strings/nullable_string16.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/notifications/native_notification_display_service.h"
19 #include "chrome/browser/notifications/notification.h" 18 #include "chrome/browser/notifications/notification.h"
20 #include "chrome/browser/notifications/notification_common.h" 19 #include "chrome/browser/notifications/notification_common.h"
20 #include "chrome/browser/notifications/notification_display_service.h"
21 #include "chrome/browser/notifications/notification_display_service_factory.h" 21 #include "chrome/browser/notifications/notification_display_service_factory.h"
22 #include "chrome/browser/notifications/persistent_notification_delegate.h" 22 #include "chrome/browser/notifications/persistent_notification_delegate.h"
23 #include "chrome/browser/notifications/platform_notification_service_impl.h" 23 #include "chrome/browser/notifications/platform_notification_service_impl.h"
24 #include "chrome/browser/profiles/profile_manager.h" 24 #include "chrome/browser/profiles/profile_manager.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
27 #include "components/pref_registry/pref_registry_syncable.h" 27 #include "components/pref_registry/pref_registry_syncable.h"
28 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
29 #include "content/public/common/persistent_notification_status.h" 29 #include "content/public/common/persistent_notification_status.h"
30 #include "content/public/common/platform_notification_data.h" 30 #include "content/public/common/platform_notification_data.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 int action_index, 109 int action_index,
110 const base::NullableString16& reply, 110 const base::NullableString16& reply,
111 Profile* profile) { 111 Profile* profile) {
112 if (!profile) { 112 if (!profile) {
113 // TODO(miguelg): Add UMA for this condition. 113 // TODO(miguelg): Add UMA for this condition.
114 // Perhaps propagate this through PersistentNotificationStatus. 114 // Perhaps propagate this through PersistentNotificationStatus.
115 LOG(WARNING) << "Profile not loaded correctly"; 115 LOG(WARNING) << "Profile not loaded correctly";
116 return; 116 return;
117 } 117 }
118 118
119 NotificationDisplayService* display_service = 119 auto* display_service =
120 NotificationDisplayServiceFactory::GetForProfile(profile); 120 NotificationDisplayServiceFactory::GetForProfile(profile);
121 121
122 static_cast<NativeNotificationDisplayService*>(display_service) 122 display_service->ProcessNotificationOperation(operation, notification_type,
123 ->ProcessNotificationOperation(operation, notification_type, origin, 123 origin, notification_id,
124 notification_id, action_index, reply); 124 action_index, reply);
125 } 125 }
126 126
127 } // namespace 127 } // namespace
128 128
129 // Called by the Java side when a notification event has been received, but the 129 // Called by the Java side when a notification event has been received, but the
130 // NotificationBridge has not been initialized yet. Enforce initialization of 130 // NotificationBridge has not been initialized yet. Enforce initialization of
131 // the class. 131 // the class.
132 static void InitializeNotificationPlatformBridge( 132 static void InitializeNotificationPlatformBridge(
133 JNIEnv* env, 133 JNIEnv* env,
134 const JavaParamRef<jclass>& clazz) { 134 const JavaParamRef<jclass>& clazz) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 RegeneratedNotificationInfo() {} 344 RegeneratedNotificationInfo() {}
345 345
346 NotificationPlatformBridgeAndroid::RegeneratedNotificationInfo:: 346 NotificationPlatformBridgeAndroid::RegeneratedNotificationInfo::
347 RegeneratedNotificationInfo(const std::string& origin, 347 RegeneratedNotificationInfo(const std::string& origin,
348 const std::string& tag, 348 const std::string& tag,
349 const std::string& webapk_package) 349 const std::string& webapk_package)
350 : origin(origin), tag(tag), webapk_package(webapk_package) {} 350 : origin(origin), tag(tag), webapk_package(webapk_package) {}
351 351
352 NotificationPlatformBridgeAndroid::RegeneratedNotificationInfo:: 352 NotificationPlatformBridgeAndroid::RegeneratedNotificationInfo::
353 ~RegeneratedNotificationInfo() {} 353 ~RegeneratedNotificationInfo() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698