| 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 4314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4325 } | 4325 } |
| 4326 | 4326 |
| 4327 // Serializing a GURL longer than kMaxURLChars will fail, so don't do | 4327 // Serializing a GURL longer than kMaxURLChars will fail, so don't do |
| 4328 // it. We replace it with an empty GURL so the appropriate items are disabled | 4328 // it. We replace it with an empty GURL so the appropriate items are disabled |
| 4329 // in the context menu. | 4329 // in the context menu. |
| 4330 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large | 4330 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large |
| 4331 // data encoded images. We should have a way to save them. | 4331 // data encoded images. We should have a way to save them. |
| 4332 if (params.src_url.spec().size() > url::kMaxURLChars) | 4332 if (params.src_url.spec().size() > url::kMaxURLChars) |
| 4333 params.src_url = GURL(); | 4333 params.src_url = GURL(); |
| 4334 | 4334 |
| 4335 #if defined(OS_ANDROID) | 4335 blink::WebRect selection_in_window(data.selection_rect); |
| 4336 gfx::Rect start_rect; | 4336 GetRenderWidget()->ConvertViewportToWindow(&selection_in_window); |
| 4337 gfx::Rect end_rect; | 4337 params.selection_rect = selection_in_window; |
| 4338 GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect); | |
| 4339 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom()); | |
| 4340 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom()); | |
| 4341 #endif | |
| 4342 | |
| 4343 Send(new FrameHostMsg_ContextMenu(routing_id_, params)); | 4338 Send(new FrameHostMsg_ContextMenu(routing_id_, params)); |
| 4344 } | 4339 } |
| 4345 | 4340 |
| 4346 void RenderFrameImpl::SaveImageFromDataURL(const blink::WebString& data_url) { | 4341 void RenderFrameImpl::SaveImageFromDataURL(const blink::WebString& data_url) { |
| 4347 // Note: We should basically send GURL but we use size-limited string instead | 4342 // Note: We should basically send GURL but we use size-limited string instead |
| 4348 // in order to send a larger data url to save a image for <canvas> or <img>. | 4343 // in order to send a larger data url to save a image for <canvas> or <img>. |
| 4349 if (data_url.length() < kMaxLengthOfDataURLString) { | 4344 if (data_url.length() < kMaxLengthOfDataURLString) { |
| 4350 Send(new FrameHostMsg_SaveImageFromDataURL(render_view_->GetRoutingID(), | 4345 Send(new FrameHostMsg_SaveImageFromDataURL(render_view_->GetRoutingID(), |
| 4351 routing_id_, data_url.Utf8())); | 4346 routing_id_, data_url.Utf8())); |
| 4352 } | 4347 } |
| (...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7096 policy(info.default_policy), | 7091 policy(info.default_policy), |
| 7097 replaces_current_history_item(info.replaces_current_history_item), | 7092 replaces_current_history_item(info.replaces_current_history_item), |
| 7098 history_navigation_in_new_child_frame( | 7093 history_navigation_in_new_child_frame( |
| 7099 info.is_history_navigation_in_new_child_frame), | 7094 info.is_history_navigation_in_new_child_frame), |
| 7100 client_redirect(info.is_client_redirect), | 7095 client_redirect(info.is_client_redirect), |
| 7101 cache_disabled(info.is_cache_disabled), | 7096 cache_disabled(info.is_cache_disabled), |
| 7102 form(info.form), | 7097 form(info.form), |
| 7103 source_location(info.source_location) {} | 7098 source_location(info.source_location) {} |
| 7104 | 7099 |
| 7105 } // namespace content | 7100 } // namespace content |
| OLD | NEW |