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

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

Issue 2710323003: 🏠 Close the bottom sheet when opening link in incognito (Closed)
Patch Set: Properly make ContentSuggestionsActivity compile Created 3 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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.widget; 5 package org.chromium.chrome.browser.widget;
6 6
7 import android.animation.Animator; 7 import android.animation.Animator;
8 import android.animation.AnimatorListenerAdapter; 8 import android.animation.AnimatorListenerAdapter;
9 import android.animation.ValueAnimator; 9 import android.animation.ValueAnimator;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 385
386 mPlaceholder = new View(getContext()); 386 mPlaceholder = new View(getContext());
387 LayoutParams placeHolderParams = 387 LayoutParams placeHolderParams =
388 new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_P ARENT); 388 new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_P ARENT);
389 mPlaceholder.setBackgroundColor( 389 mPlaceholder.setBackgroundColor(
390 ApiCompatibilityUtils.getColor(getResources(), android.R.color.w hite)); 390 ApiCompatibilityUtils.getColor(getResources(), android.R.color.w hite));
391 mBottomSheetContentContainer.addView(mPlaceholder, placeHolderParams); 391 mBottomSheetContentContainer.addView(mPlaceholder, placeHolderParams);
392 } 392 }
393 393
394 @Override 394 @Override
395 public int loadUrl(LoadUrlParams params) { 395 public int loadUrl(LoadUrlParams params, boolean incognito) {
396 for (BottomSheetObserver o : mObservers) o.onLoadUrl(params.getUrl()); 396 for (BottomSheetObserver o : mObservers) o.onLoadUrl(params.getUrl());
397 397
398 // Native page URLs in this context do not need to communicate with the tab. 398 // Native page URLs in this context do not need to communicate with the tab.
399 if (NativePageFactory.isNativePageUrl(params.getUrl(), isIncognito())) { 399 if (NativePageFactory.isNativePageUrl(params.getUrl(), incognito)) {
400 return TabLoadStatus.PAGE_LOAD_FAILED; 400 return TabLoadStatus.PAGE_LOAD_FAILED;
401 } 401 }
402 402
403 // In all non-native cases, minimize the sheet. 403 // In all non-native cases, minimize the sheet.
404 setSheetState(SHEET_STATE_PEEK, true); 404 setSheetState(SHEET_STATE_PEEK, true);
405 405
406 assert mTabModelSelector != null; 406 assert mTabModelSelector != null;
407 407
408 // First try to get the tab behind the sheet. 408 // First try to get the tab behind the sheet.
409 if (mTabModelSelector.getCurrentTab() != null) { 409 if (getActiveTab() != null && getActiveTab().isIncognito() == incognito) {
410 return mTabModelSelector.getCurrentTab().loadUrl(params); 410 return getActiveTab().loadUrl(params);
411 } 411 }
412 412
413 // If no tab is active behind the sheet, open a new one. 413 // If no compatible tab is active behind the sheet, open a new one.
414 mTabModelSelector.openNewTab( 414 mTabModelSelector.openNewTab(
415 params, TabModel.TabLaunchType.FROM_CHROME_UI, null, isIncognito ()); 415 params, TabModel.TabLaunchType.FROM_CHROME_UI, getActiveTab(), i ncognito);
416 return TabLoadStatus.DEFAULT_PAGE_LOAD; 416 return TabLoadStatus.DEFAULT_PAGE_LOAD;
417 } 417 }
418 418
419 @Override 419 @Override
420 public boolean isIncognito() { 420 public boolean isIncognito() {
421 if (getActiveTab() == null) return false; 421 if (getActiveTab() == null) return false;
422 return getActiveTab().isIncognito(); 422 return getActiveTab().isIncognito();
423 } 423 }
424 424
425 @Override 425 @Override
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 @Override 797 @Override
798 public void onFadingViewVisibilityChanged(boolean visible) {} 798 public void onFadingViewVisibilityChanged(boolean visible) {}
799 799
800 private boolean canMoveSheet() { 800 private boolean canMoveSheet() {
801 boolean isInOverviewMode = mTabModelSelector != null 801 boolean isInOverviewMode = mTabModelSelector != null
802 && (mTabModelSelector.getCurrentTab() == null 802 && (mTabModelSelector.getCurrentTab() == null
803 || mTabModelSelector.getCurrentTab().getActivity().is InOverviewMode()); 803 || mTabModelSelector.getCurrentTab().getActivity().is InOverviewMode());
804 return !isToolbarAndroidViewHidden() && !isInOverviewMode; 804 return !isToolbarAndroidViewHidden() && !isInOverviewMode;
805 } 805 }
806 } 806 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698