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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1992393002: Enable external popup menu in Blimp, part 1/2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and update blimp_engine.gn Created 4 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 | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 1383
1384 bool RenderFrameImpl::Send(IPC::Message* message) { 1384 bool RenderFrameImpl::Send(IPC::Message* message) {
1385 if (is_detaching_) { 1385 if (is_detaching_) {
1386 delete message; 1386 delete message;
1387 return false; 1387 return false;
1388 } 1388 }
1389 1389
1390 return RenderThread::Get()->Send(message); 1390 return RenderThread::Get()->Send(message);
1391 } 1391 }
1392 1392
1393 #if defined(OS_MACOSX) || defined(OS_ANDROID) 1393 #if defined(USE_EXTERNAL_POPUP_MENU)
1394 void RenderFrameImpl::DidHideExternalPopupMenu() { 1394 void RenderFrameImpl::DidHideExternalPopupMenu() {
1395 // We need to clear external_popup_menu_ as soon as ExternalPopupMenu::close 1395 // We need to clear external_popup_menu_ as soon as ExternalPopupMenu::close
1396 // is called. Otherwise, createExternalPopupMenu() for new popup will fail. 1396 // is called. Otherwise, createExternalPopupMenu() for new popup will fail.
1397 external_popup_menu_.reset(); 1397 external_popup_menu_.reset();
1398 } 1398 }
1399 #endif 1399 #endif
1400 1400
1401 bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) { 1401 bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) {
1402 // Forward Page IPCs to the RenderView. 1402 // Forward Page IPCs to the RenderView.
1403 if ((IPC_MESSAGE_CLASS(msg) == PageMsgStart)) { 1403 if ((IPC_MESSAGE_CLASS(msg) == PageMsgStart)) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) 1497 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML)
1498 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) 1498 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind)
1499 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) 1499 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding)
1500 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) 1500 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode)
1501 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, 1501 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs,
1502 OnSuppressFurtherDialogs) 1502 OnSuppressFurtherDialogs)
1503 #if defined(OS_ANDROID) 1503 #if defined(OS_ANDROID)
1504 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, 1504 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult,
1505 OnActivateNearestFindResult) 1505 OnActivateNearestFindResult)
1506 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) 1506 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects)
1507 #endif
1508
1509 #if defined(USE_EXTERNAL_POPUP_MENU)
1510 #if defined(OS_MACOSX)
1511 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem)
1512 #else
1507 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) 1513 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems)
1508 #elif defined(OS_MACOSX) 1514 #endif
1509 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) 1515 #endif
1516
1517 #if defined(OS_MACOSX)
1510 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) 1518 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard)
1511 #endif 1519 #endif
1512 IPC_END_MESSAGE_MAP() 1520 IPC_END_MESSAGE_MAP()
1513 1521
1514 return handled; 1522 return handled;
1515 } 1523 }
1516 1524
1517 void RenderFrameImpl::OnNavigate( 1525 void RenderFrameImpl::OnNavigate(
1518 const CommonNavigationParams& common_params, 1526 const CommonNavigationParams& common_params,
1519 const StartNavigationParams& start_params, 1527 const StartNavigationParams& start_params,
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 RenderFrameImpl::createWorkerContentSettingsClientProxy() { 2596 RenderFrameImpl::createWorkerContentSettingsClientProxy() {
2589 if (!frame_ || !frame_->view()) 2597 if (!frame_ || !frame_->view())
2590 return NULL; 2598 return NULL;
2591 return GetContentClient()->renderer()->CreateWorkerContentSettingsClientProxy( 2599 return GetContentClient()->renderer()->CreateWorkerContentSettingsClientProxy(
2592 this, frame_); 2600 this, frame_);
2593 } 2601 }
2594 2602
2595 WebExternalPopupMenu* RenderFrameImpl::createExternalPopupMenu( 2603 WebExternalPopupMenu* RenderFrameImpl::createExternalPopupMenu(
2596 const WebPopupMenuInfo& popup_menu_info, 2604 const WebPopupMenuInfo& popup_menu_info,
2597 WebExternalPopupMenuClient* popup_menu_client) { 2605 WebExternalPopupMenuClient* popup_menu_client) {
2598 #if defined(OS_MACOSX) || defined(OS_ANDROID) 2606 #if defined(USE_EXTERNAL_POPUP_MENU)
2599 // An IPC message is sent to the browser to build and display the actual 2607 // An IPC message is sent to the browser to build and display the actual
2600 // popup. The user could have time to click a different select by the time 2608 // popup. The user could have time to click a different select by the time
2601 // the popup is shown. In that case external_popup_menu_ is non NULL. 2609 // the popup is shown. In that case external_popup_menu_ is non NULL.
2602 // By returning NULL in that case, we instruct Blink to cancel that new 2610 // By returning NULL in that case, we instruct Blink to cancel that new
2603 // popup. So from the user perspective, only the first one will show, and 2611 // popup. So from the user perspective, only the first one will show, and
2604 // will have to close the first one before another one can be shown. 2612 // will have to close the first one before another one can be shown.
2605 if (external_popup_menu_) 2613 if (external_popup_menu_)
2606 return NULL; 2614 return NULL;
2607 external_popup_menu_.reset( 2615 external_popup_menu_.reset(
2608 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); 2616 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client));
(...skipping 2613 matching lines...) Expand 10 before | Expand all | Expand 10 after
5222 frame_->findMatchRects(web_match_rects); 5230 frame_->findMatchRects(web_match_rects);
5223 match_rects.reserve(web_match_rects.size()); 5231 match_rects.reserve(web_match_rects.size());
5224 for (size_t i = 0; i < web_match_rects.size(); ++i) 5232 for (size_t i = 0; i < web_match_rects.size(); ++i)
5225 match_rects.push_back(gfx::RectF(web_match_rects[i])); 5233 match_rects.push_back(gfx::RectF(web_match_rects[i]));
5226 } 5234 }
5227 5235
5228 gfx::RectF active_rect = frame_->activeFindMatchRect(); 5236 gfx::RectF active_rect = frame_->activeFindMatchRect();
5229 Send(new FrameHostMsg_FindMatchRects_Reply(routing_id_, rects_version, 5237 Send(new FrameHostMsg_FindMatchRects_Reply(routing_id_, rects_version,
5230 match_rects, active_rect)); 5238 match_rects, active_rect));
5231 } 5239 }
5240 #endif
5232 5241
5242 #if defined(USE_EXTERNAL_POPUP_MENU)
5243 #if defined(OS_MACOSX)
5244 void RenderFrameImpl::OnSelectPopupMenuItem(int selected_index) {
5245 if (external_popup_menu_ == NULL)
5246 return;
5247 external_popup_menu_->DidSelectItem(selected_index);
5248 external_popup_menu_.reset();
5249 }
5250 #else
5233 void RenderFrameImpl::OnSelectPopupMenuItems( 5251 void RenderFrameImpl::OnSelectPopupMenuItems(
5234 bool canceled, 5252 bool canceled,
5235 const std::vector<int>& selected_indices) { 5253 const std::vector<int>& selected_indices) {
5236 // It is possible to receive more than one of these calls if the user presses 5254 // It is possible to receive more than one of these calls if the user presses
5237 // a select faster than it takes for the show-select-popup IPC message to make 5255 // a select faster than it takes for the show-select-popup IPC message to make
5238 // it to the browser UI thread. Ignore the extra-messages. 5256 // it to the browser UI thread. Ignore the extra-messages.
5239 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug. 5257 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug.
5240 if (!external_popup_menu_) 5258 if (!external_popup_menu_)
5241 return; 5259 return;
5242 5260
5243 external_popup_menu_->DidSelectItems(canceled, selected_indices); 5261 external_popup_menu_->DidSelectItems(canceled, selected_indices);
5244 external_popup_menu_.reset(); 5262 external_popup_menu_.reset();
5245 } 5263 }
5246 #elif defined(OS_MACOSX) 5264 #endif
5247 void RenderFrameImpl::OnSelectPopupMenuItem(int selected_index) {
5248 if (external_popup_menu_ == NULL)
5249 return;
5250 external_popup_menu_->DidSelectItem(selected_index);
5251 external_popup_menu_.reset();
5252 }
5253 #endif 5265 #endif
5254 5266
5255 void RenderFrameImpl::OpenURL(const GURL& url, 5267 void RenderFrameImpl::OpenURL(const GURL& url,
5256 const Referrer& referrer, 5268 const Referrer& referrer,
5257 WebNavigationPolicy policy, 5269 WebNavigationPolicy policy,
5258 bool should_replace_current_entry, 5270 bool should_replace_current_entry,
5259 bool is_history_navigation_in_new_child) { 5271 bool is_history_navigation_in_new_child) {
5260 FrameHostMsg_OpenURL_Params params; 5272 FrameHostMsg_OpenURL_Params params;
5261 params.url = url; 5273 params.url = url;
5262 params.referrer = referrer; 5274 params.referrer = referrer;
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
6154 // event target. Potentially a Pepper plugin will receive the event. 6166 // event target. Potentially a Pepper plugin will receive the event.
6155 // In order to tell whether a plugin gets the last mouse event and which it 6167 // In order to tell whether a plugin gets the last mouse event and which it
6156 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6168 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6157 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6169 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6158 // |pepper_last_mouse_event_target_|. 6170 // |pepper_last_mouse_event_target_|.
6159 pepper_last_mouse_event_target_ = nullptr; 6171 pepper_last_mouse_event_target_ = nullptr;
6160 #endif 6172 #endif
6161 } 6173 }
6162 6174
6163 } // namespace content 6175 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698