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

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2894043002: Add machinery to show touch editing context menus in OOPIFs. (Closed)
Patch Set: Rebase to master@{#474999}. Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/public/web/WebView.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 3482 matching lines...) Expand 10 before | Expand all | Expand 10 after
3493 if (!menu) 3493 if (!menu)
3494 return; 3494 return;
3495 const ContextMenuItem* item = menu->ItemWithAction( 3495 const ContextMenuItem* item = menu->ItemWithAction(
3496 static_cast<ContextMenuAction>(kContextMenuItemBaseCustomTag + action)); 3496 static_cast<ContextMenuAction>(kContextMenuItemBaseCustomTag + action));
3497 if (item) 3497 if (item)
3498 page_->GetContextMenuController().ContextMenuItemSelected(item); 3498 page_->GetContextMenuController().ContextMenuItemSelected(item);
3499 page_->GetContextMenuController().ClearContextMenu(); 3499 page_->GetContextMenuController().ClearContextMenu();
3500 } 3500 }
3501 3501
3502 void WebViewImpl::ShowContextMenu(WebMenuSourceType source_type) { 3502 void WebViewImpl::ShowContextMenu(WebMenuSourceType source_type) {
3503 if (!GetPage()) 3503 if (!MainFrameImpl())
3504 return; 3504 return;
3505 3505
3506 GetPage()->GetContextMenuController().ClearContextMenu(); 3506 // If MainFrameImpl() is non-null, then FrameWidget() will also be non-null.
bokan 2017/05/26 14:41:58 Maybe make this a DCHECK?
3507 { 3507 MainFrameImpl()->FrameWidget()->ShowContextMenu(source_type);
3508 ContextMenuAllowedScope scope;
3509 if (LocalFrame* focused_frame = ToLocalFrame(
3510 GetPage()->GetFocusController().FocusedOrMainFrame())) {
3511 focused_frame->GetEventHandler().ShowNonLocatedContextMenu(nullptr,
3512 source_type);
3513 }
3514 }
3515 } 3508 }
3516 3509
3517 void WebViewImpl::DidCloseContextMenu() { 3510 void WebViewImpl::DidCloseContextMenu() {
3518 LocalFrame* frame = page_->GetFocusController().FocusedFrame(); 3511 LocalFrame* frame = page_->GetFocusController().FocusedFrame();
3519 if (frame) 3512 if (frame)
3520 frame->Selection().SetCaretBlinkingSuspended(false); 3513 frame->Selection().SetCaretBlinkingSuspended(false);
3521 } 3514 }
3522 3515
3523 void WebViewImpl::HidePopups() { 3516 void WebViewImpl::HidePopups() {
3524 CancelPagePopup(); 3517 CancelPagePopup();
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
4157 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) 4150 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame())
4158 return nullptr; 4151 return nullptr;
4159 return focused_frame; 4152 return focused_frame;
4160 } 4153 }
4161 4154
4162 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { 4155 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const {
4163 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; 4156 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr;
4164 } 4157 }
4165 4158
4166 } // namespace blink 4159 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/public/web/WebView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698