| 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.view.LayoutInflater; | 9 import android.view.LayoutInflater; |
| 10 import android.view.View; | 10 import android.view.View; |
| 11 import android.widget.TextView; | 11 import android.widget.TextView; |
| 12 | 12 |
| 13 import org.chromium.base.ApiCompatibilityUtils; | 13 import org.chromium.base.ApiCompatibilityUtils; |
| 14 import org.chromium.base.VisibleForTesting; | 14 import org.chromium.base.VisibleForTesting; |
| 15 import org.chromium.chrome.R; | 15 import org.chromium.chrome.R; |
| 16 import org.chromium.chrome.browser.NativePage; | 16 import org.chromium.chrome.browser.NativePage; |
| 17 import org.chromium.chrome.browser.UrlConstants; | 17 import org.chromium.chrome.browser.UrlConstants; |
| 18 import org.chromium.chrome.browser.compositor.layouts.content.InvalidationAwareT
humbnailProvider; | 18 import org.chromium.chrome.browser.compositor.layouts.content.InvalidationAwareT
humbnailProvider; |
| 19 import org.chromium.chrome.browser.help.HelpAndFeedback; | 19 import org.chromium.chrome.browser.help.HelpAndFeedback; |
| 20 import org.chromium.chrome.browser.ntp.IncognitoNewTabPageView.IncognitoNewTabPa
geManager; | 20 import org.chromium.chrome.browser.ntp.IncognitoNewTabPageView.IncognitoNewTabPa
geManager; |
| 21 import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; | |
| 22 import org.chromium.chrome.browser.profiles.Profile; | 21 import org.chromium.chrome.browser.profiles.Profile; |
| 23 | 22 |
| 24 /** | 23 /** |
| 25 * Provides functionality when the user interacts with the Incognito NTP. | 24 * Provides functionality when the user interacts with the Incognito NTP. |
| 26 */ | 25 */ |
| 27 public class IncognitoNewTabPage implements NativePage, InvalidationAwareThumbna
ilProvider { | 26 public class IncognitoNewTabPage implements NativePage, InvalidationAwareThumbna
ilProvider { |
| 28 private final Activity mActivity; | 27 private final Activity mActivity; |
| 29 | 28 |
| 30 private final String mTitle; | 29 private final String mTitle; |
| 31 private final int mBackgroundColor; | 30 private final int mBackgroundColor; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 62 mThemeColor = ApiCompatibilityUtils.getColor(activity.getResources(), | 61 mThemeColor = ApiCompatibilityUtils.getColor(activity.getResources(), |
| 63 R.color.incognito_primary_color); | 62 R.color.incognito_primary_color); |
| 64 | 63 |
| 65 LayoutInflater inflater = LayoutInflater.from(activity); | 64 LayoutInflater inflater = LayoutInflater.from(activity); |
| 66 mIncognitoNewTabPageView = | 65 mIncognitoNewTabPageView = |
| 67 (IncognitoNewTabPageView) inflater.inflate(R.layout.new_tab_page
_incognito, null); | 66 (IncognitoNewTabPageView) inflater.inflate(R.layout.new_tab_page
_incognito, null); |
| 68 mIncognitoNewTabPageView.initialize(mIncognitoNewTabPageManager); | 67 mIncognitoNewTabPageView.initialize(mIncognitoNewTabPageManager); |
| 69 | 68 |
| 70 TextView newTabIncognitoMessage = (TextView) mIncognitoNewTabPageView.fi
ndViewById( | 69 TextView newTabIncognitoMessage = (TextView) mIncognitoNewTabPageView.fi
ndViewById( |
| 71 R.id.new_tab_incognito_message); | 70 R.id.new_tab_incognito_message); |
| 72 newTabIncognitoMessage.setText(activity.getResources().getString( | 71 newTabIncognitoMessage.setText( |
| 73 OfflinePageUtils.getStringId(R.string.new_tab_incognito_message)
)); | 72 activity.getResources().getString(R.string.new_tab_incognito_mes
sage)); |
| 74 } | 73 } |
| 75 | 74 |
| 76 /** | 75 /** |
| 77 * @return Whether the NTP has finished loaded. | 76 * @return Whether the NTP has finished loaded. |
| 78 */ | 77 */ |
| 79 @VisibleForTesting | 78 @VisibleForTesting |
| 80 public boolean isLoadedForTests() { | 79 public boolean isLoadedForTests() { |
| 81 return mIsLoaded; | 80 return mIsLoaded; |
| 82 } | 81 } |
| 83 | 82 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 @Override | 126 @Override |
| 128 public boolean shouldCaptureThumbnail() { | 127 public boolean shouldCaptureThumbnail() { |
| 129 return mIncognitoNewTabPageView.shouldCaptureThumbnail(); | 128 return mIncognitoNewTabPageView.shouldCaptureThumbnail(); |
| 130 } | 129 } |
| 131 | 130 |
| 132 @Override | 131 @Override |
| 133 public void captureThumbnail(Canvas canvas) { | 132 public void captureThumbnail(Canvas canvas) { |
| 134 mIncognitoNewTabPageView.captureThumbnail(canvas); | 133 mIncognitoNewTabPageView.captureThumbnail(canvas); |
| 135 } | 134 } |
| 136 } | 135 } |
| OLD | NEW |