| 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.infobar; | 5 package org.chromium.chrome.browser.infobar; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.content.res.Resources; | 8 import android.content.res.Resources; |
| 9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
| 10 import android.support.v4.view.ViewCompat; | 10 import android.support.v4.view.ViewCompat; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // Data for native app installs. | 40 // Data for native app installs. |
| 41 private final AppData mAppData; | 41 private final AppData mAppData; |
| 42 private int mInstallState; | 42 private int mInstallState; |
| 43 | 43 |
| 44 // Data for web app installs. | 44 // Data for web app installs. |
| 45 private final String mAppUrl; | 45 private final String mAppUrl; |
| 46 | 46 |
| 47 // Banner for native apps. | 47 // Banner for native apps. |
| 48 private AppBannerInfoBarAndroid( | 48 private AppBannerInfoBarAndroid( |
| 49 long nativeInfoBar, String appTitle, Bitmap iconBitmap, AppData data
) { | 49 long nativeInfoBar, String appTitle, Bitmap iconBitmap, AppData data
) { |
| 50 super(nativeInfoBar, null, 0, iconBitmap, appTitle, null, data.installBu
ttonText(), null); | 50 super(nativeInfoBar, null, null, 0, iconBitmap, appTitle, null, |
| 51 data.installButtonText(), null, null); |
| 51 mAppTitle = appTitle; | 52 mAppTitle = appTitle; |
| 52 mAppData = data; | 53 mAppData = data; |
| 53 mAppUrl = null; | 54 mAppUrl = null; |
| 54 mInstallState = INSTALL_STATE_NOT_INSTALLED; | 55 mInstallState = INSTALL_STATE_NOT_INSTALLED; |
| 55 } | 56 } |
| 56 | 57 |
| 57 // Banner for web apps. | 58 // Banner for web apps. |
| 58 private AppBannerInfoBarAndroid( | 59 private AppBannerInfoBarAndroid( |
| 59 long nativeInfoBar, String appTitle, Bitmap iconBitmap, String url)
{ | 60 long nativeInfoBar, String appTitle, Bitmap iconBitmap, String url)
{ |
| 60 super(nativeInfoBar, null, 0, iconBitmap, appTitle, null, getAddToHomesc
reenText(), null); | 61 super(nativeInfoBar, null, null, 0, iconBitmap, appTitle, null, |
| 62 getAddToHomescreenText(), null, null); |
| 61 mAppTitle = appTitle; | 63 mAppTitle = appTitle; |
| 62 mAppData = null; | 64 mAppData = null; |
| 63 mAppUrl = url; | 65 mAppUrl = url; |
| 64 mInstallState = INSTALL_STATE_NOT_INSTALLED; | 66 mInstallState = INSTALL_STATE_NOT_INSTALLED; |
| 65 } | 67 } |
| 66 | 68 |
| 67 @Override | 69 @Override |
| 68 public void createContent(InfoBarLayout layout) { | 70 public void createContent(InfoBarLayout layout) { |
| 69 super.createContent(layout); | 71 super.createContent(layout); |
| 70 | 72 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 long nativeInfoBar, String appTitle, Bitmap iconBitmap, AppData appD
ata) { | 175 long nativeInfoBar, String appTitle, Bitmap iconBitmap, AppData appD
ata) { |
| 174 return new AppBannerInfoBarAndroid(nativeInfoBar, appTitle, iconBitmap,
appData); | 176 return new AppBannerInfoBarAndroid(nativeInfoBar, appTitle, iconBitmap,
appData); |
| 175 } | 177 } |
| 176 | 178 |
| 177 @CalledByNative | 179 @CalledByNative |
| 178 private static InfoBar createWebAppInfoBar( | 180 private static InfoBar createWebAppInfoBar( |
| 179 long nativeInfoBar, String appTitle, Bitmap iconBitmap, String url)
{ | 181 long nativeInfoBar, String appTitle, Bitmap iconBitmap, String url)
{ |
| 180 return new AppBannerInfoBarAndroid(nativeInfoBar, appTitle, iconBitmap,
url); | 182 return new AppBannerInfoBarAndroid(nativeInfoBar, appTitle, iconBitmap,
url); |
| 181 } | 183 } |
| 182 } | 184 } |
| OLD | NEW |