Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "android_webview/native/aw_web_contents_view_delegate.h" | 5 #include "android_webview/native/aw_web_contents_view_delegate.h" |
| 6 | 6 |
| 7 #include "content/public/browser/android/content_view_core.h" | 7 #include "content/public/browser/android/content_view_core.h" |
| 8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
| 9 #include "content/public/common/context_menu_params.h" | 9 #include "content/public/common/context_menu_params.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 } | 33 } |
| 34 | 34 |
| 35 void AwWebContentsViewDelegate::ShowContextMenu( | 35 void AwWebContentsViewDelegate::ShowContextMenu( |
| 36 content::RenderFrameHost* render_frame_host, | 36 content::RenderFrameHost* render_frame_host, |
| 37 const content::ContextMenuParams& params) { | 37 const content::ContextMenuParams& params) { |
| 38 // TODO(boliu): Large blocks of this function are identical with | 38 // TODO(boliu): Large blocks of this function are identical with |
| 39 // ChromeWebContentsViewDelegateAndroid::ShowContextMenu. De-dup this if | 39 // ChromeWebContentsViewDelegateAndroid::ShowContextMenu. De-dup this if |
| 40 // possible. | 40 // possible. |
| 41 | 41 |
| 42 // Display paste pop-up only when selection is empty and editable. | 42 // Display paste pop-up only when selection is empty and editable. |
| 43 if (params.is_editable && params.selection_text.empty()) { | 43 if (params.is_editable && params.selection_text.empty()) { |
|
boliu
2016/09/22 18:48:36
what if this check fails though?
amaralp
2016/09/22 18:58:54
Wouldn't the behavior be the same as before the pa
boliu
2016/09/22 19:02:46
it used to call NotifyContextMenuClosed if ths che
amaralp
2016/09/22 19:15:30
Previously NotifyContextMenuClosed would resume th
| |
| 44 content::ContentViewCore* content_view_core = | 44 content::ContentViewCore* content_view_core = |
| 45 content::ContentViewCore::FromWebContents(web_contents_); | 45 content::ContentViewCore::FromWebContents(web_contents_); |
| 46 if (content_view_core && | 46 if (content_view_core) { |
| 47 content_view_core->ShowPastePopup(params.selection_start.x(), | 47 content_view_core->ShowPastePopup(params.selection_start.x(), |
| 48 params.selection_start.y())) { | 48 params.selection_start.y()); |
| 49 return; | |
| 50 } | 49 } |
| 51 } | 50 } |
| 52 web_contents_->NotifyContextMenuClosed(content::CustomContextMenuContext()); | |
| 53 } | 51 } |
| 54 | 52 |
| 55 } // namespace android_webview | 53 } // namespace android_webview |
| OLD | NEW |