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.ActivityManager; | 7 import android.app.ActivityManager; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.graphics.Bitmap; | 10 import android.graphics.Bitmap; |
(...skipping 22 matching lines...) Expand all Loading... |
33 public static void setFullScreenAction(String fullScreenAction) { | 33 public static void setFullScreenAction(String fullScreenAction) { |
34 sFullScreenAction = fullScreenAction; | 34 sFullScreenAction = fullScreenAction; |
35 } | 35 } |
36 | 36 |
37 /** | 37 /** |
38 * Adds a shortcut for the current Tab. | 38 * Adds a shortcut for the current Tab. |
39 * @param appContext The application context. | 39 * @param appContext The application context. |
40 * @param tab Tab to create a shortcut for. | 40 * @param tab Tab to create a shortcut for. |
41 * @param userRequestedTitle Updated title for the shortcut. | 41 * @param userRequestedTitle Updated title for the shortcut. |
42 */ | 42 */ |
43 public static void addShortcut(Context appContext, TabBase tab, String userR
equestedTitle) { | 43 public static void addShortcut(Context appContext, Tab tab, String userReque
stedTitle) { |
44 if (TextUtils.isEmpty(sFullScreenAction)) { | 44 if (TextUtils.isEmpty(sFullScreenAction)) { |
45 Log.e("ShortcutHelper", "ShortcutHelper is uninitialized. Aborting.
"); | 45 Log.e("ShortcutHelper", "ShortcutHelper is uninitialized. Aborting.
"); |
46 return; | 46 return; |
47 } | 47 } |
48 ActivityManager am = (ActivityManager) appContext.getSystemService( | 48 ActivityManager am = (ActivityManager) appContext.getSystemService( |
49 Context.ACTIVITY_SERVICE); | 49 Context.ACTIVITY_SERVICE); |
50 nativeAddShortcut(tab.getNativePtr(), userRequestedTitle, am.getLauncher
LargeIconSize()); | 50 nativeAddShortcut(tab.getNativePtr(), userRequestedTitle, am.getLauncher
LargeIconSize()); |
51 } | 51 } |
52 | 52 |
53 /** | 53 /** |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // User is sent to the homescreen as soon as the shortcut is created. | 88 // User is sent to the homescreen as soon as the shortcut is created. |
89 Intent homeIntent = new Intent(Intent.ACTION_MAIN); | 89 Intent homeIntent = new Intent(Intent.ACTION_MAIN); |
90 homeIntent.addCategory(Intent.CATEGORY_HOME); | 90 homeIntent.addCategory(Intent.CATEGORY_HOME); |
91 homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 91 homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
92 context.startActivity(homeIntent); | 92 context.startActivity(homeIntent); |
93 } | 93 } |
94 | 94 |
95 private static native void nativeAddShortcut(long tabAndroidPtr, String user
RequestedTitle, | 95 private static native void nativeAddShortcut(long tabAndroidPtr, String user
RequestedTitle, |
96 int launcherLargeIconSize); | 96 int launcherLargeIconSize); |
97 } | 97 } |
OLD | NEW |