OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.SharedPreferences; | 10 import android.content.SharedPreferences; |
11 import android.os.SystemClock; | 11 import android.os.SystemClock; |
12 import android.util.Log; | 12 import android.util.Log; |
13 | 13 |
14 import org.chromium.base.ActivityState; | 14 import org.chromium.base.ActivityState; |
15 import org.chromium.base.ApplicationStatus; | 15 import org.chromium.base.ApplicationStatus; |
16 import org.chromium.base.CommandLineInitUtil; | 16 import org.chromium.base.CommandLineInitUtil; |
17 import org.chromium.base.ContextUtils; | 17 import org.chromium.base.ContextUtils; |
18 import org.chromium.base.ThreadUtils; | 18 import org.chromium.base.ThreadUtils; |
19 import org.chromium.base.TraceEvent; | 19 import org.chromium.base.TraceEvent; |
20 import org.chromium.base.annotations.CalledByNative; | 20 import org.chromium.base.annotations.CalledByNative; |
21 import org.chromium.base.annotations.MainDex; | 21 import org.chromium.base.annotations.MainDex; |
22 import org.chromium.base.annotations.SuppressFBWarnings; | 22 import org.chromium.base.annotations.SuppressFBWarnings; |
23 import org.chromium.base.library_loader.ProcessInitException; | 23 import org.chromium.base.library_loader.ProcessInitException; |
24 import org.chromium.chrome.browser.document.DocumentActivity; | 24 import org.chromium.chrome.browser.document.DocumentActivity; |
25 import org.chromium.chrome.browser.document.IncognitoDocumentActivity; | 25 import org.chromium.chrome.browser.document.IncognitoDocumentActivity; |
26 import org.chromium.chrome.browser.init.InvalidStartupDialog; | 26 import org.chromium.chrome.browser.init.InvalidStartupDialog; |
27 import org.chromium.chrome.browser.metrics.UmaUtils; | 27 import org.chromium.chrome.browser.metrics.UmaUtils; |
| 28 import org.chromium.chrome.browser.notifications.ChromeNotificationBuilder; |
| 29 import org.chromium.chrome.browser.notifications.NotificationBuilder; |
| 30 import org.chromium.chrome.browser.notifications.NotificationCompatBuilder; |
28 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza
tions; | 31 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza
tions; |
29 import org.chromium.chrome.browser.preferences.PreferencesLauncher; | 32 import org.chromium.chrome.browser.preferences.PreferencesLauncher; |
30 import org.chromium.chrome.browser.preferences.autofill.AutofillAndPaymentsPrefe
rences; | 33 import org.chromium.chrome.browser.preferences.autofill.AutofillAndPaymentsPrefe
rences; |
31 import org.chromium.chrome.browser.preferences.password.SavePasswordsPreferences
; | 34 import org.chromium.chrome.browser.preferences.password.SavePasswordsPreferences
; |
32 import org.chromium.chrome.browser.tab.Tab; | 35 import org.chromium.chrome.browser.tab.Tab; |
33 import org.chromium.chrome.browser.tabmodel.document.ActivityDelegateImpl; | 36 import org.chromium.chrome.browser.tabmodel.document.ActivityDelegateImpl; |
34 import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector; | 37 import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector; |
35 import org.chromium.chrome.browser.tabmodel.document.StorageDelegate; | 38 import org.chromium.chrome.browser.tabmodel.document.StorageDelegate; |
36 import org.chromium.chrome.browser.tabmodel.document.TabDelegate; | 39 import org.chromium.chrome.browser.tabmodel.document.TabDelegate; |
37 import org.chromium.content.app.ContentApplication; | 40 import org.chromium.content.app.ContentApplication; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 public static DocumentTabModelSelector getDocumentTabModelSelector() { | 190 public static DocumentTabModelSelector getDocumentTabModelSelector() { |
188 ThreadUtils.assertOnUiThread(); | 191 ThreadUtils.assertOnUiThread(); |
189 if (sDocumentTabModelSelector == null) { | 192 if (sDocumentTabModelSelector == null) { |
190 ActivityDelegateImpl activityDelegate = new ActivityDelegateImpl( | 193 ActivityDelegateImpl activityDelegate = new ActivityDelegateImpl( |
191 DocumentActivity.class, IncognitoDocumentActivity.class); | 194 DocumentActivity.class, IncognitoDocumentActivity.class); |
192 sDocumentTabModelSelector = new DocumentTabModelSelector(activityDel
egate, | 195 sDocumentTabModelSelector = new DocumentTabModelSelector(activityDel
egate, |
193 new StorageDelegate(), new TabDelegate(false), new TabDelega
te(true)); | 196 new StorageDelegate(), new TabDelegate(false), new TabDelega
te(true)); |
194 } | 197 } |
195 return sDocumentTabModelSelector; | 198 return sDocumentTabModelSelector; |
196 } | 199 } |
| 200 |
| 201 /** |
| 202 * Creates either a Notification.Builder or NotificationCompat.Builder under
the hood, wrapped |
| 203 * in our own common interface. Should be used for all notifications we crea
te. |
| 204 * |
| 205 * TODO(awdf) Remove this once we've updated to revision 26 of the support l
ibrary. |
| 206 * |
| 207 * @param preferCompat if a NotificationCompat.Builder is preferred. |
| 208 * @param notificationCategoryGroupId |
| 209 * @param notificationCategoryGroupName |
| 210 */ |
| 211 public ChromeNotificationBuilder createChromeNotificationBuilder(boolean pre
ferCompat, |
| 212 String notificationCategoryId, String notificationCategoryName, |
| 213 String notificationCategoryGroupId, String notificationCategoryGroup
Name) { |
| 214 return preferCompat ? new NotificationCompatBuilder(this) : new Notifica
tionBuilder(this); |
| 215 } |
197 } | 216 } |
OLD | NEW |