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.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; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 }, Snackbar.TYPE_NOTIFICATION, Snackbar.UMA_BOOKMARK_ADDED) | 84 }, Snackbar.TYPE_NOTIFICATION, Snackbar.UMA_BOOKMARK_ADDED) |
85 .setSingleLine(false); | 85 .setSingleLine(false); |
86 RecordUserAction.record("EnhancedBookmarks.AddingFailed"); | 86 RecordUserAction.record("EnhancedBookmarks.AddingFailed"); |
87 } else { | 87 } else { |
88 String folderName = bookmarkModel.getBookmarkTitle( | 88 String folderName = bookmarkModel.getBookmarkTitle( |
89 bookmarkModel.getBookmarkById(bookmarkId).getParentId()); | 89 bookmarkModel.getBookmarkById(bookmarkId).getParentId()); |
90 SnackbarController snackbarController = | 90 SnackbarController snackbarController = |
91 createSnackbarControllerForEditButton(activity, bookmarkId); | 91 createSnackbarControllerForEditButton(activity, bookmarkId); |
92 if (getLastUsedParent(activity) == null) { | 92 if (getLastUsedParent(activity) == null) { |
93 if (fromCustomTab) { | 93 if (fromCustomTab) { |
94 String packageLabel = BuildInfo.getPackageLabel(activity); | 94 String packageLabel = BuildInfo.getPackageLabel(); |
95 snackbar = Snackbar.make( | 95 snackbar = Snackbar.make( |
96 activity.getString(R.string.bookmark_page_saved, pac
kageLabel), | 96 activity.getString(R.string.bookmark_page_saved, pac
kageLabel), |
97 snackbarController, Snackbar.TYPE_ACTION, Snackbar.U
MA_BOOKMARK_ADDED); | 97 snackbarController, Snackbar.TYPE_ACTION, Snackbar.U
MA_BOOKMARK_ADDED); |
98 } else { | 98 } else { |
99 snackbar = Snackbar.make( | 99 snackbar = Snackbar.make( |
100 activity.getString(R.string.bookmark_page_saved_defa
ult), | 100 activity.getString(R.string.bookmark_page_saved_defa
ult), |
101 snackbarController, Snackbar.TYPE_ACTION, Snackbar.U
MA_BOOKMARK_ADDED); | 101 snackbarController, Snackbar.TYPE_ACTION, Snackbar.U
MA_BOOKMARK_ADDED); |
102 } | 102 } |
103 } else { | 103 } else { |
104 snackbar = Snackbar.make(folderName, snackbarController, Snackba
r.TYPE_ACTION, | 104 snackbar = Snackbar.make(folderName, snackbarController, Snackba
r.TYPE_ACTION, |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 279 |
280 /** | 280 /** |
281 * Closes the {@link BookmarkActivity} on Phone. Does nothing on tablet. | 281 * Closes the {@link BookmarkActivity} on Phone. Does nothing on tablet. |
282 */ | 282 */ |
283 public static void finishActivityOnPhone(Context context) { | 283 public static void finishActivityOnPhone(Context context) { |
284 if (context instanceof BookmarkActivity) { | 284 if (context instanceof BookmarkActivity) { |
285 ((Activity) context).finish(); | 285 ((Activity) context).finish(); |
286 } | 286 } |
287 } | 287 } |
288 } | 288 } |
OLD | NEW |