| 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.app.Activity; | 7 import android.app.Activity; |
| 8 import android.graphics.Canvas; | 8 import android.graphics.Canvas; |
| 9 import android.support.v4.view.ViewCompat; | 9 import android.support.v4.view.ViewCompat; |
| 10 import android.view.LayoutInflater; | 10 import android.view.LayoutInflater; |
| 11 import android.view.View; | 11 import android.view.View; |
| 12 import android.widget.TextView; | 12 import android.widget.TextView; |
| 13 | 13 |
| 14 import org.chromium.base.ApiCompatibilityUtils; | 14 import org.chromium.base.ApiCompatibilityUtils; |
| 15 import org.chromium.base.VisibleForTesting; | 15 import org.chromium.base.VisibleForTesting; |
| 16 import org.chromium.chrome.R; | 16 import org.chromium.chrome.R; |
| 17 import org.chromium.chrome.browser.ChromeFeatureList; |
| 17 import org.chromium.chrome.browser.NativePage; | 18 import org.chromium.chrome.browser.NativePage; |
| 18 import org.chromium.chrome.browser.UrlConstants; | 19 import org.chromium.chrome.browser.UrlConstants; |
| 19 import org.chromium.chrome.browser.compositor.layouts.content.InvalidationAwareT
humbnailProvider; | 20 import org.chromium.chrome.browser.compositor.layouts.content.InvalidationAwareT
humbnailProvider; |
| 20 import org.chromium.chrome.browser.help.HelpAndFeedback; | 21 import org.chromium.chrome.browser.help.HelpAndFeedback; |
| 21 import org.chromium.chrome.browser.ntp.IncognitoNewTabPageView.IncognitoNewTabPa
geManager; | 22 import org.chromium.chrome.browser.ntp.IncognitoNewTabPageView.IncognitoNewTabPa
geManager; |
| 22 import org.chromium.chrome.browser.profiles.Profile; | 23 import org.chromium.chrome.browser.profiles.Profile; |
| 23 | 24 |
| 24 /** | 25 /** |
| 25 * Provides functionality when the user interacts with the Incognito NTP. | 26 * Provides functionality when the user interacts with the Incognito NTP. |
| 26 */ | 27 */ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 56 public IncognitoNewTabPage(Activity activity) { | 57 public IncognitoNewTabPage(Activity activity) { |
| 57 mActivity = activity; | 58 mActivity = activity; |
| 58 | 59 |
| 59 mTitle = activity.getResources().getString(R.string.button_new_tab); | 60 mTitle = activity.getResources().getString(R.string.button_new_tab); |
| 60 mBackgroundColor = | 61 mBackgroundColor = |
| 61 ApiCompatibilityUtils.getColor(activity.getResources(), R.color.
ntp_bg_incognito); | 62 ApiCompatibilityUtils.getColor(activity.getResources(), R.color.
ntp_bg_incognito); |
| 62 mThemeColor = ApiCompatibilityUtils.getColor(activity.getResources(), | 63 mThemeColor = ApiCompatibilityUtils.getColor(activity.getResources(), |
| 63 R.color.incognito_primary_color); | 64 R.color.incognito_primary_color); |
| 64 | 65 |
| 65 LayoutInflater inflater = LayoutInflater.from(activity); | 66 LayoutInflater inflater = LayoutInflater.from(activity); |
| 66 mIncognitoNewTabPageView = | 67 mIncognitoNewTabPageView = (IncognitoNewTabPageView) inflater.inflate(us
eMDIncognitoNTP() |
| 67 (IncognitoNewTabPageView) inflater.inflate(R.layout.new_tab_page
_incognito, null); | 68 ? R.layout.new_tab_page_incognito_md |
| 69 : R.layout.new_tab_page_incognito, |
| 70 null); |
| 68 mIncognitoNewTabPageView.initialize(mIncognitoNewTabPageManager); | 71 mIncognitoNewTabPageView.initialize(mIncognitoNewTabPageManager); |
| 69 | 72 |
| 70 TextView newTabIncognitoMessage = (TextView) mIncognitoNewTabPageView.fi
ndViewById( | 73 if (!useMDIncognitoNTP()) { |
| 71 R.id.new_tab_incognito_message); | 74 TextView newTabIncognitoMessage = (TextView) mIncognitoNewTabPageVie
w.findViewById( |
| 72 newTabIncognitoMessage.setText( | 75 R.id.new_tab_incognito_message); |
| 73 activity.getResources().getString(R.string.new_tab_incognito_mes
sage)); | 76 newTabIncognitoMessage.setText( |
| 77 activity.getResources().getString(R.string.new_tab_incognito
_message)); |
| 78 } |
| 79 } |
| 80 |
| 81 private static boolean useMDIncognitoNTP() { |
| 82 return ChromeFeatureList.isEnabled(ChromeFeatureList.MATERIAL_DESIGN_INC
OGNITO_NTP); |
| 74 } | 83 } |
| 75 | 84 |
| 76 /** | 85 /** |
| 77 * @return Whether the NTP has finished loaded. | 86 * @return Whether the NTP has finished loaded. |
| 78 */ | 87 */ |
| 79 @VisibleForTesting | 88 @VisibleForTesting |
| 80 public boolean isLoadedForTests() { | 89 public boolean isLoadedForTests() { |
| 81 return mIsLoaded; | 90 return mIsLoaded; |
| 82 } | 91 } |
| 83 | 92 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 @Override | 142 @Override |
| 134 public boolean shouldCaptureThumbnail() { | 143 public boolean shouldCaptureThumbnail() { |
| 135 return mIncognitoNewTabPageView.shouldCaptureThumbnail(); | 144 return mIncognitoNewTabPageView.shouldCaptureThumbnail(); |
| 136 } | 145 } |
| 137 | 146 |
| 138 @Override | 147 @Override |
| 139 public void captureThumbnail(Canvas canvas) { | 148 public void captureThumbnail(Canvas canvas) { |
| 140 mIncognitoNewTabPageView.captureThumbnail(canvas); | 149 mIncognitoNewTabPageView.captureThumbnail(canvas); |
| 141 } | 150 } |
| 142 } | 151 } |
| OLD | NEW |