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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkEditActivity.java

Issue 1475513008: [Offline pages] Making sure visit button works on tablet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkManager.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.enhancedbookmarks; 5 package org.chromium.chrome.browser.enhancedbookmarks;
6 6
7 import android.content.Intent; 7 import android.content.Intent;
8 import android.os.Bundle; 8 import android.os.Bundle;
9 import android.support.v7.widget.Toolbar; 9 import android.support.v7.widget.Toolbar;
10 import android.text.TextUtils; 10 import android.text.TextUtils;
(...skipping 12 matching lines...) Expand all
23 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; 23 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
24 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge.DeletePageCall back; 24 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge.DeletePageCall back;
25 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge.OfflinePageMod elObserver; 25 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge.OfflinePageMod elObserver;
26 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge.SavePageCallba ck; 26 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge.SavePageCallba ck;
27 import org.chromium.chrome.browser.offlinepages.OfflinePageItem; 27 import org.chromium.chrome.browser.offlinepages.OfflinePageItem;
28 import org.chromium.chrome.browser.util.UrlUtilities; 28 import org.chromium.chrome.browser.util.UrlUtilities;
29 import org.chromium.chrome.browser.widget.EmptyAlertEditText; 29 import org.chromium.chrome.browser.widget.EmptyAlertEditText;
30 import org.chromium.chrome.browser.widget.TintedDrawable; 30 import org.chromium.chrome.browser.widget.TintedDrawable;
31 import org.chromium.components.bookmarks.BookmarkId; 31 import org.chromium.components.bookmarks.BookmarkId;
32 import org.chromium.content_public.browser.WebContents; 32 import org.chromium.content_public.browser.WebContents;
33 import org.chromium.ui.base.DeviceFormFactor;
33 34
34 /** 35 /**
35 * The activity that enables the user to modify the title, url and parent folder of a bookmark. 36 * The activity that enables the user to modify the title, url and parent folder of a bookmark.
36 */ 37 */
37 public class EnhancedBookmarkEditActivity extends EnhancedBookmarkActivityBase { 38 public class EnhancedBookmarkEditActivity extends EnhancedBookmarkActivityBase {
38 /** The intent extra specifying the ID of the bookmark to be edited. */ 39 /** The intent extra specifying the ID of the bookmark to be edited. */
39 public static final String INTENT_BOOKMARK_ID = "EnhancedBookmarkEditActivit y.BookmarkId"; 40 public static final String INTENT_BOOKMARK_ID = "EnhancedBookmarkEditActivit y.BookmarkId";
40 public static final String INTENT_WEB_CONTENTS = "EnhancedBookmarkEditActivi ty.WebContents"; 41 public static final String INTENT_WEB_CONTENTS = "EnhancedBookmarkEditActivi ty.WebContents";
41 42
42 private static final String TAG = "cr.BookmarkEdit"; 43 private static final String TAG = "cr.BookmarkEdit";
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 button.setOnClickListener(new View.OnClickListener() { 305 button.setOnClickListener(new View.OnClickListener() {
305 @Override 306 @Override
306 public void onClick(View v) { 307 public void onClick(View v) {
307 recordOfflineButtonAction(true); 308 recordOfflineButtonAction(true);
308 openBookmark(); 309 openBookmark();
309 } 310 }
310 }); 311 });
311 } 312 }
312 313
313 private void openBookmark() { 314 private void openBookmark() {
314 Intent intent = new Intent(); 315 // TODO(kkimlabs): Refactor this out to handle the intent in ChromeActiv ity.
315 intent.putExtra(EnhancedBookmarkActivity.INTENT_VISIT_BOOKMARK_ID, mBook markId.toString()); 316 if (DeviceFormFactor.isTablet(this)) {
316 setResult(RESULT_OK, intent); 317 EnhancedBookmarkUtils.openBookmark(
318 mEnhancedBookmarksModel, this, mBookmarkId, LaunchLocation.B OOKMARK_EDITOR);
319 } else {
320 Intent intent = new Intent();
321 intent.putExtra(
322 EnhancedBookmarkActivity.INTENT_VISIT_BOOKMARK_ID, mBookmark Id.toString());
323 setResult(RESULT_OK, intent);
324 }
317 finish(); 325 finish();
318 } 326 }
319 327
320 private void recordOfflineButtonAction(boolean clicked) { 328 private void recordOfflineButtonAction(boolean clicked) {
321 // If button type is not set, it means that either offline section is no t shown or we have 329 // If button type is not set, it means that either offline section is no t shown or we have
322 // already recorded the click action. 330 // already recorded the click action.
323 if (mOfflineButtonType == OfflineButtonType.NONE) { 331 if (mOfflineButtonType == OfflineButtonType.NONE) {
324 return; 332 return;
325 } 333 }
326 334
(...skipping 15 matching lines...) Expand all
342 } else if (mOfflineButtonType == OfflineButtonType.REMOVE) { 350 } else if (mOfflineButtonType == OfflineButtonType.REMOVE) {
343 RecordUserAction.record("OfflinePages.Edit.RemoveButtonNotClicke d"); 351 RecordUserAction.record("OfflinePages.Edit.RemoveButtonNotClicke d");
344 } else if (mOfflineButtonType == OfflineButtonType.VISIT) { 352 } else if (mOfflineButtonType == OfflineButtonType.VISIT) {
345 RecordUserAction.record("OfflinePages.Edit.VisitButtonNotClicked "); 353 RecordUserAction.record("OfflinePages.Edit.VisitButtonNotClicked ");
346 } 354 }
347 } 355 }
348 356
349 mOfflineButtonType = OfflineButtonType.NONE; 357 mOfflineButtonType = OfflineButtonType.NONE;
350 } 358 }
351 } 359 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkManager.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698