Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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. |
| 3507 { | 3507 DCHECK(MainFrameImpl()->FrameWidget()); |
| 3508 ContextMenuAllowedScope scope; | 3508 MainFrameImpl()->FrameWidget()->ShowContextMenu(source_type); |
|
dcheng
2017/05/26 18:22:27
This frame widget is actually a WebViewFrameWidget
| |
| 3509 if (LocalFrame* focused_frame = ToLocalFrame( | |
| 3510 GetPage()->GetFocusController().FocusedOrMainFrame())) { | |
| 3511 focused_frame->GetEventHandler().ShowNonLocatedContextMenu(nullptr, | |
| 3512 source_type); | |
| 3513 } | |
| 3514 } | |
| 3515 } | 3509 } |
| 3516 | 3510 |
| 3517 void WebViewImpl::DidCloseContextMenu() { | 3511 void WebViewImpl::DidCloseContextMenu() { |
| 3518 LocalFrame* frame = page_->GetFocusController().FocusedFrame(); | 3512 LocalFrame* frame = page_->GetFocusController().FocusedFrame(); |
| 3519 if (frame) | 3513 if (frame) |
| 3520 frame->Selection().SetCaretBlinkingSuspended(false); | 3514 frame->Selection().SetCaretBlinkingSuspended(false); |
| 3521 } | 3515 } |
| 3522 | 3516 |
| 3523 void WebViewImpl::HidePopups() { | 3517 void WebViewImpl::HidePopups() { |
| 3524 CancelPagePopup(); | 3518 CancelPagePopup(); |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4157 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) | 4151 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) |
| 4158 return nullptr; | 4152 return nullptr; |
| 4159 return focused_frame; | 4153 return focused_frame; |
| 4160 } | 4154 } |
| 4161 | 4155 |
| 4162 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { | 4156 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { |
| 4163 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; | 4157 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; |
| 4164 } | 4158 } |
| 4165 | 4159 |
| 4166 } // namespace blink | 4160 } // namespace blink |
| OLD | NEW |