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) |
| 125 .setContentViewCore( |
| 126 ContentViewCore.fromWebContents(contentViewCore.getW
ebContents())); |
124 menuUi.displayMenu(mActivity, mCurrentContextMenuParams, items, mCal
lback, mOnMenuShown, | 127 menuUi.displayMenu(mActivity, mCurrentContextMenuParams, items, mCal
lback, mOnMenuShown, |
125 mOnMenuClosed); | 128 mOnMenuClosed); |
126 if (mCurrentContextMenuParams.isImage()) { | 129 if (mCurrentContextMenuParams.isImage()) { |
127 getThumbnail(new Callback<Bitmap>() { | 130 getThumbnail(new Callback<Bitmap>() { |
128 @Override | 131 @Override |
129 public void onResult(Bitmap result) { | 132 public void onResult(Bitmap result) { |
130 ((TabularContextMenuUi) menuUi).onImageThumbnailRetrieve
d(result); | 133 ((TabularContextMenuUi) menuUi).onImageThumbnailRetrieve
d(result); |
131 } | 134 } |
132 }); | 135 }); |
133 } | 136 } |
134 return; | 137 return; |
135 } | 138 } |
136 | 139 |
137 // The Platform Context Menu requires the listener within this hepler si
nce this helper and | 140 // The Platform Context Menu requires the listener within this helper si
nce this helper and |
138 // provides context menu for us to show. | 141 // provides context menu for us to show. |
139 view.setOnCreateContextMenuListener(this); | 142 view.setOnCreateContextMenuListener(this); |
140 if (view.showContextMenu()) { | 143 if (view.showContextMenu()) { |
141 mOnMenuShown.run(); | 144 mOnMenuShown.run(); |
142 windowAndroid.addContextMenuCloseListener(new OnCloseContextMenuList
ener() { | 145 windowAndroid.addContextMenuCloseListener(new OnCloseContextMenuList
ener() { |
143 @Override | 146 @Override |
144 public void onContextMenuClosed() { | 147 public void onContextMenuClosed() { |
145 mOnMenuClosed.run(); | 148 mOnMenuClosed.run(); |
146 windowAndroid.removeContextMenuCloseListener(this); | 149 windowAndroid.removeContextMenuCloseListener(this); |
147 } | 150 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 235 } |
233 | 236 |
234 private native WebContents nativeGetJavaWebContents(long nativeContextMenuHe
lper); | 237 private native WebContents nativeGetJavaWebContents(long nativeContextMenuHe
lper); |
235 private native void nativeOnStartDownload( | 238 private native void nativeOnStartDownload( |
236 long nativeContextMenuHelper, boolean isLink, boolean isDataReductio
nProxyEnabled); | 239 long nativeContextMenuHelper, boolean isLink, boolean isDataReductio
nProxyEnabled); |
237 private native void nativeSearchForImage(long nativeContextMenuHelper); | 240 private native void nativeSearchForImage(long nativeContextMenuHelper); |
238 private native void nativeRetrieveImage( | 241 private native void nativeRetrieveImage( |
239 long nativeContextMenuHelper, Callback<byte[]> callback, int maxSize
Px); | 242 long nativeContextMenuHelper, Callback<byte[]> callback, int maxSize
Px); |
240 private native void nativeOnContextMenuClosed(long nativeContextMenuHelper); | 243 private native void nativeOnContextMenuClosed(long nativeContextMenuHelper); |
241 } | 244 } |
OLD | NEW |