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 4382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4393 } | 4393 } |
4394 | 4394 |
4395 bool RenderViewImpl::GetContentStateImmediately() const { | 4395 bool RenderViewImpl::GetContentStateImmediately() const { |
4396 return send_content_state_immediately_; | 4396 return send_content_state_immediately_; |
4397 } | 4397 } |
4398 | 4398 |
4399 float RenderViewImpl::GetFilteredTimePerFrame() const { | 4399 float RenderViewImpl::GetFilteredTimePerFrame() const { |
4400 return filtered_time_per_frame(); | 4400 return filtered_time_per_frame(); |
4401 } | 4401 } |
4402 | 4402 |
4403 void RenderViewImpl::ShowContextMenu(WebKit::WebFrame* frame, | 4403 int RenderViewImpl::ShowContextMenu(content::ContextMenuClient* client, |
4404 const WebKit::WebContextMenuData& data) { | 4404 const content::ContextMenuParams& params) { |
4405 showContextMenu(frame, data); | 4405 DCHECK(client); // A null client means "internal" when we issue callbacks. |
4406 content::ContextMenuParams our_params(params); | |
4407 our_params.custom_context.request_id = pending_context_menus_.Add(client); | |
4408 Send(new ViewHostMsg_ContextMenu(routing_id_, our_params)); | |
4409 return our_params.custom_context.request_id; | |
4406 } | 4410 } |
4407 | 4411 |
4408 WebKit::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const { | 4412 WebKit::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const { |
4409 return visibilityState(); | 4413 return visibilityState(); |
4410 } | 4414 } |
4411 | 4415 |
4412 void RenderViewImpl::RunModalAlertDialog(WebKit::WebFrame* frame, | 4416 void RenderViewImpl::RunModalAlertDialog(WebKit::WebFrame* frame, |
4413 const WebKit::WebString& message) { | 4417 const WebKit::WebString& message) { |
4414 return runModalAlertDialog(frame, message); | 4418 return runModalAlertDialog(frame, message); |
4415 } | 4419 } |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5125 webkit_preferences_.Apply(webview()); | 5129 webkit_preferences_.Apply(webview()); |
5126 } | 5130 } |
5127 | 5131 |
5128 void RenderViewImpl::OnSetAltErrorPageURL(const GURL& url) { | 5132 void RenderViewImpl::OnSetAltErrorPageURL(const GURL& url) { |
5129 alternate_error_page_url_ = url; | 5133 alternate_error_page_url_ = url; |
5130 } | 5134 } |
5131 | 5135 |
5132 void RenderViewImpl::OnCustomContextMenuAction( | 5136 void RenderViewImpl::OnCustomContextMenuAction( |
5133 const content::CustomContextMenuContext& custom_context, | 5137 const content::CustomContextMenuContext& custom_context, |
5134 unsigned action) { | 5138 unsigned action) { |
5135 if (custom_context.is_pepper_menu) | 5139 if (custom_context.request_id) { |
5136 pepper_delegate_.OnCustomContextMenuAction(custom_context, action); | 5140 // External context menu request, look in our map. |
5137 else | 5141 content::ContextMenuClient* client = |
5142 pending_context_menus_.Lookup(custom_context.request_id); | |
5143 if (client) | |
5144 client->OnCustomContextMenuAction(custom_context.request_id, action); | |
5145 } else { | |
5146 // Internal request, forward to WebKit. | |
5138 webview()->performCustomContextMenuAction(action); | 5147 webview()->performCustomContextMenuAction(action); |
5139 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 5148 } |
5140 ContextMenuAction(action)); | |
5141 } | 5149 } |
5142 | 5150 |
5143 void RenderViewImpl::OnEnumerateDirectoryResponse( | 5151 void RenderViewImpl::OnEnumerateDirectoryResponse( |
5144 int id, | 5152 int id, |
5145 const std::vector<FilePath>& paths) { | 5153 const std::vector<FilePath>& paths) { |
5146 if (!enumeration_completions_[id]) | 5154 if (!enumeration_completions_[id]) |
5147 return; | 5155 return; |
5148 | 5156 |
5149 WebVector<WebString> ws_file_names(paths.size()); | 5157 WebVector<WebString> ws_file_names(paths.size()); |
5150 for (size_t i = 0; i < paths.size(); ++i) | 5158 for (size_t i = 0; i < paths.size(); ++i) |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6264 if (!external_popup_menu_.get()) | 6272 if (!external_popup_menu_.get()) |
6265 return; | 6273 return; |
6266 | 6274 |
6267 external_popup_menu_->DidSelectItems(canceled, selected_indices); | 6275 external_popup_menu_->DidSelectItems(canceled, selected_indices); |
6268 external_popup_menu_.reset(); | 6276 external_popup_menu_.reset(); |
6269 } | 6277 } |
6270 #endif | 6278 #endif |
6271 | 6279 |
6272 void RenderViewImpl::OnContextMenuClosed( | 6280 void RenderViewImpl::OnContextMenuClosed( |
6273 const content::CustomContextMenuContext& custom_context) { | 6281 const content::CustomContextMenuContext& custom_context) { |
6274 if (custom_context.is_pepper_menu) | 6282 if (custom_context.request_id) { |
6275 pepper_delegate_.OnContextMenuClosed(custom_context); | 6283 // External request, should be in our map. |
6276 else | 6284 content::ContextMenuClient* client = |
6285 pending_context_menus_.Lookup(custom_context.request_id); | |
6286 if (client) { | |
jam
2012/10/10 04:01:43
nit: why the null check? seems that if this is NUL
brettw
2012/10/10 05:10:17
Removed, this was leftover from a previous version
| |
6287 client->OnCustomContextMenuClosed(custom_context.request_id); | |
6288 pending_context_menus_.Remove(custom_context.request_id); | |
6289 } | |
6290 } else { | |
6291 // Internal request, forward to WebKit. | |
6277 context_menu_node_.reset(); | 6292 context_menu_node_.reset(); |
6293 } | |
6278 } | 6294 } |
6279 | 6295 |
6280 void RenderViewImpl::OnEnableViewSourceMode() { | 6296 void RenderViewImpl::OnEnableViewSourceMode() { |
6281 if (!webview()) | 6297 if (!webview()) |
6282 return; | 6298 return; |
6283 WebFrame* main_frame = webview()->mainFrame(); | 6299 WebFrame* main_frame = webview()->mainFrame(); |
6284 if (!main_frame) | 6300 if (!main_frame) |
6285 return; | 6301 return; |
6286 main_frame->enableViewSourceMode(true); | 6302 main_frame->enableViewSourceMode(true); |
6287 } | 6303 } |
(...skipping 25 matching lines...) Expand all Loading... | |
6313 | 6329 |
6314 updating_frame_tree_ = true; | 6330 updating_frame_tree_ = true; |
6315 active_frame_id_map_.clear(); | 6331 active_frame_id_map_.clear(); |
6316 | 6332 |
6317 target_process_id_ = process_id; | 6333 target_process_id_ = process_id; |
6318 target_routing_id_ = route_id; | 6334 target_routing_id_ = route_id; |
6319 CreateFrameTree(webview()->mainFrame(), frames); | 6335 CreateFrameTree(webview()->mainFrame(), frames); |
6320 | 6336 |
6321 updating_frame_tree_ = false; | 6337 updating_frame_tree_ = false; |
6322 } | 6338 } |
OLD | NEW |