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.ntp; | 5 package org.chromium.chrome.browser.ntp; |
6 | 6 |
7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.app.Dialog; | 9 import android.app.Dialog; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 .setAction(context.getString(R.string.undo), url); | 631 .setAction(context.getString(R.string.undo), url); |
632 mTab.getSnackbarManager().showSnackbar(snackbar); | 632 mTab.getSnackbarManager().showSnackbar(snackbar); |
633 } | 633 } |
634 | 634 |
635 /** @return The view container for the new tab page. */ | 635 /** @return The view container for the new tab page. */ |
636 @VisibleForTesting | 636 @VisibleForTesting |
637 NewTabPageView getNewTabPageView() { | 637 NewTabPageView getNewTabPageView() { |
638 return mNewTabPageView; | 638 return mNewTabPageView; |
639 } | 639 } |
640 | 640 |
| 641 /** @return whether the NTP is using the cards UI. */ |
| 642 public boolean isCardsUiEnabled() { |
| 643 return SnippetsConfig.isEnabled(); |
| 644 } |
| 645 |
641 /** | 646 /** |
642 * Updates whether the NewTabPage should animate on URL focus changes. | 647 * Updates whether the NewTabPage should animate on URL focus changes. |
643 * @param disable Whether to disable the animations. | 648 * @param disable Whether to disable the animations. |
644 */ | 649 */ |
645 public void setUrlFocusAnimationsDisabled(boolean disable) { | 650 public void setUrlFocusAnimationsDisabled(boolean disable) { |
646 mNewTabPageView.setUrlFocusAnimationsDisabled(disable); | 651 mNewTabPageView.setUrlFocusAnimationsDisabled(disable); |
647 } | 652 } |
648 | 653 |
649 private boolean isInSingleUrlBarMode(Context context) { | 654 private boolean isInSingleUrlBarMode(Context context) { |
650 if (DeviceFormFactor.isTablet(context)) return false; | 655 if (DeviceFormFactor.isTablet(context)) return false; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 @Override | 825 @Override |
821 public boolean shouldCaptureThumbnail() { | 826 public boolean shouldCaptureThumbnail() { |
822 return mNewTabPageView.shouldCaptureThumbnail(); | 827 return mNewTabPageView.shouldCaptureThumbnail(); |
823 } | 828 } |
824 | 829 |
825 @Override | 830 @Override |
826 public void captureThumbnail(Canvas canvas) { | 831 public void captureThumbnail(Canvas canvas) { |
827 mNewTabPageView.captureThumbnail(canvas); | 832 mNewTabPageView.captureThumbnail(canvas); |
828 } | 833 } |
829 } | 834 } |
OLD | NEW |