| 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.offlinepages; | 5 package org.chromium.chrome.browser.offlinepages; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.os.Environment; | 8 import android.os.Environment; |
| 9 | 9 |
| 10 import org.chromium.base.Log; | 10 import org.chromium.base.Log; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 * strings. | 76 * strings. |
| 77 * return The resource ID of UI string shown to the user, depending on the e
xperiment. | 77 * return The resource ID of UI string shown to the user, depending on the e
xperiment. |
| 78 */ | 78 */ |
| 79 public static int getStringId(int stringResId) { | 79 public static int getStringId(int stringResId) { |
| 80 if (!OfflinePageBridge.isEnabled()) { | 80 if (!OfflinePageBridge.isEnabled()) { |
| 81 return stringResId; | 81 return stringResId; |
| 82 } | 82 } |
| 83 if (OfflinePageBridge.getFeatureMode() != FeatureMode.ENABLED_AS_SAVED_P
AGES) { | 83 if (OfflinePageBridge.getFeatureMode() != FeatureMode.ENABLED_AS_SAVED_P
AGES) { |
| 84 return stringResId; | 84 return stringResId; |
| 85 } | 85 } |
| 86 if (stringResId == R.string.enhanced_bookmark_action_bar_delete) { | 86 if (stringResId == R.string.bookmark_action_bar_delete) { |
| 87 return R.string.offline_pages_action_bar_delete; | 87 return R.string.offline_pages_action_bar_delete; |
| 88 } else if (stringResId == R.string.enhanced_bookmark_action_bar_move) { | 88 } else if (stringResId == R.string.bookmark_action_bar_move) { |
| 89 return R.string.offline_pages_action_bar_move; | 89 return R.string.offline_pages_action_bar_move; |
| 90 } else if (stringResId == R.string.enhanced_bookmark_action_bar_search)
{ | 90 } else if (stringResId == R.string.bookmark_action_bar_search) { |
| 91 return R.string.offline_pages_action_bar_search; | 91 return R.string.offline_pages_action_bar_search; |
| 92 } else if (stringResId == R.string.edit_bookmark) { | 92 } else if (stringResId == R.string.edit_bookmark) { |
| 93 return R.string.offline_pages_edit_item; | 93 return R.string.offline_pages_edit_item; |
| 94 } else if (stringResId == R.string.enhanced_bookmark_drawer_all_items) { | 94 } else if (stringResId == R.string.bookmark_drawer_all_items) { |
| 95 return R.string.offline_pages_all_items; | 95 return R.string.offline_pages_all_items; |
| 96 } else if (stringResId == R.string.enhanced_bookmark_title_bar_all_items
) { | 96 } else if (stringResId == R.string.bookmark_title_bar_all_items) { |
| 97 return R.string.offline_pages_all_items; | 97 return R.string.offline_pages_all_items; |
| 98 } else if (stringResId == R.string.bookmarks) { | 98 } else if (stringResId == R.string.bookmarks) { |
| 99 return R.string.offline_pages_saved_pages; | 99 return R.string.offline_pages_saved_pages; |
| 100 } else if (stringResId == R.string.menu_bookmarks) { | 100 } else if (stringResId == R.string.menu_bookmarks) { |
| 101 return R.string.menu_bookmarks_offline_pages; | 101 return R.string.menu_bookmarks_offline_pages; |
| 102 } else if (stringResId == R.string.ntp_bookmarks) { | 102 } else if (stringResId == R.string.ntp_bookmarks) { |
| 103 return R.string.offline_pages_ntp_button_name; | 103 return R.string.offline_pages_ntp_button_name; |
| 104 } else if (stringResId == R.string.accessibility_ntp_toolbar_btn_bookmar
ks) { | 104 } else if (stringResId == R.string.accessibility_ntp_toolbar_btn_bookmar
ks) { |
| 105 return R.string.offline_pages_ntp_button_accessibility; | 105 return R.string.offline_pages_ntp_button_accessibility; |
| 106 } else if (stringResId == R.string.bookmarks_folder_empty) { | 106 } else if (stringResId == R.string.bookmarks_folder_empty) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 final SnackbarController snackbarController) { | 262 final SnackbarController snackbarController) { |
| 263 Log.d(TAG, "showReloadSnackbar called with controller " + snackbarContro
ller); | 263 Log.d(TAG, "showReloadSnackbar called with controller " + snackbarContro
ller); |
| 264 int buttonType = RELOAD_BUTTON; | 264 int buttonType = RELOAD_BUTTON; |
| 265 int actionTextId = R.string.reload; | 265 int actionTextId = R.string.reload; |
| 266 showOfflineSnackbar(activity, snackbarController, buttonType, actionText
Id); | 266 showOfflineSnackbar(activity, snackbarController, buttonType, actionText
Id); |
| 267 } | 267 } |
| 268 | 268 |
| 269 public static void showEditSnackbar(final ChromeActivity activity, | 269 public static void showEditSnackbar(final ChromeActivity activity, |
| 270 final SnackbarController snackbarController) { | 270 final SnackbarController snackbarController) { |
| 271 int buttonType = EDIT_BUTTON; | 271 int buttonType = EDIT_BUTTON; |
| 272 int actionTextId = R.string.enhanced_bookmark_item_edit; | 272 int actionTextId = R.string.bookmark_item_edit; |
| 273 showOfflineSnackbar(activity, snackbarController, buttonType, actionText
Id); | 273 showOfflineSnackbar(activity, snackbarController, buttonType, actionText
Id); |
| 274 } | 274 } |
| 275 | 275 |
| 276 /** | 276 /** |
| 277 * Shows the snackbar for the current tab to provide offline specific inform
ation. | 277 * Shows the snackbar for the current tab to provide offline specific inform
ation. |
| 278 * @param activity The activity owning the tab. | 278 * @param activity The activity owning the tab. |
| 279 * @param snackbarController Class to show the snackbar. | 279 * @param snackbarController Class to show the snackbar. |
| 280 * @param buttonType Which snackbar button to show. | 280 * @param buttonType Which snackbar button to show. |
| 281 * @param actionTextId Resource ID of the text to put on the snackbar button
. | 281 * @param actionTextId Resource ID of the text to put on the snackbar button
. |
| 282 */ | 282 */ |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 RecordUserAction.record("OfflinePages.ViewingOffline.Edi
tButtonNotClicked"); | 338 RecordUserAction.record("OfflinePages.ViewingOffline.Edi
tButtonNotClicked"); |
| 339 break; | 339 break; |
| 340 default: | 340 default: |
| 341 assert false; | 341 assert false; |
| 342 break; | 342 break; |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 }; | 345 }; |
| 346 } | 346 } |
| 347 } | 347 } |
| OLD | NEW |