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.interests; | 5 package org.chromium.chrome.browser.ntp.interests; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.view.View; | 8 import android.view.View; |
9 | 9 |
10 import org.chromium.base.ApiCompatibilityUtils; | 10 import org.chromium.base.ApiCompatibilityUtils; |
11 import org.chromium.base.metrics.RecordHistogram; | 11 import org.chromium.base.metrics.RecordHistogram; |
12 import org.chromium.base.metrics.RecordUserAction; | 12 import org.chromium.base.metrics.RecordUserAction; |
13 import org.chromium.chrome.R; | 13 import org.chromium.chrome.R; |
14 import org.chromium.chrome.browser.NativePage; | 14 import org.chromium.chrome.browser.NativePage; |
15 import org.chromium.chrome.browser.UrlConstants; | 15 import org.chromium.chrome.browser.UrlConstants; |
16 import org.chromium.chrome.browser.ntp.NewTabPageUma; | 16 import org.chromium.chrome.browser.ntp.NewTabPageUma; |
| 17 import org.chromium.chrome.browser.ntp.NtpColorUtils; |
17 import org.chromium.chrome.browser.ntp.interests.InterestsService.GetInterestsCa
llback; | 18 import org.chromium.chrome.browser.ntp.interests.InterestsService.GetInterestsCa
llback; |
18 import org.chromium.chrome.browser.ntp.interests.InterestsService.Interest; | 19 import org.chromium.chrome.browser.ntp.interests.InterestsService.Interest; |
19 import org.chromium.chrome.browser.profiles.Profile; | 20 import org.chromium.chrome.browser.profiles.Profile; |
20 import org.chromium.chrome.browser.tab.Tab; | 21 import org.chromium.chrome.browser.tab.Tab; |
21 import org.chromium.ui.widget.Toast; | 22 import org.chromium.ui.widget.Toast; |
22 | 23 |
23 import java.util.Arrays; | 24 import java.util.Arrays; |
24 import java.util.List; | 25 import java.util.List; |
25 | 26 |
26 /** | 27 /** |
(...skipping 13 matching lines...) Expand all Loading... |
40 | 41 |
41 /** | 42 /** |
42 * Creates an InterestsPage. | 43 * Creates an InterestsPage. |
43 * | 44 * |
44 * @param context The view context for showing the page. | 45 * @param context The view context for showing the page. |
45 * @param tab The tab from which interests page is loaded. | 46 * @param tab The tab from which interests page is loaded. |
46 * @param profile The profile from which to load interests. | 47 * @param profile The profile from which to load interests. |
47 */ | 48 */ |
48 public InterestsPage(final Context context, Tab tab, Profile profile) { | 49 public InterestsPage(final Context context, Tab tab, Profile profile) { |
49 mTitle = context.getResources().getString(R.string.ntp_interests); | 50 mTitle = context.getResources().getString(R.string.ntp_interests); |
50 mBackgroundColor = ApiCompatibilityUtils.getColor(context.getResources()
, R.color.ntp_bg); | 51 mBackgroundColor = NtpColorUtils.getBackgroundColorResource(context.getR
esources()); |
51 mThemeColor = ApiCompatibilityUtils.getColor( | 52 mThemeColor = ApiCompatibilityUtils.getColor( |
52 context.getResources(), R.color.default_primary_color); | 53 context.getResources(), R.color.default_primary_color); |
53 mPageView = (InterestsView) View.inflate(context, R.layout.interests_pag
e, null); | 54 mPageView = (InterestsView) View.inflate(context, R.layout.interests_pag
e, null); |
54 | 55 |
55 new InterestsService(profile).getInterests( | 56 new InterestsService(profile).getInterests( |
56 new GetInterestsCallback() { | 57 new GetInterestsCallback() { |
57 @Override | 58 @Override |
58 public void onInterestsAvailable(Interest[] interests) { | 59 public void onInterestsAvailable(Interest[] interests) { |
59 boolean gotInterests = interests != null; | 60 boolean gotInterests = interests != null; |
60 RecordHistogram.recordBooleanHistogram( | 61 RecordHistogram.recordBooleanHistogram( |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 141 |
141 @Override | 142 @Override |
142 public String getUrl() { | 143 public String getUrl() { |
143 return UrlConstants.INTERESTS_URL; | 144 return UrlConstants.INTERESTS_URL; |
144 } | 145 } |
145 | 146 |
146 @Override | 147 @Override |
147 public void updateForUrl(String url) { | 148 public void updateForUrl(String url) { |
148 } | 149 } |
149 } | 150 } |
OLD | NEW |