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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/bookmarkswidget/BookmarkWidgetProxy.java

Issue 1288903002: Refactor ShortcutHelper and merge in BookmarkUtils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Readd missing files Created 5 years, 4 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.bookmarkswidget; 5 package org.chromium.chrome.browser.bookmarkswidget;
6 6
7 import android.content.BroadcastReceiver; 7 import android.content.BroadcastReceiver;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.util.Log; 10 import android.util.Log;
11 11
12 import org.chromium.chrome.browser.BookmarkUtils;
13 import org.chromium.chrome.browser.ShortcutHelper; 12 import org.chromium.chrome.browser.ShortcutHelper;
14 import org.chromium.chrome.browser.ShortcutSource; 13 import org.chromium.chrome.browser.ShortcutSource;
15 import org.chromium.chrome.browser.document.ChromeLauncherActivity; 14 import org.chromium.chrome.browser.document.ChromeLauncherActivity;
16 15
17 /** 16 /**
18 * Proxy that responds to tapping on the Bookmarks widget. 17 * Proxy that responds to tapping on the Bookmarks widget.
19 */ 18 */
20 public class BookmarkWidgetProxy extends BroadcastReceiver { 19 public class BookmarkWidgetProxy extends BroadcastReceiver {
21 private static final String TAG = "BookmarkWidgetProxy"; 20 private static final String TAG = "BookmarkWidgetProxy";
22 21
23 @Override 22 @Override
24 public void onReceive(Context context, Intent intent) { 23 public void onReceive(Context context, Intent intent) {
25 if (BookmarkThumbnailWidgetService.getChangeFolderAction(context) 24 if (BookmarkThumbnailWidgetService.getChangeFolderAction(context)
26 .equals(intent.getAction())) { 25 .equals(intent.getAction())) {
27 BookmarkThumbnailWidgetService.changeFolder(context, intent); 26 BookmarkThumbnailWidgetService.changeFolder(context, intent);
28 } else { 27 } else {
29 Intent view = new Intent(intent); 28 Intent view = new Intent(intent);
30 view.setClass(context, ChromeLauncherActivity.class); 29 view.setClass(context, ChromeLauncherActivity.class);
31 view.putExtra(ShortcutHelper.EXTRA_SOURCE, ShortcutSource.BOOKMARK_N AVIGATOR_WIDGET); 30 view.putExtra(ShortcutHelper.EXTRA_SOURCE, ShortcutSource.BOOKMARK_N AVIGATOR_WIDGET);
32 view.putExtra(BookmarkUtils.REUSE_URL_MATCHING_TAB_ELSE_NEW_TAB, tru e); 31 view.putExtra(ShortcutHelper.REUSE_URL_MATCHING_TAB_ELSE_NEW_TAB, tr ue);
33 startActivity(context, view); 32 startActivity(context, view);
34 } 33 }
35 } 34 }
36 35
37 void startActivity(Context context, Intent intent) { 36 void startActivity(Context context, Intent intent) {
38 try { 37 try {
39 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 38 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
40 context.startActivity(intent); 39 context.startActivity(intent);
41 } catch (Exception e) { 40 } catch (Exception e) {
42 Log.w(TAG, "Failed to start intent activity", e); 41 Log.w(TAG, "Failed to start intent activity", e);
43 } 42 }
44 } 43 }
45 } 44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698