| 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.webapps; | 5 package org.chromium.chrome.browser.webapps; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 | 9 |
| 10 import org.chromium.base.ApplicationStatus; | 10 import org.chromium.base.ApplicationStatus; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 /** | 42 /** |
| 43 * Gets all the information required to initialize the UI. The observer wil
l be notified as | 43 * Gets all the information required to initialize the UI. The observer wil
l be notified as |
| 44 * information required for the shortcut become available. | 44 * information required for the shortcut become available. |
| 45 * @param observer Observer to notify. | 45 * @param observer Observer to notify. |
| 46 */ | 46 */ |
| 47 public void initialize(Observer observer) { | 47 public void initialize(Observer observer) { |
| 48 mObserver = observer; | 48 mObserver = observer; |
| 49 mNativeAddToHomescreenDialogHelper = nativeInitialize( | 49 mNativeAddToHomescreenDialogHelper = nativeInitialize( |
| 50 mTab.getWebContents(), | 50 mTab.getWebContents()); |
| 51 ShortcutHelper.getIdealSplashImageSizeInDp(mAppContext.getResour
ces()), | |
| 52 ShortcutHelper.getIdealIconSizeInDp(mAppContext.getResources()))
; | |
| 53 } | 51 } |
| 54 | 52 |
| 55 /** | 53 /** |
| 56 * Returns whether the object is initialized. | 54 * Returns whether the object is initialized. |
| 57 */ | 55 */ |
| 58 public boolean isInitialized() { | 56 public boolean isInitialized() { |
| 59 return mIsInitialized; | 57 return mIsInitialized; |
| 60 } | 58 } |
| 61 | 59 |
| 62 /** | 60 /** |
| (...skipping 30 matching lines...) Expand all Loading... |
| 93 /** | 91 /** |
| 94 * Creates an icon that is acceptable to show on the launcher. | 92 * Creates an icon that is acceptable to show on the launcher. |
| 95 */ | 93 */ |
| 96 @CalledByNative | 94 @CalledByNative |
| 97 private static Bitmap finalizeLauncherIcon( | 95 private static Bitmap finalizeLauncherIcon( |
| 98 String url, Bitmap icon, int red, int green, int blue) { | 96 String url, Bitmap icon, int red, int green, int blue) { |
| 99 return ShortcutHelper.createLauncherIcon( | 97 return ShortcutHelper.createLauncherIcon( |
| 100 ApplicationStatus.getApplicationContext(), icon, url, red, green
, blue); | 98 ApplicationStatus.getApplicationContext(), icon, url, red, green
, blue); |
| 101 } | 99 } |
| 102 | 100 |
| 103 private native long nativeInitialize(WebContents webContents, | 101 private native long nativeInitialize(WebContents webContents); |
| 104 int idealSplashImageSizeInDp, int idealIconSizeInDp); | |
| 105 private native void nativeAddShortcut(long nativeAddToHomescreenDialogHelper
, | 102 private native void nativeAddShortcut(long nativeAddToHomescreenDialogHelper
, |
| 106 String userRequestedTitle); | 103 String userRequestedTitle); |
| 107 private native void nativeDestroy(long nativeAddToHomescreenDialogHelper); | 104 private native void nativeDestroy(long nativeAddToHomescreenDialogHelper); |
| 108 } | 105 } |
| OLD | NEW |