| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.suggestions; | 5 package org.chromium.chrome.browser.suggestions; |
| 6 | 6 |
| 7 import org.chromium.base.annotations.JNIAdditionalImport; | 7 import org.chromium.base.annotations.JNIAdditionalImport; |
| 8 import org.chromium.chrome.browser.ntp.MostVisitedTileType.MostVisitedTileTypeEn
um; | |
| 9 import org.chromium.chrome.browser.ntp.NTPTileSource.NTPTileSourceEnum; | |
| 10 import org.chromium.chrome.browser.profiles.Profile; | 8 import org.chromium.chrome.browser.profiles.Profile; |
| 9 import org.chromium.chrome.browser.suggestions.TileSource.TileSourceEnum; |
| 10 import org.chromium.chrome.browser.suggestions.TileVisualType.TileVisualTypeEnum
; |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * Methods to bridge into native history to provide most recent urls, titles and
thumbnails. | 13 * Methods to bridge into native history to provide most recent urls, titles and
thumbnails. |
| 14 */ | 14 */ |
| 15 @JNIAdditionalImport(MostVisitedSites.class) // Needed for the Observer usage in
the native calls. | 15 @JNIAdditionalImport(MostVisitedSites.class) // Needed for the Observer usage in
the native calls. |
| 16 public class MostVisitedSitesBridge implements MostVisitedSites { | 16 public class MostVisitedSitesBridge implements MostVisitedSites { |
| 17 private long mNativeMostVisitedSitesBridge; | 17 private long mNativeMostVisitedSitesBridge; |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * MostVisitedSites constructor requires a valid user profile object. | 20 * MostVisitedSites constructor requires a valid user profile object. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 nativeAddOrRemoveBlacklistedUrl(mNativeMostVisitedSitesBridge, url, fals
e); | 67 nativeAddOrRemoveBlacklistedUrl(mNativeMostVisitedSitesBridge, url, fals
e); |
| 68 } | 68 } |
| 69 | 69 |
| 70 @Override | 70 @Override |
| 71 public void recordPageImpression(int[] tileTypes, int[] sources, String[] ti
leUrls) { | 71 public void recordPageImpression(int[] tileTypes, int[] sources, String[] ti
leUrls) { |
| 72 nativeRecordPageImpression(mNativeMostVisitedSitesBridge, tileTypes, sou
rces, tileUrls); | 72 nativeRecordPageImpression(mNativeMostVisitedSitesBridge, tileTypes, sou
rces, tileUrls); |
| 73 } | 73 } |
| 74 | 74 |
| 75 @Override | 75 @Override |
| 76 public void recordOpenedMostVisitedItem( | 76 public void recordOpenedMostVisitedItem( |
| 77 int index, @MostVisitedTileTypeEnum int type, @NTPTileSourceEnum int
source) { | 77 int index, @TileVisualTypeEnum int type, @TileSourceEnum int source)
{ |
| 78 nativeRecordOpenedMostVisitedItem(mNativeMostVisitedSitesBridge, index,
type, source); | 78 nativeRecordOpenedMostVisitedItem(mNativeMostVisitedSitesBridge, index,
type, source); |
| 79 } | 79 } |
| 80 | 80 |
| 81 private native long nativeInit(Profile profile); | 81 private native long nativeInit(Profile profile); |
| 82 private native void nativeDestroy(long nativeMostVisitedSitesBridge); | 82 private native void nativeDestroy(long nativeMostVisitedSitesBridge); |
| 83 private native void nativeSetObserver( | 83 private native void nativeSetObserver( |
| 84 long nativeMostVisitedSitesBridge, MostVisitedSites.Observer observe
r, int numSites); | 84 long nativeMostVisitedSitesBridge, MostVisitedSites.Observer observe
r, int numSites); |
| 85 private native void nativeAddOrRemoveBlacklistedUrl( | 85 private native void nativeAddOrRemoveBlacklistedUrl( |
| 86 long nativeMostVisitedSitesBridge, String url, boolean addUrl); | 86 long nativeMostVisitedSitesBridge, String url, boolean addUrl); |
| 87 private native void nativeRecordPageImpression( | 87 private native void nativeRecordPageImpression( |
| 88 long nativeMostVisitedSitesBridge, int[] tileTypes, int[] sources, S
tring[] tileUrls); | 88 long nativeMostVisitedSitesBridge, int[] tileTypes, int[] sources, S
tring[] tileUrls); |
| 89 private native void nativeRecordOpenedMostVisitedItem( | 89 private native void nativeRecordOpenedMostVisitedItem( |
| 90 long nativeMostVisitedSitesBridge, int index, int tileType, int sour
ce); | 90 long nativeMostVisitedSitesBridge, int index, int tileType, int sour
ce); |
| 91 } | 91 } |
| OLD | NEW |