Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: chrome/android/java/src/android/support/customtabs/CustomTabsIntent.java

Issue 1716683002: [Custom Tabs] Allow clients to display RemoteViews on the bottom bar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make findbug happy Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 android.support.customtabs; 5 package android.support.customtabs;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.app.ActivityOptions; 8 import android.app.ActivityOptions;
9 import android.app.PendingIntent; 9 import android.app.PendingIntent;
10 import android.content.Intent; 10 import android.content.Intent;
11 import android.graphics.Bitmap; 11 import android.graphics.Bitmap;
12 import android.graphics.Color; 12 import android.graphics.Color;
13 import android.net.Uri; 13 import android.net.Uri;
14 import android.os.Build; 14 import android.os.Build;
15 import android.os.Bundle; 15 import android.os.Bundle;
16 import android.os.IBinder; 16 import android.os.IBinder;
17 import android.widget.RemoteViews;
17 18
18 import java.lang.reflect.InvocationTargetException; 19 import java.lang.reflect.InvocationTargetException;
19 import java.lang.reflect.Method; 20 import java.lang.reflect.Method;
20 import java.util.ArrayList; 21 import java.util.ArrayList;
21 22
22 /** 23 /**
23 * Constants and utilities that will be used for low level control on customizin g the UI and 24 * Constants and utilities that will be used for low level control on customizin g the UI and
24 * functionality of a tab. 25 * functionality of a tab.
25 */ 26 */
26 public class CustomTabsIntent { 27 public class CustomTabsIntent {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 public static final int TOOLBAR_ACTION_BUTTON_ID = 0; 156 public static final int TOOLBAR_ACTION_BUTTON_ID = 0;
156 157
157 /** 158 /**
158 * Extra that changes the background color for the secondary toolbar. The va lue should be an 159 * Extra that changes the background color for the secondary toolbar. The va lue should be an
159 * int that specifies a {@link Color}, not a resource id. 160 * int that specifies a {@link Color}, not a resource id.
160 */ 161 */
161 public static final String EXTRA_SECONDARY_TOOLBAR_COLOR = 162 public static final String EXTRA_SECONDARY_TOOLBAR_COLOR =
162 "android.support.customtabs.extra.SECONDARY_TOOLBAR_COLOR"; 163 "android.support.customtabs.extra.SECONDARY_TOOLBAR_COLOR";
163 164
164 /** 165 /**
166 * Extra that specifies the {@link RemoteViews} showing on the secondary too lbar. If this extra
167 * is set, the other secondary toolbar configurations will be overriden. The height of the
168 * {@link RemoteViews} should not exceed 56dp.
169 */
170 public static final String EXTRA_SECONDARY_TOOLBAR_REMOTEVIEWS =
171 "android.support.customtabs.extra.EXTRA_SECONDARY_TOOLBAR_REMOTEVIEW S";
172
173 /**
165 * Convenience method to create a VIEW intent without a session for the give n package. 174 * Convenience method to create a VIEW intent without a session for the give n package.
166 * @param packageName The package name to set in the intent. 175 * @param packageName The package name to set in the intent.
167 * @param data The data {@link Uri} to be used in the intent. 176 * @param data The data {@link Uri} to be used in the intent.
168 * @return The intent with the given package, data and the right session extra. 177 * @return The intent with the given package, data and the right session extra.
169 */ 178 */
170 public static Intent getViewIntentWithNoSession(String packageName, Uri data ) { 179 public static Intent getViewIntentWithNoSession(String packageName, Uri data ) {
171 Intent intent = new Intent(Intent.ACTION_VIEW, data); 180 Intent intent = new Intent(Intent.ACTION_VIEW, data);
172 intent.setPackage(packageName); 181 intent.setPackage(packageName);
173 Bundle extras = new Bundle(); 182 Bundle extras = new Bundle();
174 if (!safePutBinder(extras, EXTRA_SESSION, null)) return null; 183 if (!safePutBinder(extras, EXTRA_SESSION, null)) return null;
(...skipping 18 matching lines...) Expand all
193 Bundle.class.getMethod("putIBinder", String.class, IBind er.class); 202 Bundle.class.getMethod("putIBinder", String.class, IBind er.class);
194 putBinderMethod.invoke(bundle, key, binder); 203 putBinderMethod.invoke(bundle, key, binder);
195 } 204 }
196 } catch (InvocationTargetException | IllegalAccessException | IllegalArg umentException 205 } catch (InvocationTargetException | IllegalAccessException | IllegalArg umentException
197 | NoSuchMethodException e) { 206 | NoSuchMethodException e) {
198 return false; 207 return false;
199 } 208 }
200 return true; 209 return true;
201 } 210 }
202 } 211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698