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 #include "content/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 | 1399 |
1400 bool RenderFrameImpl::Send(IPC::Message* message) { | 1400 bool RenderFrameImpl::Send(IPC::Message* message) { |
1401 if (is_detaching_) { | 1401 if (is_detaching_) { |
1402 delete message; | 1402 delete message; |
1403 return false; | 1403 return false; |
1404 } | 1404 } |
1405 | 1405 |
1406 return RenderThread::Get()->Send(message); | 1406 return RenderThread::Get()->Send(message); |
1407 } | 1407 } |
1408 | 1408 |
1409 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 1409 #if defined(USE_EXTERNAL_POPUP_MENU) |
1410 void RenderFrameImpl::DidHideExternalPopupMenu() { | 1410 void RenderFrameImpl::DidHideExternalPopupMenu() { |
1411 // We need to clear external_popup_menu_ as soon as ExternalPopupMenu::close | 1411 // We need to clear external_popup_menu_ as soon as ExternalPopupMenu::close |
1412 // is called. Otherwise, createExternalPopupMenu() for new popup will fail. | 1412 // is called. Otherwise, createExternalPopupMenu() for new popup will fail. |
1413 external_popup_menu_.reset(); | 1413 external_popup_menu_.reset(); |
1414 } | 1414 } |
1415 #endif | 1415 #endif |
1416 | 1416 |
1417 bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) { | 1417 bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) { |
1418 // Forward Page IPCs to the RenderView. | 1418 // Forward Page IPCs to the RenderView. |
1419 if ((IPC_MESSAGE_CLASS(msg) == PageMsgStart)) { | 1419 if ((IPC_MESSAGE_CLASS(msg) == PageMsgStart)) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) | 1513 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) |
1514 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) | 1514 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) |
1515 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) | 1515 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) |
1516 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1516 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
1517 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, | 1517 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, |
1518 OnSuppressFurtherDialogs) | 1518 OnSuppressFurtherDialogs) |
1519 #if defined(OS_ANDROID) | 1519 #if defined(OS_ANDROID) |
1520 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, | 1520 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, |
1521 OnActivateNearestFindResult) | 1521 OnActivateNearestFindResult) |
1522 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) | 1522 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) |
| 1523 #endif |
| 1524 #if defined(USE_EXTERNAL_POPUP_MENU) && !defined(OS_MACOSX) |
1523 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | 1525 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
1524 #elif defined(OS_MACOSX) | 1526 #elif defined(OS_MACOSX) |
1525 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 1527 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
1526 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 1528 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
1527 #endif | 1529 #endif |
1528 IPC_END_MESSAGE_MAP() | 1530 IPC_END_MESSAGE_MAP() |
1529 | 1531 |
1530 return handled; | 1532 return handled; |
1531 } | 1533 } |
1532 | 1534 |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2606 RenderFrameImpl::createWorkerContentSettingsClientProxy() { | 2608 RenderFrameImpl::createWorkerContentSettingsClientProxy() { |
2607 if (!frame_ || !frame_->view()) | 2609 if (!frame_ || !frame_->view()) |
2608 return NULL; | 2610 return NULL; |
2609 return GetContentClient()->renderer()->CreateWorkerContentSettingsClientProxy( | 2611 return GetContentClient()->renderer()->CreateWorkerContentSettingsClientProxy( |
2610 this, frame_); | 2612 this, frame_); |
2611 } | 2613 } |
2612 | 2614 |
2613 WebExternalPopupMenu* RenderFrameImpl::createExternalPopupMenu( | 2615 WebExternalPopupMenu* RenderFrameImpl::createExternalPopupMenu( |
2614 const WebPopupMenuInfo& popup_menu_info, | 2616 const WebPopupMenuInfo& popup_menu_info, |
2615 WebExternalPopupMenuClient* popup_menu_client) { | 2617 WebExternalPopupMenuClient* popup_menu_client) { |
2616 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 2618 #if defined(USE_EXTERNAL_POPUP_MENU) |
2617 // An IPC message is sent to the browser to build and display the actual | 2619 // An IPC message is sent to the browser to build and display the actual |
2618 // popup. The user could have time to click a different select by the time | 2620 // popup. The user could have time to click a different select by the time |
2619 // the popup is shown. In that case external_popup_menu_ is non NULL. | 2621 // the popup is shown. In that case external_popup_menu_ is non NULL. |
2620 // By returning NULL in that case, we instruct Blink to cancel that new | 2622 // By returning NULL in that case, we instruct Blink to cancel that new |
2621 // popup. So from the user perspective, only the first one will show, and | 2623 // popup. So from the user perspective, only the first one will show, and |
2622 // will have to close the first one before another one can be shown. | 2624 // will have to close the first one before another one can be shown. |
2623 if (external_popup_menu_) | 2625 if (external_popup_menu_) |
2624 return NULL; | 2626 return NULL; |
2625 external_popup_menu_.reset( | 2627 external_popup_menu_.reset( |
2626 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); | 2628 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); |
(...skipping 2598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5225 frame_->findMatchRects(web_match_rects); | 5227 frame_->findMatchRects(web_match_rects); |
5226 match_rects.reserve(web_match_rects.size()); | 5228 match_rects.reserve(web_match_rects.size()); |
5227 for (size_t i = 0; i < web_match_rects.size(); ++i) | 5229 for (size_t i = 0; i < web_match_rects.size(); ++i) |
5228 match_rects.push_back(gfx::RectF(web_match_rects[i])); | 5230 match_rects.push_back(gfx::RectF(web_match_rects[i])); |
5229 } | 5231 } |
5230 | 5232 |
5231 gfx::RectF active_rect = frame_->activeFindMatchRect(); | 5233 gfx::RectF active_rect = frame_->activeFindMatchRect(); |
5232 Send(new FrameHostMsg_FindMatchRects_Reply(routing_id_, rects_version, | 5234 Send(new FrameHostMsg_FindMatchRects_Reply(routing_id_, rects_version, |
5233 match_rects, active_rect)); | 5235 match_rects, active_rect)); |
5234 } | 5236 } |
| 5237 #endif |
5235 | 5238 |
| 5239 #if defined(USE_EXTERNAL_POPUP_MENU) && !defined(OS_MACOSX) |
5236 void RenderFrameImpl::OnSelectPopupMenuItems( | 5240 void RenderFrameImpl::OnSelectPopupMenuItems( |
5237 bool canceled, | 5241 bool canceled, |
5238 const std::vector<int>& selected_indices) { | 5242 const std::vector<int>& selected_indices) { |
5239 // It is possible to receive more than one of these calls if the user presses | 5243 // It is possible to receive more than one of these calls if the user presses |
5240 // a select faster than it takes for the show-select-popup IPC message to make | 5244 // a select faster than it takes for the show-select-popup IPC message to make |
5241 // it to the browser UI thread. Ignore the extra-messages. | 5245 // it to the browser UI thread. Ignore the extra-messages. |
5242 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug. | 5246 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug. |
5243 if (!external_popup_menu_) | 5247 if (!external_popup_menu_) |
5244 return; | 5248 return; |
5245 | 5249 |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6157 // event target. Potentially a Pepper plugin will receive the event. | 6161 // event target. Potentially a Pepper plugin will receive the event. |
6158 // In order to tell whether a plugin gets the last mouse event and which it | 6162 // In order to tell whether a plugin gets the last mouse event and which it |
6159 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6163 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6160 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6164 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6161 // |pepper_last_mouse_event_target_|. | 6165 // |pepper_last_mouse_event_target_|. |
6162 pepper_last_mouse_event_target_ = nullptr; | 6166 pepper_last_mouse_event_target_ = nullptr; |
6163 #endif | 6167 #endif |
6164 } | 6168 } |
6165 | 6169 |
6166 } // namespace content | 6170 } // namespace content |
OLD | NEW |