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

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

Issue 1128173005: Clean up ProfileManager interface. Base URL: https://chromium.googlesource.com/chromium/src@issue479309
Patch Set: sync Created 5 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_ui_manager_android.h" 5 #include "chrome/browser/notifications/notification_ui_manager_android.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/android/jni_array.h" 9 #include "base/android/jni_array.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 GURL origin(ConvertJavaStringToUTF8(env, java_origin)); 60 GURL origin(ConvertJavaStringToUTF8(env, java_origin));
61 std::string tag = ConvertJavaStringToUTF8(env, java_tag); 61 std::string tag = ConvertJavaStringToUTF8(env, java_tag);
62 62
63 regenerated_notification_infos_[persistent_notification_id] = 63 regenerated_notification_infos_[persistent_notification_id] =
64 std::make_pair(origin.spec(), tag); 64 std::make_pair(origin.spec(), tag);
65 65
66 // TODO(peter): Rather than assuming that the last used profile is the 66 // TODO(peter): Rather than assuming that the last used profile is the
67 // appropriate one for this notification, the used profile should be 67 // appropriate one for this notification, the used profile should be
68 // stored as part of the notification's data. See https://crbug.com/437574. 68 // stored as part of the notification's data. See https://crbug.com/437574.
69 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick( 69 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick(
70 ProfileManager::GetLastUsedProfile(), 70 g_browser_process->profile_manager()->GetLastUsedProfile(),
71 persistent_notification_id, 71 persistent_notification_id,
72 origin); 72 origin);
73 73
74 return true; 74 return true;
75 } 75 }
76 76
77 bool NotificationUIManagerAndroid::OnNotificationClosed( 77 bool NotificationUIManagerAndroid::OnNotificationClosed(
78 JNIEnv* env, 78 JNIEnv* env,
79 jobject java_object, 79 jobject java_object,
80 jlong persistent_notification_id, 80 jlong persistent_notification_id,
81 jstring java_origin, 81 jstring java_origin,
82 jstring java_tag) { 82 jstring java_tag) {
83 GURL origin(ConvertJavaStringToUTF8(env, java_origin)); 83 GURL origin(ConvertJavaStringToUTF8(env, java_origin));
84 std::string tag = ConvertJavaStringToUTF8(env, java_tag); 84 std::string tag = ConvertJavaStringToUTF8(env, java_tag);
85 85
86 // The notification was closed by the platform, so clear all local state. 86 // The notification was closed by the platform, so clear all local state.
87 regenerated_notification_infos_.erase(persistent_notification_id); 87 regenerated_notification_infos_.erase(persistent_notification_id);
88 88
89 // TODO(peter): Rather than assuming that the last used profile is the 89 // TODO(peter): Rather than assuming that the last used profile is the
90 // appropriate one for this notification, the used profile should be 90 // appropriate one for this notification, the used profile should be
91 // stored as part of the notification's data. See https://crbug.com/437574. 91 // stored as part of the notification's data. See https://crbug.com/437574.
92 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClose( 92 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClose(
93 ProfileManager::GetLastUsedProfile(), 93 g_browser_process->profile_manager()->GetLastUsedProfile(),
94 persistent_notification_id, 94 persistent_notification_id,
95 origin); 95 origin);
96 96
97 return true; 97 return true;
98 } 98 }
99 99
100 void NotificationUIManagerAndroid::Add(const Notification& notification, 100 void NotificationUIManagerAndroid::Add(const Notification& notification,
101 Profile* profile) { 101 Profile* profile) {
102 JNIEnv* env = AttachCurrentThread(); 102 JNIEnv* env = AttachCurrentThread();
103 103
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return false; 222 return false;
223 } 223 }
224 224
225 void NotificationUIManagerAndroid::CancelAll() { 225 void NotificationUIManagerAndroid::CancelAll() {
226 NOTREACHED(); 226 NOTREACHED();
227 } 227 }
228 228
229 bool NotificationUIManagerAndroid::RegisterNotificationUIManager(JNIEnv* env) { 229 bool NotificationUIManagerAndroid::RegisterNotificationUIManager(JNIEnv* env) {
230 return RegisterNativesImpl(env); 230 return RegisterNativesImpl(env);
231 } 231 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/extensions_metrics_provider.cc ('k') | chrome/browser/profiles/avatar_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698