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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java

Issue 1459593002: Added a UI for the Interests Prototype. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
OLDNEW
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.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.res.Resources; 9 import android.content.res.Resources;
10 import android.graphics.Bitmap; 10 import android.graphics.Bitmap;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 /** 111 /**
112 * Manages the view interaction with the rest of the system. 112 * Manages the view interaction with the rest of the system.
113 */ 113 */
114 public interface NewTabPageManager extends MostVisitedItemManager { 114 public interface NewTabPageManager extends MostVisitedItemManager {
115 /** @return Whether the location bar is shown in the NTP. */ 115 /** @return Whether the location bar is shown in the NTP. */
116 boolean isLocationBarShownInNTP(); 116 boolean isLocationBarShownInNTP();
117 117
118 /** @return Whether voice search is enabled and the microphone should be shown. */ 118 /** @return Whether voice search is enabled and the microphone should be shown. */
119 boolean isVoiceSearchEnabled(); 119 boolean isVoiceSearchEnabled();
120 120
121 /** @return Whether the user is signed in. */
122 boolean isUserSignedIn();
123
121 /** @return Whether the document mode opt out promo should be shown. */ 124 /** @return Whether the document mode opt out promo should be shown. */
122 boolean shouldShowOptOutPromo(); 125 boolean shouldShowOptOutPromo();
123 126
124 /** Called when the document mode opt out promo is shown. */ 127 /** Called when the document mode opt out promo is shown. */
125 void optOutPromoShown(); 128 void optOutPromoShown();
126 129
127 /** Called when the user clicks "settings" or "ok, got it" on the opt ou t promo. */ 130 /** Called when the user clicks "settings" or "ok, got it" on the opt ou t promo. */
128 void optOutPromoClicked(boolean settingsClicked); 131 void optOutPromoClicked(boolean settingsClicked);
129 132
130 /** Opens the bookmarks page in the current tab. */ 133 /** Opens the bookmarks page in the current tab. */
131 void navigateToBookmarks(); 134 void navigateToBookmarks();
132 135
133 /** Opens the recent tabs page in the current tab. */ 136 /** Opens the recent tabs page in the current tab. */
134 void navigateToRecentTabs(); 137 void navigateToRecentTabs();
135 138
136 /** Opens a given URL in the current tab. */ 139 /** Opens a given URL in the current tab. */
137 void open(String url); 140 void open(String url);
138 141
142 /** Opens the interests dialog. */
143 void navigateToInterests();
144
139 /** 145 /**
140 * Animates the search box up into the omnibox and bring up the keyboard . 146 * Animates the search box up into the omnibox and bring up the keyboard .
141 * @param beginVoiceSearch Whether to begin a voice search. 147 * @param beginVoiceSearch Whether to begin a voice search.
142 * @param pastedText Text to paste in the omnibox after it's been focuse d. May be null. 148 * @param pastedText Text to paste in the omnibox after it's been focuse d. May be null.
143 */ 149 */
144 void focusSearchBox(boolean beginVoiceSearch, String pastedText); 150 void focusSearchBox(boolean beginVoiceSearch, String pastedText);
145 151
146 /** 152 /**
147 * Gets the list of most visited sites. 153 * Gets the list of most visited sites.
148 * @param observer The observer to be notified with the list of sites. 154 * @param observer The observer to be notified with the list of sites.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 public void onClick(View v) { 305 public void onClick(View v) {
300 mManager.navigateToRecentTabs(); 306 mManager.navigateToRecentTabs();
301 } 307 }
302 }); 308 });
303 toolbar.getBookmarksButton().setOnClickListener(new View.OnClickListener () { 309 toolbar.getBookmarksButton().setOnClickListener(new View.OnClickListener () {
304 @Override 310 @Override
305 public void onClick(View v) { 311 public void onClick(View v) {
306 mManager.navigateToBookmarks(); 312 mManager.navigateToBookmarks();
307 } 313 }
308 }); 314 });
315 toolbar.getInterestsButton().setOnClickListener(new View.OnClickListener () {
316 @Override
317 public void onClick(View v) {
318 mManager.navigateToInterests();
319 }
320 });
309 321
310 initializeSearchBoxScrollHandling(); 322 initializeSearchBoxScrollHandling();
311 addOnLayoutChangeListener(this); 323 addOnLayoutChangeListener(this);
312 setSearchProviderHasLogo(searchProviderHasLogo); 324 setSearchProviderHasLogo(searchProviderHasLogo);
313 325
314 mPendingLoadTasks++; 326 mPendingLoadTasks++;
315 mManager.setMostVisitedURLsObserver(this, 327 mManager.setMostVisitedURLsObserver(this,
316 mMostVisitedDesign.getNumberOfTiles(searchProviderHasLogo)); 328 mMostVisitedDesign.getNumberOfTiles(searchProviderHasLogo));
317 329
318 if (mManager.shouldShowOptOutPromo()) showOptOutPromo(); 330 if (mManager.shouldShowOptOutPromo()) showOptOutPromo();
(...skipping 14 matching lines...) Expand all
333 RecordUserAction.record("MobileNTP.Snippets.Scrolled"); 345 RecordUserAction.record("MobileNTP.Snippets.Scrolled");
334 if (mScrolledOnce) return; 346 if (mScrolledOnce) return;
335 mScrolledOnce = true; 347 mScrolledOnce = true;
336 RecordHistogram.recordEnumeratedHistogram( 348 RecordHistogram.recordEnumeratedHistogram(
337 SnippetsManager.SNIPPETS_STATE_HISTOGRAM, 349 SnippetsManager.SNIPPETS_STATE_HISTOGRAM,
338 SnippetsManager.SNIPPETS_SCROLLED, 350 SnippetsManager.SNIPPETS_SCROLLED,
339 SnippetsManager.NUM_SNIPPETS_ACTIONS); 351 SnippetsManager.NUM_SNIPPETS_ACTIONS);
340 } 352 }
341 }); 353 });
342 } 354 }
355
356 // Set up interests
357 // TODO(peconn): If the user is not signed in, show Interests button tha t leads to sign-in.
358 if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_NTP_INTERE STS)
newt (away) 2015/12/14 21:18:39 Better: add a method isInterestsEnabled() in NewTa
PEConn 2015/12/15 11:50:15 Done.
359 && manager.isUserSignedIn()) {
360 toolbar.getInterestsButton().setVisibility(View.VISIBLE);
361 }
343 } 362 }
344 363
345 private int getTabsMovedIllustration() { 364 private int getTabsMovedIllustration() {
346 switch (Build.MANUFACTURER.toLowerCase(Locale.US)) { 365 switch (Build.MANUFACTURER.toLowerCase(Locale.US)) {
347 case "samsung": 366 case "samsung":
348 if (DocumentModeManager.isDeviceTabbedModeByDefault()) return 0; 367 if (DocumentModeManager.isDeviceTabbedModeByDefault()) return 0;
349 return R.drawable.tabs_moved_samsung; 368 return R.drawable.tabs_moved_samsung;
350 case "htc": 369 case "htc":
351 return R.drawable.tabs_moved_htc; 370 return R.drawable.tabs_moved_htc;
352 default: 371 default:
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 for (MostVisitedItem item : mMostVisitedItems) { 981 for (MostVisitedItem item : mMostVisitedItems) {
963 if (item.getUrl().equals(url)) { 982 if (item.getUrl().equals(url)) {
964 LargeIconCallback iconCallback = new LargeIconCallbackImpl(i tem, false); 983 LargeIconCallback iconCallback = new LargeIconCallbackImpl(i tem, false);
965 mManager.getLargeIconForUrl(url, mMinIconSize, iconCallback) ; 984 mManager.getLargeIconForUrl(url, mMinIconSize, iconCallback) ;
966 break; 985 break;
967 } 986 }
968 } 987 }
969 } 988 }
970 } 989 }
971 } 990 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698