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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java

Issue 2528303003: [NTP] Fixed usage of NewTabPage.ActionAndroid histogram (Closed)
Patch Set: Changed order of UMA calls in ChromeTabbedActivity.java Created 3 years, 11 months 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.bookmarks; 5 package org.chromium.chrome.browser.bookmarks;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.ComponentName; 8 import android.content.ComponentName;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.Intent; 10 import android.content.Intent;
11 import android.content.SharedPreferences; 11 import android.content.SharedPreferences;
12 import android.net.Uri; 12 import android.net.Uri;
13 import android.provider.Browser; 13 import android.provider.Browser;
14 import android.text.TextUtils; 14 import android.text.TextUtils;
15 15
16 import org.chromium.base.ContextUtils; 16 import org.chromium.base.ContextUtils;
17 import org.chromium.base.VisibleForTesting; 17 import org.chromium.base.VisibleForTesting;
18 import org.chromium.base.metrics.RecordHistogram; 18 import org.chromium.base.metrics.RecordHistogram;
19 import org.chromium.base.metrics.RecordUserAction; 19 import org.chromium.base.metrics.RecordUserAction;
20 import org.chromium.chrome.R; 20 import org.chromium.chrome.R;
21 import org.chromium.chrome.browser.IntentHandler; 21 import org.chromium.chrome.browser.IntentHandler;
22 import org.chromium.chrome.browser.UrlConstants; 22 import org.chromium.chrome.browser.UrlConstants;
23 import org.chromium.chrome.browser.document.ChromeLauncherActivity; 23 import org.chromium.chrome.browser.document.ChromeLauncherActivity;
24 import org.chromium.chrome.browser.ntp.NewTabPageUma;
25 import org.chromium.chrome.browser.snackbar.Snackbar; 24 import org.chromium.chrome.browser.snackbar.Snackbar;
26 import org.chromium.chrome.browser.snackbar.SnackbarManager; 25 import org.chromium.chrome.browser.snackbar.SnackbarManager;
27 import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarController; 26 import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarController;
28 import org.chromium.chrome.browser.tab.Tab; 27 import org.chromium.chrome.browser.tab.Tab;
29 import org.chromium.chrome.browser.util.IntentUtils; 28 import org.chromium.chrome.browser.util.IntentUtils;
30 import org.chromium.components.bookmarks.BookmarkId; 29 import org.chromium.components.bookmarks.BookmarkId;
31 import org.chromium.components.bookmarks.BookmarkType; 30 import org.chromium.components.bookmarks.BookmarkType;
32 import org.chromium.ui.base.DeviceFormFactor; 31 import org.chromium.ui.base.DeviceFormFactor;
33 import org.chromium.ui.base.PageTransition; 32 import org.chromium.ui.base.PageTransition;
34 33
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 * @param bookmarkId ID of the bookmark to be opened. 222 * @param bookmarkId ID of the bookmark to be opened.
224 * @param launchLocation Location from which the bookmark is being opened. 223 * @param launchLocation Location from which the bookmark is being opened.
225 * @return Whether the bookmark was successfully opened. 224 * @return Whether the bookmark was successfully opened.
226 */ 225 */
227 public static boolean openBookmark(BookmarkModel model, Activity activity, 226 public static boolean openBookmark(BookmarkModel model, Activity activity,
228 BookmarkId bookmarkId, int launchLocation) { 227 BookmarkId bookmarkId, int launchLocation) {
229 if (model.getBookmarkById(bookmarkId) == null) return false; 228 if (model.getBookmarkById(bookmarkId) == null) return false;
230 229
231 String url = model.getBookmarkById(bookmarkId).getUrl(); 230 String url = model.getBookmarkById(bookmarkId).getUrl();
232 231
233 NewTabPageUma.recordAction(NewTabPageUma.ACTION_OPENED_BOOKMARK); 232 RecordUserAction.record("MobileBookmarkManagerEntryOpened");
234 RecordHistogram.recordEnumeratedHistogram( 233 RecordHistogram.recordEnumeratedHistogram(
235 "Stars.LaunchLocation", launchLocation, BookmarkLaunchLocation.C OUNT); 234 "Stars.LaunchLocation", launchLocation, BookmarkLaunchLocation.C OUNT);
236 235
237 if (DeviceFormFactor.isTablet(activity)) { 236 if (DeviceFormFactor.isTablet(activity)) {
238 // For tablets, the bookmark manager is open in a tab in the ChromeA ctivity. Use 237 // For tablets, the bookmark manager is open in a tab in the ChromeA ctivity. Use
239 // the ComponentName of the ChromeActivity passed into this method. 238 // the ComponentName of the ChromeActivity passed into this method.
240 openUrl(activity, url, activity.getComponentName()); 239 openUrl(activity, url, activity.getComponentName());
241 } else { 240 } else {
242 // For phones, the bookmark manager is a separate activity. When the activity is 241 // For phones, the bookmark manager is a separate activity. When the activity is
243 // launched, an intent extra is set specifying the parent component. 242 // launched, an intent extra is set specifying the parent component.
(...skipping 26 matching lines...) Expand all
270 269
271 /** 270 /**
272 * Closes the {@link BookmarkActivity} on Phone. Does nothing on tablet. 271 * Closes the {@link BookmarkActivity} on Phone. Does nothing on tablet.
273 */ 272 */
274 public static void finishActivityOnPhone(Context context) { 273 public static void finishActivityOnPhone(Context context) {
275 if (context instanceof BookmarkActivity) { 274 if (context instanceof BookmarkActivity) {
276 ((Activity) context).finish(); 275 ((Activity) context).finish();
277 } 276 }
278 } 277 }
279 } 278 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698