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 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 | 2021 |
2022 // Tell the embedding application that the title of the active page has changed | 2022 // Tell the embedding application that the title of the active page has changed |
2023 void RenderViewImpl::UpdateTitle(WebFrame* frame, | 2023 void RenderViewImpl::UpdateTitle(WebFrame* frame, |
2024 const base::string16& title, | 2024 const base::string16& title, |
2025 WebTextDirection title_direction) { | 2025 WebTextDirection title_direction) { |
2026 // Ignore all but top level navigations. | 2026 // Ignore all but top level navigations. |
2027 if (frame->parent()) | 2027 if (frame->parent()) |
2028 return; | 2028 return; |
2029 | 2029 |
2030 base::debug::TraceLog::GetInstance()->UpdateProcessLabel( | 2030 base::debug::TraceLog::GetInstance()->UpdateProcessLabel( |
2031 routing_id_, UTF16ToUTF8(title)); | 2031 routing_id_, base::UTF16ToUTF8(title)); |
2032 | 2032 |
2033 base::string16 shortened_title = title.substr(0, kMaxTitleChars); | 2033 base::string16 shortened_title = title.substr(0, kMaxTitleChars); |
2034 Send(new ViewHostMsg_UpdateTitle(routing_id_, page_id_, shortened_title, | 2034 Send(new ViewHostMsg_UpdateTitle(routing_id_, page_id_, shortened_title, |
2035 title_direction)); | 2035 title_direction)); |
2036 } | 2036 } |
2037 | 2037 |
2038 void RenderViewImpl::UpdateEncoding(WebFrame* frame, | 2038 void RenderViewImpl::UpdateEncoding(WebFrame* frame, |
2039 const std::string& encoding_name) { | 2039 const std::string& encoding_name) { |
2040 // Only update main frame's encoding_name. | 2040 // Only update main frame's encoding_name. |
2041 if (webview()->mainFrame() == frame && | 2041 if (webview()->mainFrame() == frame && |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2470 // to notify the selection was changed. Focus change should be notified | 2470 // to notify the selection was changed. Focus change should be notified |
2471 // before selection change. | 2471 // before selection change. |
2472 UpdateTextInputType(); | 2472 UpdateTextInputType(); |
2473 SyncSelectionIfRequired(); | 2473 SyncSelectionIfRequired(); |
2474 #if defined(OS_ANDROID) | 2474 #if defined(OS_ANDROID) |
2475 UpdateTextInputState(false, true); | 2475 UpdateTextInputState(false, true); |
2476 #endif | 2476 #endif |
2477 } | 2477 } |
2478 | 2478 |
2479 void RenderViewImpl::didExecuteCommand(const WebString& command_name) { | 2479 void RenderViewImpl::didExecuteCommand(const WebString& command_name) { |
2480 const std::string& name = UTF16ToUTF8(command_name); | 2480 const std::string& name = base::UTF16ToUTF8(command_name); |
2481 if (StartsWithASCII(name, "Move", true) || | 2481 if (StartsWithASCII(name, "Move", true) || |
2482 StartsWithASCII(name, "Insert", true) || | 2482 StartsWithASCII(name, "Insert", true) || |
2483 StartsWithASCII(name, "Delete", true)) | 2483 StartsWithASCII(name, "Delete", true)) |
2484 return; | 2484 return; |
2485 RenderThreadImpl::current()->RecordComputedAction(name); | 2485 RenderThreadImpl::current()->RecordComputedAction(name); |
2486 } | 2486 } |
2487 | 2487 |
2488 bool RenderViewImpl::handleCurrentKeyboardEvent() { | 2488 bool RenderViewImpl::handleCurrentKeyboardEvent() { |
2489 if (edit_commands_.empty()) | 2489 if (edit_commands_.empty()) |
2490 return false; | 2490 return false; |
(...skipping 3530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6021 double RenderViewImpl::zoomFactorToZoomLevel(double factor) const { | 6021 double RenderViewImpl::zoomFactorToZoomLevel(double factor) const { |
6022 return ZoomFactorToZoomLevel(factor); | 6022 return ZoomFactorToZoomLevel(factor); |
6023 } | 6023 } |
6024 | 6024 |
6025 void RenderViewImpl::registerProtocolHandler(const WebString& scheme, | 6025 void RenderViewImpl::registerProtocolHandler(const WebString& scheme, |
6026 const WebString& base_url, | 6026 const WebString& base_url, |
6027 const WebString& url, | 6027 const WebString& url, |
6028 const WebString& title) { | 6028 const WebString& title) { |
6029 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); | 6029 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); |
6030 GURL base(base_url); | 6030 GURL base(base_url); |
6031 GURL absolute_url = base.Resolve(UTF16ToUTF8(url)); | 6031 GURL absolute_url = base.Resolve(base::UTF16ToUTF8(url)); |
6032 if (base.GetOrigin() != absolute_url.GetOrigin()) { | 6032 if (base.GetOrigin() != absolute_url.GetOrigin()) { |
6033 return; | 6033 return; |
6034 } | 6034 } |
6035 Send(new ViewHostMsg_RegisterProtocolHandler(routing_id_, | 6035 Send(new ViewHostMsg_RegisterProtocolHandler(routing_id_, |
6036 UTF16ToUTF8(scheme), | 6036 base::UTF16ToUTF8(scheme), |
6037 absolute_url, | 6037 absolute_url, |
6038 title, | 6038 title, |
6039 user_gesture)); | 6039 user_gesture)); |
6040 } | 6040 } |
6041 | 6041 |
6042 blink::WebPageVisibilityState RenderViewImpl::visibilityState() const { | 6042 blink::WebPageVisibilityState RenderViewImpl::visibilityState() const { |
6043 blink::WebPageVisibilityState current_state = is_hidden() ? | 6043 blink::WebPageVisibilityState current_state = is_hidden() ? |
6044 blink::WebPageVisibilityStateHidden : | 6044 blink::WebPageVisibilityStateHidden : |
6045 blink::WebPageVisibilityStateVisible; | 6045 blink::WebPageVisibilityStateVisible; |
6046 blink::WebPageVisibilityState override_state = current_state; | 6046 blink::WebPageVisibilityState override_state = current_state; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6104 DCHECK(!touch_hit.node().isNull()); | 6104 DCHECK(!touch_hit.node().isNull()); |
6105 DCHECK(touch_hit.node().isTextNode()); | 6105 DCHECK(touch_hit.node().isTextNode()); |
6106 | 6106 |
6107 // Process the position with all the registered content detectors until | 6107 // Process the position with all the registered content detectors until |
6108 // a match is found. Priority is provided by their relative order. | 6108 // a match is found. Priority is provided by their relative order. |
6109 for (ContentDetectorList::const_iterator it = content_detectors_.begin(); | 6109 for (ContentDetectorList::const_iterator it = content_detectors_.begin(); |
6110 it != content_detectors_.end(); ++it) { | 6110 it != content_detectors_.end(); ++it) { |
6111 ContentDetector::Result content = (*it)->FindTappedContent(touch_hit); | 6111 ContentDetector::Result content = (*it)->FindTappedContent(touch_hit); |
6112 if (content.valid) { | 6112 if (content.valid) { |
6113 return WebContentDetectionResult(content.content_boundaries, | 6113 return WebContentDetectionResult(content.content_boundaries, |
6114 UTF8ToUTF16(content.text), content.intent_url); | 6114 base::UTF8ToUTF16(content.text), content.intent_url); |
6115 } | 6115 } |
6116 } | 6116 } |
6117 return WebContentDetectionResult(); | 6117 return WebContentDetectionResult(); |
6118 } | 6118 } |
6119 | 6119 |
6120 void RenderViewImpl::scheduleContentIntent(const WebURL& intent) { | 6120 void RenderViewImpl::scheduleContentIntent(const WebURL& intent) { |
6121 // Introduce a short delay so that the user can notice the content. | 6121 // Introduce a short delay so that the user can notice the content. |
6122 base::MessageLoop::current()->PostDelayedTask( | 6122 base::MessageLoop::current()->PostDelayedTask( |
6123 FROM_HERE, | 6123 FROM_HERE, |
6124 base::Bind(&RenderViewImpl::LaunchAndroidContentIntent, | 6124 base::Bind(&RenderViewImpl::LaunchAndroidContentIntent, |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6454 for (size_t i = 0; i < icon_urls.size(); i++) { | 6454 for (size_t i = 0; i < icon_urls.size(); i++) { |
6455 WebURL url = icon_urls[i].iconURL(); | 6455 WebURL url = icon_urls[i].iconURL(); |
6456 if (!url.isEmpty()) | 6456 if (!url.isEmpty()) |
6457 urls.push_back(FaviconURL(url, | 6457 urls.push_back(FaviconURL(url, |
6458 ToFaviconType(icon_urls[i].iconType()))); | 6458 ToFaviconType(icon_urls[i].iconType()))); |
6459 } | 6459 } |
6460 SendUpdateFaviconURL(urls); | 6460 SendUpdateFaviconURL(urls); |
6461 } | 6461 } |
6462 | 6462 |
6463 } // namespace content | 6463 } // namespace content |
OLD | NEW |