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

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

Issue 2242473002: Add an about:flag to control WebApk enablement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix last native reference Created 4 years, 4 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"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 const std::string& profile_id, 177 const std::string& profile_id,
178 bool incognito, 178 bool incognito,
179 const Notification& notification) { 179 const Notification& notification) {
180 JNIEnv* env = AttachCurrentThread(); 180 JNIEnv* env = AttachCurrentThread();
181 // TODO(miguelg): Store the notification type in java instead of assuming it's 181 // TODO(miguelg): Store the notification type in java instead of assuming it's
182 // persistent once/if non persistent notifications are ever implemented on 182 // persistent once/if non persistent notifications are ever implemented on
183 // Android. 183 // Android.
184 DCHECK_EQ(notification_type, NotificationCommon::PERSISTENT); 184 DCHECK_EQ(notification_type, NotificationCommon::PERSISTENT);
185 185
186 GURL origin_url(notification.origin_url().GetOrigin()); 186 GURL origin_url(notification.origin_url().GetOrigin());
187 ScopedJavaLocalRef<jstring> webapk_package; 187
188 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 188 GURL scope_url(notification.service_worker_scope());
189 switches::kEnableWebApk)) { 189 if (!scope_url.is_valid())
190 GURL scope_url(notification.service_worker_scope()); 190 scope_url = origin_url;
191 if (!scope_url.is_valid()) 191 ScopedJavaLocalRef<jstring> j_scope_url =
192 scope_url = origin_url;
193 ScopedJavaLocalRef<jstring> j_scope_url =
194 ConvertUTF8ToJavaString(env, scope_url.spec()); 192 ConvertUTF8ToJavaString(env, scope_url.spec());
195 webapk_package = Java_NotificationPlatformBridge_queryWebApkPackage( 193 ScopedJavaLocalRef<jstring> webapk_package =
196 env, java_object_.obj(), j_scope_url.obj()); 194 Java_NotificationPlatformBridge_queryWebApkPackage(
197 } else { 195 env, java_object_.obj(), j_scope_url.obj());
198 webapk_package = ConvertUTF8ToJavaString(env, "");
199 }
200 196
201 ScopedJavaLocalRef<jstring> j_notification_id = 197 ScopedJavaLocalRef<jstring> j_notification_id =
202 ConvertUTF8ToJavaString(env, notification_id); 198 ConvertUTF8ToJavaString(env, notification_id);
203 ScopedJavaLocalRef<jstring> j_origin = 199 ScopedJavaLocalRef<jstring> j_origin =
204 ConvertUTF8ToJavaString(env, origin_url.spec()); 200 ConvertUTF8ToJavaString(env, origin_url.spec());
205 ScopedJavaLocalRef<jstring> tag = 201 ScopedJavaLocalRef<jstring> tag =
206 ConvertUTF8ToJavaString(env, notification.tag()); 202 ConvertUTF8ToJavaString(env, notification.tag());
207 ScopedJavaLocalRef<jstring> title = 203 ScopedJavaLocalRef<jstring> title =
208 ConvertUTF16ToJavaString(env, notification.title()); 204 ConvertUTF16ToJavaString(env, notification.title());
209 ScopedJavaLocalRef<jstring> body = 205 ScopedJavaLocalRef<jstring> body =
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 RegeneratedNotificationInfo() {} 301 RegeneratedNotificationInfo() {}
306 302
307 NotificationPlatformBridgeAndroid::RegeneratedNotificationInfo:: 303 NotificationPlatformBridgeAndroid::RegeneratedNotificationInfo::
308 RegeneratedNotificationInfo(const std::string& origin, 304 RegeneratedNotificationInfo(const std::string& origin,
309 const std::string& tag, 305 const std::string& tag,
310 const std::string& webapk_package) 306 const std::string& webapk_package)
311 : origin(origin), tag(tag), webapk_package(webapk_package) {} 307 : origin(origin), tag(tag), webapk_package(webapk_package) {}
312 308
313 NotificationPlatformBridgeAndroid::RegeneratedNotificationInfo:: 309 NotificationPlatformBridgeAndroid::RegeneratedNotificationInfo::
314 ~RegeneratedNotificationInfo() {} 310 ~RegeneratedNotificationInfo() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698