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

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

Issue 2855353002: Make Paste Popup use selection rect for positioning (Closed)
Patch Set: fix typo Created 3 years, 7 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
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 4298 matching lines...) Expand 10 before | Expand all | Expand 10 after
4309 } 4309 }
4310 4310
4311 // Serializing a GURL longer than kMaxURLChars will fail, so don't do 4311 // Serializing a GURL longer than kMaxURLChars will fail, so don't do
4312 // it. We replace it with an empty GURL so the appropriate items are disabled 4312 // it. We replace it with an empty GURL so the appropriate items are disabled
4313 // in the context menu. 4313 // in the context menu.
4314 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large 4314 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large
4315 // data encoded images. We should have a way to save them. 4315 // data encoded images. We should have a way to save them.
4316 if (params.src_url.spec().size() > url::kMaxURLChars) 4316 if (params.src_url.spec().size() > url::kMaxURLChars)
4317 params.src_url = GURL(); 4317 params.src_url = GURL();
4318 4318
4319 #if defined(OS_ANDROID) 4319 blink::WebRect selection_in_window(data.selection_rect);
4320 gfx::Rect start_rect; 4320 GetRenderWidget()->ConvertViewportToWindow(&selection_in_window);
4321 gfx::Rect end_rect; 4321 params.selection_rect = selection_in_window;
4322 GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect);
4323 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom());
4324 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom());
4325 #endif
4326
4327 Send(new FrameHostMsg_ContextMenu(routing_id_, params)); 4322 Send(new FrameHostMsg_ContextMenu(routing_id_, params));
4328 } 4323 }
4329 4324
4330 void RenderFrameImpl::SaveImageFromDataURL(const blink::WebString& data_url) { 4325 void RenderFrameImpl::SaveImageFromDataURL(const blink::WebString& data_url) {
4331 // Note: We should basically send GURL but we use size-limited string instead 4326 // Note: We should basically send GURL but we use size-limited string instead
4332 // in order to send a larger data url to save a image for <canvas> or <img>. 4327 // in order to send a larger data url to save a image for <canvas> or <img>.
4333 if (data_url.length() < kMaxLengthOfDataURLString) { 4328 if (data_url.length() < kMaxLengthOfDataURLString) {
4334 Send(new FrameHostMsg_SaveImageFromDataURL(render_view_->GetRoutingID(), 4329 Send(new FrameHostMsg_SaveImageFromDataURL(render_view_->GetRoutingID(),
4335 routing_id_, data_url.Utf8())); 4330 routing_id_, data_url.Utf8()));
4336 } 4331 }
(...skipping 2738 matching lines...) Expand 10 before | Expand all | Expand 10 after
7075 policy(info.default_policy), 7070 policy(info.default_policy),
7076 replaces_current_history_item(info.replaces_current_history_item), 7071 replaces_current_history_item(info.replaces_current_history_item),
7077 history_navigation_in_new_child_frame( 7072 history_navigation_in_new_child_frame(
7078 info.is_history_navigation_in_new_child_frame), 7073 info.is_history_navigation_in_new_child_frame),
7079 client_redirect(info.is_client_redirect), 7074 client_redirect(info.is_client_redirect),
7080 cache_disabled(info.is_cache_disabled), 7075 cache_disabled(info.is_cache_disabled),
7081 form(info.form), 7076 form(info.form),
7082 source_location(info.source_location) {} 7077 source_location(info.source_location) {}
7083 7078
7084 } // namespace content 7079 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/context_menu_params.h ('k') | third_party/WebKit/Source/web/ContextMenuClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698