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 "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 4402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4413 } | 4413 } |
4414 | 4414 |
4415 bool RenderViewImpl::GetContentStateImmediately() const { | 4415 bool RenderViewImpl::GetContentStateImmediately() const { |
4416 return send_content_state_immediately_; | 4416 return send_content_state_immediately_; |
4417 } | 4417 } |
4418 | 4418 |
4419 float RenderViewImpl::GetFilteredTimePerFrame() const { | 4419 float RenderViewImpl::GetFilteredTimePerFrame() const { |
4420 return filtered_time_per_frame(); | 4420 return filtered_time_per_frame(); |
4421 } | 4421 } |
4422 | 4422 |
4423 void RenderViewImpl::ShowContextMenu(WebKit::WebFrame* frame, | 4423 int RenderViewImpl::ShowContextMenu(content::ContextMenuClient* client, |
4424 const WebKit::WebContextMenuData& data) { | 4424 const content::ContextMenuParams& params) { |
4425 showContextMenu(frame, data); | 4425 DCHECK(client); // A null client means "internal" when we issue callbacks. |
| 4426 content::ContextMenuParams our_params(params); |
| 4427 our_params.custom_context.request_id = pending_context_menus_.Add(client); |
| 4428 Send(new ViewHostMsg_ContextMenu(routing_id_, our_params)); |
| 4429 return our_params.custom_context.request_id; |
4426 } | 4430 } |
4427 | 4431 |
4428 WebKit::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const { | 4432 WebKit::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const { |
4429 return visibilityState(); | 4433 return visibilityState(); |
4430 } | 4434 } |
4431 | 4435 |
4432 void RenderViewImpl::RunModalAlertDialog(WebKit::WebFrame* frame, | 4436 void RenderViewImpl::RunModalAlertDialog(WebKit::WebFrame* frame, |
4433 const WebKit::WebString& message) { | 4437 const WebKit::WebString& message) { |
4434 return runModalAlertDialog(frame, message); | 4438 return runModalAlertDialog(frame, message); |
4435 } | 4439 } |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5146 webkit_preferences_.Apply(webview()); | 5150 webkit_preferences_.Apply(webview()); |
5147 } | 5151 } |
5148 | 5152 |
5149 void RenderViewImpl::OnSetAltErrorPageURL(const GURL& url) { | 5153 void RenderViewImpl::OnSetAltErrorPageURL(const GURL& url) { |
5150 alternate_error_page_url_ = url; | 5154 alternate_error_page_url_ = url; |
5151 } | 5155 } |
5152 | 5156 |
5153 void RenderViewImpl::OnCustomContextMenuAction( | 5157 void RenderViewImpl::OnCustomContextMenuAction( |
5154 const content::CustomContextMenuContext& custom_context, | 5158 const content::CustomContextMenuContext& custom_context, |
5155 unsigned action) { | 5159 unsigned action) { |
5156 if (custom_context.is_pepper_menu) | 5160 if (custom_context.request_id) { |
5157 pepper_delegate_.OnCustomContextMenuAction(custom_context, action); | 5161 // External context menu request, look in our map. |
5158 else | 5162 content::ContextMenuClient* client = |
| 5163 pending_context_menus_.Lookup(custom_context.request_id); |
| 5164 client->OnMenuAction(custom_context.request_id, action); |
| 5165 } else { |
| 5166 // Internal request, forward to WebKit. |
5159 webview()->performCustomContextMenuAction(action); | 5167 webview()->performCustomContextMenuAction(action); |
5160 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 5168 } |
5161 ContextMenuAction(action)); | |
5162 } | 5169 } |
5163 | 5170 |
5164 void RenderViewImpl::OnEnumerateDirectoryResponse( | 5171 void RenderViewImpl::OnEnumerateDirectoryResponse( |
5165 int id, | 5172 int id, |
5166 const std::vector<FilePath>& paths) { | 5173 const std::vector<FilePath>& paths) { |
5167 if (!enumeration_completions_[id]) | 5174 if (!enumeration_completions_[id]) |
5168 return; | 5175 return; |
5169 | 5176 |
5170 WebVector<WebString> ws_file_names(paths.size()); | 5177 WebVector<WebString> ws_file_names(paths.size()); |
5171 for (size_t i = 0; i < paths.size(); ++i) | 5178 for (size_t i = 0; i < paths.size(); ++i) |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6285 if (!external_popup_menu_.get()) | 6292 if (!external_popup_menu_.get()) |
6286 return; | 6293 return; |
6287 | 6294 |
6288 external_popup_menu_->DidSelectItems(canceled, selected_indices); | 6295 external_popup_menu_->DidSelectItems(canceled, selected_indices); |
6289 external_popup_menu_.reset(); | 6296 external_popup_menu_.reset(); |
6290 } | 6297 } |
6291 #endif | 6298 #endif |
6292 | 6299 |
6293 void RenderViewImpl::OnContextMenuClosed( | 6300 void RenderViewImpl::OnContextMenuClosed( |
6294 const content::CustomContextMenuContext& custom_context) { | 6301 const content::CustomContextMenuContext& custom_context) { |
6295 if (custom_context.is_pepper_menu) | 6302 if (custom_context.request_id) { |
6296 pepper_delegate_.OnContextMenuClosed(custom_context); | 6303 // External request, should be in our map. |
6297 else | 6304 content::ContextMenuClient* client = |
| 6305 pending_context_menus_.Lookup(custom_context.request_id); |
| 6306 client->OnMenuClosed(custom_context.request_id); |
| 6307 pending_context_menus_.Remove(custom_context.request_id); |
| 6308 } else { |
| 6309 // Internal request, forward to WebKit. |
6298 context_menu_node_.reset(); | 6310 context_menu_node_.reset(); |
| 6311 } |
6299 } | 6312 } |
6300 | 6313 |
6301 void RenderViewImpl::OnEnableViewSourceMode() { | 6314 void RenderViewImpl::OnEnableViewSourceMode() { |
6302 if (!webview()) | 6315 if (!webview()) |
6303 return; | 6316 return; |
6304 WebFrame* main_frame = webview()->mainFrame(); | 6317 WebFrame* main_frame = webview()->mainFrame(); |
6305 if (!main_frame) | 6318 if (!main_frame) |
6306 return; | 6319 return; |
6307 main_frame->enableViewSourceMode(true); | 6320 main_frame->enableViewSourceMode(true); |
6308 } | 6321 } |
(...skipping 27 matching lines...) Expand all Loading... |
6336 | 6349 |
6337 updating_frame_tree_ = true; | 6350 updating_frame_tree_ = true; |
6338 active_frame_id_map_.clear(); | 6351 active_frame_id_map_.clear(); |
6339 | 6352 |
6340 target_process_id_ = process_id; | 6353 target_process_id_ = process_id; |
6341 target_routing_id_ = route_id; | 6354 target_routing_id_ = route_id; |
6342 CreateFrameTree(webview()->mainFrame(), frames); | 6355 CreateFrameTree(webview()->mainFrame(), frames); |
6343 | 6356 |
6344 updating_frame_tree_ = false; | 6357 updating_frame_tree_ = false; |
6345 } | 6358 } |
OLD | NEW |