OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.contextmenu; | 5 package org.chromium.chrome.browser.contextmenu; |
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.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
10 import android.graphics.BitmapFactory; | 10 import android.graphics.BitmapFactory; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 if (ChromeFeatureList.isEnabled(ChromeFeatureList.CUSTOM_CONTEXT_MENU)) { | 114 if (ChromeFeatureList.isEnabled(ChromeFeatureList.CUSTOM_CONTEXT_MENU)) { |
115 List<Pair<Integer, List<ContextMenuItem>>> items = | 115 List<Pair<Integer, List<ContextMenuItem>>> items = |
116 mPopulator.buildContextMenu(null, mActivity, mCurrentContext MenuParams); | 116 mPopulator.buildContextMenu(null, mActivity, mCurrentContext MenuParams); |
117 | 117 |
118 final ContextMenuUi menuUi = new TabularContextMenuUi(new Runnable() { | 118 final ContextMenuUi menuUi = new TabularContextMenuUi(new Runnable() { |
119 @Override | 119 @Override |
120 public void run() { | 120 public void run() { |
121 shareImageDirectly(ShareHelper.getLastShareComponentName()); | 121 shareImageDirectly(ShareHelper.getLastShareComponentName()); |
122 } | 122 } |
123 }); | 123 }); |
124 ((TabularContextMenuUi) menuUi) | |
Theresa
2017/05/24 17:53:33
Instead of casting here, let's change line 118 to:
Daniel Park
2017/05/24 19:44:38
Done.
| |
125 .setRenderCoordinates(contentViewCore.getRenderCoordinates() ); | |
124 menuUi.displayMenu(mActivity, mCurrentContextMenuParams, items, mCal lback, mOnMenuShown, | 126 menuUi.displayMenu(mActivity, mCurrentContextMenuParams, items, mCal lback, mOnMenuShown, |
125 mOnMenuClosed); | 127 mOnMenuClosed); |
126 if (mCurrentContextMenuParams.isImage()) { | 128 if (mCurrentContextMenuParams.isImage()) { |
127 getThumbnail(new Callback<Bitmap>() { | 129 getThumbnail(new Callback<Bitmap>() { |
128 @Override | 130 @Override |
129 public void onResult(Bitmap result) { | 131 public void onResult(Bitmap result) { |
130 ((TabularContextMenuUi) menuUi).onImageThumbnailRetrieve d(result); | 132 ((TabularContextMenuUi) menuUi).onImageThumbnailRetrieve d(result); |
131 } | 133 } |
132 }); | 134 }); |
133 } | 135 } |
134 return; | 136 return; |
135 } | 137 } |
136 | 138 |
137 // The Platform Context Menu requires the listener within this hepler si nce this helper and | 139 // The Platform Context Menu requires the listener within this helper si nce this helper and |
138 // provides context menu for us to show. | 140 // provides context menu for us to show. |
139 view.setOnCreateContextMenuListener(this); | 141 view.setOnCreateContextMenuListener(this); |
140 if (view.showContextMenu()) { | 142 if (view.showContextMenu()) { |
141 mOnMenuShown.run(); | 143 mOnMenuShown.run(); |
142 windowAndroid.addContextMenuCloseListener(new OnCloseContextMenuList ener() { | 144 windowAndroid.addContextMenuCloseListener(new OnCloseContextMenuList ener() { |
143 @Override | 145 @Override |
144 public void onContextMenuClosed() { | 146 public void onContextMenuClosed() { |
145 mOnMenuClosed.run(); | 147 mOnMenuClosed.run(); |
146 windowAndroid.removeContextMenuCloseListener(this); | 148 windowAndroid.removeContextMenuCloseListener(this); |
147 } | 149 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 } | 234 } |
233 | 235 |
234 private native WebContents nativeGetJavaWebContents(long nativeContextMenuHe lper); | 236 private native WebContents nativeGetJavaWebContents(long nativeContextMenuHe lper); |
235 private native void nativeOnStartDownload( | 237 private native void nativeOnStartDownload( |
236 long nativeContextMenuHelper, boolean isLink, boolean isDataReductio nProxyEnabled); | 238 long nativeContextMenuHelper, boolean isLink, boolean isDataReductio nProxyEnabled); |
237 private native void nativeSearchForImage(long nativeContextMenuHelper); | 239 private native void nativeSearchForImage(long nativeContextMenuHelper); |
238 private native void nativeRetrieveImage( | 240 private native void nativeRetrieveImage( |
239 long nativeContextMenuHelper, Callback<byte[]> callback, int maxSize Px); | 241 long nativeContextMenuHelper, Callback<byte[]> callback, int maxSize Px); |
240 private native void nativeOnContextMenuClosed(long nativeContextMenuHelper); | 242 private native void nativeOnContextMenuClosed(long nativeContextMenuHelper); |
241 } | 243 } |
OLD | NEW |