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.snippets; | 5 package org.chromium.chrome.browser.ntp.snippets; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.content.res.Resources; | 8 import android.content.res.Resources; |
9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
10 import android.graphics.drawable.BitmapDrawable; | 10 import android.graphics.drawable.BitmapDrawable; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 updateLayout(); | 103 updateLayout(); |
104 } | 104 } |
105 }); | 105 }); |
106 | 106 |
107 mUseFaviconService = CardsVariationParameters.isFaviconServiceEnabled(); | 107 mUseFaviconService = CardsVariationParameters.isFaviconServiceEnabled(); |
108 } | 108 } |
109 | 109 |
110 @Override | 110 @Override |
111 public void onImpression() { | 111 public void onImpression() { |
112 if (mArticle != null && mArticle.trackImpression()) { | 112 if (mArticle != null && mArticle.trackImpression()) { |
113 mNewTabPageManager.trackSnippetImpression(mArticle); | 113 mNewTabPageManager.getSuggestionsMetricsReporter().onSuggestionShown
(mArticle); |
114 mRecyclerView.onSnippetImpression(); | 114 mRecyclerView.onSnippetImpression(); |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 @Override | 118 @Override |
119 public void onCardTapped() { | 119 public void onCardTapped() { |
120 mNewTabPageManager.openSnippet(WindowOpenDisposition.CURRENT_TAB, mArtic
le); | 120 mNewTabPageManager.openSnippet(WindowOpenDisposition.CURRENT_TAB, mArtic
le); |
121 } | 121 } |
122 | 122 |
123 @Override | 123 @Override |
(...skipping 20 matching lines...) Expand all Loading... |
144 } | 144 } |
145 if (mArticle.isRecentTab()) { | 145 if (mArticle.isRecentTab()) { |
146 if (menuItemId == ContextMenuManager.ID_REMOVE) return true; | 146 if (menuItemId == ContextMenuManager.ID_REMOVE) return true; |
147 return false; | 147 return false; |
148 } | 148 } |
149 return true; | 149 return true; |
150 } | 150 } |
151 | 151 |
152 @Override | 152 @Override |
153 public void onContextMenuCreated() { | 153 public void onContextMenuCreated() { |
154 mNewTabPageManager.trackSnippetMenuOpened(mArticle); | 154 mNewTabPageManager.getSuggestionsMetricsReporter().onSuggestionMenuOpene
d(mArticle); |
155 } | 155 } |
156 | 156 |
157 @Override | 157 @Override |
158 protected Delegate getContextMenuDelegate() { | 158 protected Delegate getContextMenuDelegate() { |
159 return this; | 159 return this; |
160 } | 160 } |
161 | 161 |
162 /** | 162 /** |
163 * Updates the layout taking into account screen dimensions and the type of
snippet displayed. | 163 * Updates the layout taking into account screen dimensions and the type of
snippet displayed. |
164 */ | 164 */ |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 ApiCompatibilityUtils.setCompoundDrawablesRelative( | 411 ApiCompatibilityUtils.setCompoundDrawablesRelative( |
412 mPublisherTextView, drawable, null, null, null); | 412 mPublisherTextView, drawable, null, null, null); |
413 mPublisherTextView.setVisibility(View.VISIBLE); | 413 mPublisherTextView.setVisibility(View.VISIBLE); |
414 } | 414 } |
415 | 415 |
416 @Override | 416 @Override |
417 public boolean isDismissable() { | 417 public boolean isDismissable() { |
418 return !isPeeking(); | 418 return !isPeeking(); |
419 } | 419 } |
420 } | 420 } |
OLD | NEW |