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.bookmark; | 5 package org.chromium.chrome.browser.bookmark; |
6 | 6 |
7 import android.content.Intent; | 7 import android.content.Intent; |
8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
9 import android.graphics.Color; | 9 import android.graphics.Color; |
10 import android.view.ViewGroup; | 10 import android.view.ViewGroup; |
11 | 11 |
| 12 import org.chromium.base.metrics.RecordUserAction; |
12 import org.chromium.chrome.R; | 13 import org.chromium.chrome.R; |
13 import org.chromium.chrome.browser.BookmarkUtils; | 14 import org.chromium.chrome.browser.BookmarkUtils; |
| 15 import org.chromium.chrome.browser.ShortcutHelper; |
| 16 import org.chromium.chrome.browser.Source; |
14 import org.chromium.chrome.browser.UrlConstants; | 17 import org.chromium.chrome.browser.UrlConstants; |
15 import org.chromium.chrome.browser.favicon.FaviconHelper; | 18 import org.chromium.chrome.browser.favicon.FaviconHelper; |
16 import org.chromium.chrome.browser.init.AsyncInitializationActivity; | 19 import org.chromium.chrome.browser.init.AsyncInitializationActivity; |
17 import org.chromium.chrome.browser.ntp.BookmarksPage; | 20 import org.chromium.chrome.browser.ntp.BookmarksPage; |
18 import org.chromium.chrome.browser.ntp.BookmarksPage.BookmarkSelectedListener; | 21 import org.chromium.chrome.browser.ntp.BookmarksPage.BookmarkSelectedListener; |
19 import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksShim; | 22 import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksShim; |
20 import org.chromium.chrome.browser.profiles.Profile; | 23 import org.chromium.chrome.browser.profiles.Profile; |
21 | 24 |
22 /** | 25 /** |
23 * Activity that allows the user to select a bookmark to add to their homescreen
as a shortcut. | 26 * Activity that allows the user to select a bookmark to add to their homescreen
as a shortcut. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 @Override | 69 @Override |
67 public void onNewTabOpened() { | 70 public void onNewTabOpened() { |
68 } | 71 } |
69 | 72 |
70 @Override | 73 @Override |
71 public void onBookmarkSelected(String url, String title, Bitmap favicon) { | 74 public void onBookmarkSelected(String url, String title, Bitmap favicon) { |
72 int dominantColor = FaviconHelper.getDominantColorForBitmap(favicon); | 75 int dominantColor = FaviconHelper.getDominantColorForBitmap(favicon); |
73 Bitmap launcherIcon = BookmarkUtils.createLauncherIcon(this, favicon, ur
l, | 76 Bitmap launcherIcon = BookmarkUtils.createLauncherIcon(this, favicon, ur
l, |
74 Color.red(dominantColor), Color.green(dominantColor), Color.blue
(dominantColor)); | 77 Color.red(dominantColor), Color.green(dominantColor), Color.blue
(dominantColor)); |
75 Intent intent = BookmarkUtils.createAddToHomeIntent(url, title, launcher
Icon); | 78 Intent intent = BookmarkUtils.createAddToHomeIntent(url, title, launcher
Icon); |
| 79 intent.putExtra(ShortcutHelper.EXTRA_SOURCE, Source.BOOKMARK_SHORTCUT_WI
DGET); |
76 setResult(RESULT_OK, intent); | 80 setResult(RESULT_OK, intent); |
| 81 RecordUserAction.record("BookmarkShortcutWidgetAdded"); |
77 finish(); | 82 finish(); |
78 } | 83 } |
79 | 84 |
80 @Override | 85 @Override |
81 public void onResumeWithNative() { } | 86 public void onResumeWithNative() { } |
82 | 87 |
83 @Override | 88 @Override |
84 public void onPauseWithNative() { } | 89 public void onPauseWithNative() { } |
85 | 90 |
86 @Override | 91 @Override |
87 public void onStopWithNative() { } | 92 public void onStopWithNative() { } |
88 } | 93 } |
OLD | NEW |