| 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 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2652 | 2652 |
| 2653 // frame is NULL if invoked by BlockedPlugin. | 2653 // frame is NULL if invoked by BlockedPlugin. |
| 2654 if (frame) | 2654 if (frame) |
| 2655 params.frame_id = frame->identifier(); | 2655 params.frame_id = frame->identifier(); |
| 2656 | 2656 |
| 2657 // Serializing a GURL longer than kMaxURLChars will fail, so don't do | 2657 // Serializing a GURL longer than kMaxURLChars will fail, so don't do |
| 2658 // it. We replace it with an empty GURL so the appropriate items are disabled | 2658 // it. We replace it with an empty GURL so the appropriate items are disabled |
| 2659 // in the context menu. | 2659 // in the context menu. |
| 2660 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large | 2660 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large |
| 2661 // data encoded images. We should have a way to save them. | 2661 // data encoded images. We should have a way to save them. |
| 2662 if (params.src_url.spec().size() > kMaxURLChars) | 2662 if (params.src_url.spec().size() > GetMaxURLChars()) |
| 2663 params.src_url = GURL(); | 2663 params.src_url = GURL(); |
| 2664 context_menu_node_ = data.node; | 2664 context_menu_node_ = data.node; |
| 2665 | 2665 |
| 2666 #if defined(OS_ANDROID) | 2666 #if defined(OS_ANDROID) |
| 2667 gfx::Rect start_rect; | 2667 gfx::Rect start_rect; |
| 2668 gfx::Rect end_rect; | 2668 gfx::Rect end_rect; |
| 2669 GetSelectionBounds(&start_rect, &end_rect); | 2669 GetSelectionBounds(&start_rect, &end_rect); |
| 2670 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom()); | 2670 params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom()); |
| 2671 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom()); | 2671 params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom()); |
| 2672 #endif | 2672 #endif |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2692 | 2692 |
| 2693 // Tell the browser to display a destination link. | 2693 // Tell the browser to display a destination link. |
| 2694 if (target_url_status_ == TARGET_INFLIGHT || | 2694 if (target_url_status_ == TARGET_INFLIGHT || |
| 2695 target_url_status_ == TARGET_PENDING) { | 2695 target_url_status_ == TARGET_PENDING) { |
| 2696 // If we have a request in-flight, save the URL to be sent when we | 2696 // If we have a request in-flight, save the URL to be sent when we |
| 2697 // receive an ACK to the in-flight request. We can happily overwrite | 2697 // receive an ACK to the in-flight request. We can happily overwrite |
| 2698 // any existing pending sends. | 2698 // any existing pending sends. |
| 2699 pending_target_url_ = latest_url; | 2699 pending_target_url_ = latest_url; |
| 2700 target_url_status_ = TARGET_PENDING; | 2700 target_url_status_ = TARGET_PENDING; |
| 2701 } else { | 2701 } else { |
| 2702 // URLs larger than |kMaxURLChars| cannot be sent through IPC - | 2702 // URLs larger than |MaxURLChars()| cannot be sent through IPC - |
| 2703 // see |ParamTraits<GURL>|. | 2703 // see |ParamTraits<GURL>|. |
| 2704 if (latest_url.possibly_invalid_spec().size() > kMaxURLChars) | 2704 if (latest_url.possibly_invalid_spec().size() > GetMaxURLChars()) |
| 2705 latest_url = GURL(); | 2705 latest_url = GURL(); |
| 2706 Send(new ViewHostMsg_UpdateTargetURL(routing_id_, page_id_, latest_url)); | 2706 Send(new ViewHostMsg_UpdateTargetURL(routing_id_, page_id_, latest_url)); |
| 2707 target_url_ = latest_url; | 2707 target_url_ = latest_url; |
| 2708 target_url_status_ = TARGET_INFLIGHT; | 2708 target_url_status_ = TARGET_INFLIGHT; |
| 2709 } | 2709 } |
| 2710 } | 2710 } |
| 2711 | 2711 |
| 2712 gfx::RectF RenderViewImpl::ClientRectToPhysicalWindowRect( | 2712 gfx::RectF RenderViewImpl::ClientRectToPhysicalWindowRect( |
| 2713 const gfx::RectF& rect) const { | 2713 const gfx::RectF& rect) const { |
| 2714 gfx::RectF window_rect = rect; | 2714 gfx::RectF window_rect = rect; |
| (...skipping 3714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6429 for (size_t i = 0; i < icon_urls.size(); i++) { | 6429 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 6430 WebURL url = icon_urls[i].iconURL(); | 6430 WebURL url = icon_urls[i].iconURL(); |
| 6431 if (!url.isEmpty()) | 6431 if (!url.isEmpty()) |
| 6432 urls.push_back(FaviconURL(url, | 6432 urls.push_back(FaviconURL(url, |
| 6433 ToFaviconType(icon_urls[i].iconType()))); | 6433 ToFaviconType(icon_urls[i].iconType()))); |
| 6434 } | 6434 } |
| 6435 SendUpdateFaviconURL(urls); | 6435 SendUpdateFaviconURL(urls); |
| 6436 } | 6436 } |
| 6437 | 6437 |
| 6438 } // namespace content | 6438 } // namespace content |
| OLD | NEW |