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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java

Issue 1716313002: [Herb] Set up field trial for UI prototypes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using variations param Created 4 years, 10 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 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.app.ActivityManager; 8 import android.app.ActivityManager;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.Intent; 10 import android.content.Intent;
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 * Opens a new Tab with the possibility of showing it in a Custom Tab, i nstead. 758 * Opens a new Tab with the possibility of showing it in a Custom Tab, i nstead.
759 * 759 *
760 * See IntentHandler#processUrlViewIntent() for an explanation most of t he parameters. 760 * See IntentHandler#processUrlViewIntent() for an explanation most of t he parameters.
761 * @param forceNewTab If not handled by a Custom Tab, forces the new tab to be created. 761 * @param forceNewTab If not handled by a Custom Tab, forces the new tab to be created.
762 */ 762 */
763 private void openNewTab(String url, String referer, String headers, 763 private void openNewTab(String url, String referer, String headers,
764 String externalAppId, Intent intent, boolean forceNewTab) { 764 String externalAppId, Intent intent, boolean forceNewTab) {
765 boolean isAllowedToReturnToExternalApp = IntentUtils.safeGetBooleanE xtra(intent, 765 boolean isAllowedToReturnToExternalApp = IntentUtils.safeGetBooleanE xtra(intent,
766 ChromeLauncherActivity.EXTRA_IS_ALLOWED_TO_RETURN_TO_PARENT, true); 766 ChromeLauncherActivity.EXTRA_IS_ALLOWED_TO_RETURN_TO_PARENT, true);
767 767
768 String herbFlavor = ChromePreferenceManager.getHerbFlavor(); 768 String herbFlavor = FeatureUtilities.getHerbFlavor();
769 if (isAllowedToReturnToExternalApp 769 if (isAllowedToReturnToExternalApp
770 && ChromeLauncherActivity.canBeHijackedByHerb(intent) 770 && ChromeLauncherActivity.canBeHijackedByHerb(intent)
771 && TextUtils.equals(ChromeSwitches.HERB_FLAVOR_DILL, herbFla vor)) { 771 && TextUtils.equals(ChromeSwitches.HERB_FLAVOR_DILL, herbFla vor)) {
772 Log.d(TAG, "Sending to CustomTabActivity"); 772 Log.d(TAG, "Sending to CustomTabActivity");
773 773
774 Intent newIntent = ChromeLauncherActivity.createCustomTabActivit yIntent( 774 Intent newIntent = ChromeLauncherActivity.createCustomTabActivit yIntent(
775 ChromeTabbedActivity.this, intent, false); 775 ChromeTabbedActivity.this, intent, false);
776 newIntent.putExtra(Browser.EXTRA_APPLICATION_ID, getPackageName( )); 776 newIntent.putExtra(Browser.EXTRA_APPLICATION_ID, getPackageName( ));
777 newIntent.putExtra( 777 newIntent.putExtra(
778 CustomTabIntentDataProvider.EXTRA_OPENED_BY_BROWSER, tru e); 778 CustomTabIntentDataProvider.EXTRA_OPENED_BY_BROWSER, tru e);
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 Log.i(TAG, "handleBackPressedWithoutBackStack() - help url"); 1103 Log.i(TAG, "handleBackPressedWithoutBackStack() - help url");
1104 return true; 1104 return true;
1105 } 1105 }
1106 1106
1107 // Herb: Current spec says that tabs are closed only when there is NO "X " visible, i.e. when 1107 // Herb: Current spec says that tabs are closed only when there is NO "X " visible, i.e. when
1108 // the tab is NOT allowed to return to the external app. 1108 // the tab is NOT allowed to return to the external app.
1109 boolean isAllowedToCloseTab = true; 1109 boolean isAllowedToCloseTab = true;
1110 if (alwaysAllowTabClosure) { 1110 if (alwaysAllowTabClosure) {
1111 isAllowedToCloseTab = true; 1111 isAllowedToCloseTab = true;
1112 } else { 1112 } else {
1113 String herbFlavor = ChromePreferenceManager.getHerbFlavor(); 1113 String herbFlavor = FeatureUtilities.getHerbFlavor();
1114 if (TextUtils.equals(ChromeSwitches.HERB_FLAVOR_BASIL, herbFlavor) 1114 if (TextUtils.equals(ChromeSwitches.HERB_FLAVOR_BASIL, herbFlavor)
1115 || TextUtils.equals(ChromeSwitches.HERB_FLAVOR_CHIVE, herbFl avor)) { 1115 || TextUtils.equals(ChromeSwitches.HERB_FLAVOR_CHIVE, herbFl avor)) {
1116 isAllowedToCloseTab = !currentTab.isAllowedToReturnToExternalApp (); 1116 isAllowedToCloseTab = !currentTab.isAllowedToReturnToExternalApp ();
1117 } 1117 }
1118 } 1118 }
1119 1119
1120 // [true]: Reached the bottom of the back stack on a tab the user did no t explicitly 1120 // [true]: Reached the bottom of the back stack on a tab the user did no t explicitly
1121 // create (i.e. it was created by an external app or opening a link in b ackground, etc). 1121 // create (i.e. it was created by an external app or opening a link in b ackground, etc).
1122 // [false]: Reached the bottom of the back stack on a tab that the user explicitly 1122 // [false]: Reached the bottom of the back stack on a tab that the user explicitly
1123 // created (e.g. selecting "new tab" from menu). 1123 // created (e.g. selecting "new tab" from menu).
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 if (getActivityTab() != null) { 1383 if (getActivityTab() != null) {
1384 setStatusBarColor(getActivityTab(), getActivityTab().getThemeColor() ); 1384 setStatusBarColor(getActivityTab(), getActivityTab().getThemeColor() );
1385 } 1385 }
1386 } 1386 }
1387 1387
1388 @Override 1388 @Override
1389 protected void setStatusBarColor(Tab tab, int color) { 1389 protected void setStatusBarColor(Tab tab, int color) {
1390 super.setStatusBarColor(tab, isInOverviewMode() ? Color.BLACK : color); 1390 super.setStatusBarColor(tab, isInOverviewMode() ? Color.BLACK : color);
1391 } 1391 }
1392 } 1392 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698