| OLD | NEW |
| 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 package org.chromium.chrome.browser.physicalweb; | 5 package org.chromium.chrome.browser.physicalweb; |
| 6 | 6 |
| 7 import android.app.Notification; | 7 import android.app.Notification; |
| 8 import android.app.PendingIntent; | 8 import android.app.PendingIntent; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.Intent; | 10 import android.content.Intent; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 270 } |
| 271 }); | 271 }); |
| 272 } | 272 } |
| 273 | 273 |
| 274 private void showNotification() { | 274 private void showNotification() { |
| 275 if (PhysicalWeb.isOnboarding(mContext)) { | 275 if (PhysicalWeb.isOnboarding(mContext)) { |
| 276 if (PhysicalWeb.getOptInNotifyCount(mContext) < PhysicalWeb.OPTIN_NO
TIFY_MAX_TRIES) { | 276 if (PhysicalWeb.getOptInNotifyCount(mContext) < PhysicalWeb.OPTIN_NO
TIFY_MAX_TRIES) { |
| 277 // high priority notification | 277 // high priority notification |
| 278 createOptInNotification(true); | 278 createOptInNotification(true); |
| 279 PhysicalWeb.recordOptInNotification(mContext); | 279 PhysicalWeb.recordOptInNotification(mContext); |
| 280 PhysicalWebUma.onOptInHighPriorityNotificationShown(mContext); |
| 280 } else { | 281 } else { |
| 281 // min priority notification | 282 // min priority notification |
| 282 createOptInNotification(false); | 283 createOptInNotification(false); |
| 284 PhysicalWebUma.onOptInMinPriorityNotificationShown(mContext); |
| 283 } | 285 } |
| 284 return; | 286 return; |
| 285 } | 287 } |
| 286 | 288 |
| 287 if (PhysicalWeb.isPhysicalWebPreferenceEnabled(mContext)) { | 289 if (PhysicalWeb.isPhysicalWebPreferenceEnabled(mContext)) { |
| 288 createNotification(); | 290 createNotification(); |
| 289 } | 291 } |
| 290 } | 292 } |
| 291 | 293 |
| 292 private void createNotification() { | 294 private void createNotification() { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 .setAutoCancel(true) | 336 .setAutoCancel(true) |
| 335 .build(); | 337 .build(); |
| 336 mNotificationManager.notify(NotificationConstants.NOTIFICATION_ID_PHYSIC
AL_WEB, | 338 mNotificationManager.notify(NotificationConstants.NOTIFICATION_ID_PHYSIC
AL_WEB, |
| 337 notification); | 339 notification); |
| 338 } | 340 } |
| 339 | 341 |
| 340 private void clearNotification() { | 342 private void clearNotification() { |
| 341 mNotificationManager.cancel(NotificationConstants.NOTIFICATION_ID_PHYSIC
AL_WEB); | 343 mNotificationManager.cancel(NotificationConstants.NOTIFICATION_ID_PHYSIC
AL_WEB); |
| 342 } | 344 } |
| 343 } | 345 } |
| OLD | NEW |