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

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: nbuild ch 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
« no previous file with comments | « chrome/browser/android/shortcut_helper.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | 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 "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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 const std::string& profile_id, 176 const std::string& profile_id,
177 bool incognito, 177 bool incognito,
178 const Notification& notification) { 178 const Notification& notification) {
179 JNIEnv* env = AttachCurrentThread(); 179 JNIEnv* env = AttachCurrentThread();
180 // TODO(miguelg): Store the notification type in java instead of assuming it's 180 // TODO(miguelg): Store the notification type in java instead of assuming it's
181 // persistent once/if non persistent notifications are ever implemented on 181 // persistent once/if non persistent notifications are ever implemented on
182 // Android. 182 // Android.
183 DCHECK_EQ(notification_type, NotificationCommon::PERSISTENT); 183 DCHECK_EQ(notification_type, NotificationCommon::PERSISTENT);
184 184
185 GURL origin_url(notification.origin_url().GetOrigin()); 185 GURL origin_url(notification.origin_url().GetOrigin());
186 ScopedJavaLocalRef<jstring> webapk_package; 186
187 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 187 GURL scope_url(notification.service_worker_scope());
188 switches::kEnableWebApk)) { 188 if (!scope_url.is_valid())
189 GURL scope_url(notification.service_worker_scope()); 189 scope_url = origin_url;
190 if (!scope_url.is_valid()) 190 ScopedJavaLocalRef<jstring> j_scope_url =
191 scope_url = origin_url;
192 ScopedJavaLocalRef<jstring> j_scope_url =
193 ConvertUTF8ToJavaString(env, scope_url.spec()); 191 ConvertUTF8ToJavaString(env, scope_url.spec());
194 webapk_package = Java_NotificationPlatformBridge_queryWebApkPackage( 192 ScopedJavaLocalRef<jstring> webapk_package =
195 env, java_object_, j_scope_url); 193 Java_NotificationPlatformBridge_queryWebApkPackage(
196 } else { 194 env, java_object_, j_scope_url);
197 webapk_package = ConvertUTF8ToJavaString(env, "");
198 }
199 195
200 ScopedJavaLocalRef<jstring> j_notification_id = 196 ScopedJavaLocalRef<jstring> j_notification_id =
201 ConvertUTF8ToJavaString(env, notification_id); 197 ConvertUTF8ToJavaString(env, notification_id);
202 ScopedJavaLocalRef<jstring> j_origin = 198 ScopedJavaLocalRef<jstring> j_origin =
203 ConvertUTF8ToJavaString(env, origin_url.spec()); 199 ConvertUTF8ToJavaString(env, origin_url.spec());
204 ScopedJavaLocalRef<jstring> tag = 200 ScopedJavaLocalRef<jstring> tag =
205 ConvertUTF8ToJavaString(env, notification.tag()); 201 ConvertUTF8ToJavaString(env, notification.tag());
206 ScopedJavaLocalRef<jstring> title = 202 ScopedJavaLocalRef<jstring> title =
207 ConvertUTF16ToJavaString(env, notification.title()); 203 ConvertUTF16ToJavaString(env, notification.title());
208 ScopedJavaLocalRef<jstring> body = 204 ScopedJavaLocalRef<jstring> body =
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 RegeneratedNotificationInfo() {} 299 RegeneratedNotificationInfo() {}
304 300
305 NotificationPlatformBridgeAndroid::RegeneratedNotificationInfo:: 301 NotificationPlatformBridgeAndroid::RegeneratedNotificationInfo::
306 RegeneratedNotificationInfo(const std::string& origin, 302 RegeneratedNotificationInfo(const std::string& origin,
307 const std::string& tag, 303 const std::string& tag,
308 const std::string& webapk_package) 304 const std::string& webapk_package)
309 : origin(origin), tag(tag), webapk_package(webapk_package) {} 305 : origin(origin), tag(tag), webapk_package(webapk_package) {}
310 306
311 NotificationPlatformBridgeAndroid::RegeneratedNotificationInfo:: 307 NotificationPlatformBridgeAndroid::RegeneratedNotificationInfo::
312 ~RegeneratedNotificationInfo() {} 308 ~RegeneratedNotificationInfo() {}
OLDNEW
« no previous file with comments | « chrome/browser/android/shortcut_helper.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698