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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/tab/ChromeTab.java

Issue 1242613002: [Android] Supporting floating select ActionModes for web content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix 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.tab; 5 package org.chromium.chrome.browser.tab;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.app.ActivityManager; 8 import android.app.ActivityManager;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.Intent; 10 import android.content.Intent;
11 import android.graphics.Rect; 11 import android.graphics.Rect;
12 import android.media.AudioManager; 12 import android.media.AudioManager;
13 import android.os.Build; 13 import android.os.Build;
14 import android.os.Handler; 14 import android.os.Handler;
15 import android.os.Message; 15 import android.os.Message;
16 import android.text.TextUtils; 16 import android.text.TextUtils;
17 import android.util.Pair; 17 import android.util.Pair;
18 import android.view.ActionMode;
19 import android.view.ContextMenu; 18 import android.view.ContextMenu;
20 import android.view.KeyEvent; 19 import android.view.KeyEvent;
21 import android.view.View; 20 import android.view.View;
22 21
23 import org.chromium.base.Log; 22 import org.chromium.base.Log;
24 import org.chromium.base.TraceEvent; 23 import org.chromium.base.TraceEvent;
25 import org.chromium.base.VisibleForTesting; 24 import org.chromium.base.VisibleForTesting;
26 import org.chromium.base.metrics.RecordUserAction; 25 import org.chromium.base.metrics.RecordUserAction;
27 import org.chromium.chrome.R; 26 import org.chromium.chrome.R;
28 import org.chromium.chrome.browser.ChromeActivity; 27 import org.chromium.chrome.browser.ChromeActivity;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; 63 import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType;
65 import org.chromium.chrome.browser.tabmodel.TabModelUtils; 64 import org.chromium.chrome.browser.tabmodel.TabModelUtils;
66 import org.chromium.chrome.browser.util.FeatureUtilities; 65 import org.chromium.chrome.browser.util.FeatureUtilities;
67 import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils; 66 import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
68 import org.chromium.components.navigation_interception.InterceptNavigationDelega te; 67 import org.chromium.components.navigation_interception.InterceptNavigationDelega te;
69 import org.chromium.components.navigation_interception.NavigationParams; 68 import org.chromium.components.navigation_interception.NavigationParams;
70 import org.chromium.content.browser.ActivityContentVideoViewClient; 69 import org.chromium.content.browser.ActivityContentVideoViewClient;
71 import org.chromium.content.browser.ContentVideoViewClient; 70 import org.chromium.content.browser.ContentVideoViewClient;
72 import org.chromium.content.browser.ContentViewClient; 71 import org.chromium.content.browser.ContentViewClient;
73 import org.chromium.content.browser.ContentViewCore; 72 import org.chromium.content.browser.ContentViewCore;
74 import org.chromium.content.browser.WebActionMode; 73 import org.chromium.content.browser.WebActionModeCallback;
75 import org.chromium.content.browser.WebActionModeCallback.ActionHandler; 74 import org.chromium.content.browser.WebActionModeCallback.ActionHandler;
76 import org.chromium.content.browser.crypto.CipherFactory; 75 import org.chromium.content.browser.crypto.CipherFactory;
77 import org.chromium.content_public.browser.GestureStateListener; 76 import org.chromium.content_public.browser.GestureStateListener;
78 import org.chromium.content_public.browser.InvalidateTypes; 77 import org.chromium.content_public.browser.InvalidateTypes;
79 import org.chromium.content_public.browser.LoadUrlParams; 78 import org.chromium.content_public.browser.LoadUrlParams;
80 import org.chromium.content_public.browser.NavigationController; 79 import org.chromium.content_public.browser.NavigationController;
81 import org.chromium.content_public.browser.WebContents; 80 import org.chromium.content_public.browser.WebContents;
82 import org.chromium.content_public.browser.WebContentsObserver; 81 import org.chromium.content_public.browser.WebContentsObserver;
83 import org.chromium.content_public.common.ConsoleMessageLevel; 82 import org.chromium.content_public.common.ConsoleMessageLevel;
84 import org.chromium.content_public.common.Referrer; 83 import org.chromium.content_public.common.Referrer;
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 mActivity.getTabModelSelector().openNewTab(loadUrlParams, 752 mActivity.getTabModelSelector().openNewTab(loadUrlParams,
754 TabLaunchType.FROM_LONGPRESS_FOREGROUND, ChromeTab.this, isIncognito()); 753 TabLaunchType.FROM_LONGPRESS_FOREGROUND, ChromeTab.this, isIncognito());
755 } 754 }
756 755
757 @Override 756 @Override
758 public boolean doesPerformWebSearch() { 757 public boolean doesPerformWebSearch() {
759 return true; 758 return true;
760 } 759 }
761 760
762 @Override 761 @Override
763 public WebActionMode startActionMode( 762 public WebActionModeCallback getWebActionModeCallback(
764 View view, ActionHandler actionHandler, boolean floating) { 763 Context context, ActionHandler actionHandler) {
765 if (floating) return null; 764 return new ChromeWebActionModeCallback(context, actionHandler);
aurimas (slooooooooow) 2015/08/20 22:20:16 Why do we even need ChromeWebActionModeCallback? C
jdduke (slow) 2015/08/20 23:13:14 I believe the only reason we have it is to supply
aurimas (slooooooooow) 2015/08/21 01:30:23 I think moves the string to content is fine and ju
766 ChromeWebActionModeCallback callback =
767 new ChromeWebActionModeCallback(view.getContext(), actio nHandler);
768 ActionMode actionMode = view.startActionMode(callback);
769 return actionMode != null ? new WebActionMode(actionMode) : null ;
770 } 765 }
771 766
772 @Override 767 @Override
773 public boolean supportsFloatingActionMode() {
774 return false;
775 }
776
777 @Override
778 public ContentVideoViewClient getContentVideoViewClient() { 768 public ContentVideoViewClient getContentVideoViewClient() {
779 return new ActivityContentVideoViewClient(mActivity) { 769 return new ActivityContentVideoViewClient(mActivity) {
780 @Override 770 @Override
781 public void enterFullscreenVideo(View view) { 771 public void enterFullscreenVideo(View view) {
782 super.enterFullscreenVideo(view); 772 super.enterFullscreenVideo(view);
783 FullscreenManager fullscreenManager = getFullscreenManag er(); 773 FullscreenManager fullscreenManager = getFullscreenManag er();
784 if (fullscreenManager != null) { 774 if (fullscreenManager != null) {
785 fullscreenManager.setOverlayVideoMode(true); 775 fullscreenManager.setOverlayVideoMode(true);
786 // Disable double tap for video. 776 // Disable double tap for video.
787 if (getContentViewCore() != null) { 777 if (getContentViewCore() != null) {
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 didFinishPageLoad(); 1350 didFinishPageLoad();
1361 } 1351 }
1362 } 1352 }
1363 }; 1353 };
1364 1354
1365 @VisibleForTesting 1355 @VisibleForTesting
1366 public OverrideUrlLoadingResult getLastOverrideUrlLoadingResultForTests() { 1356 public OverrideUrlLoadingResult getLastOverrideUrlLoadingResultForTests() {
1367 return mLastOverrideUrlLoadingResult; 1357 return mLastOverrideUrlLoadingResult;
1368 } 1358 }
1369 } 1359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698