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 2099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 void RenderViewImpl::initializeLayerTreeView() { | 2110 void RenderViewImpl::initializeLayerTreeView() { |
2111 RenderWidget::initializeLayerTreeView(); | 2111 RenderWidget::initializeLayerTreeView(); |
2112 RenderWidgetCompositor* rwc = compositor(); | 2112 RenderWidgetCompositor* rwc = compositor(); |
2113 if (!rwc || !webview() || !webview()->devToolsAgent()) | 2113 if (!rwc || !webview() || !webview()->devToolsAgent()) |
2114 return; | 2114 return; |
2115 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); | 2115 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); |
2116 } | 2116 } |
2117 | 2117 |
2118 // blink::WebFrameClient ----------------------------------------------------- | 2118 // blink::WebFrameClient ----------------------------------------------------- |
2119 | 2119 |
2120 WebMediaPlayer* RenderViewImpl::createMediaPlayer( | |
2121 WebLocalFrame* frame, | |
2122 const blink::WebURL& url, | |
2123 WebMediaPlayerClient* client) { | |
2124 NOTREACHED(); | |
2125 return NULL; | |
2126 } | |
2127 | |
2128 blink::WebMediaPlayer* RenderViewImpl::CreateMediaPlayer( | 2120 blink::WebMediaPlayer* RenderViewImpl::CreateMediaPlayer( |
2129 RenderFrame* render_frame, | 2121 RenderFrame* render_frame, |
2130 blink::WebLocalFrame* frame, | 2122 blink::WebLocalFrame* frame, |
2131 const blink::WebURL& url, | 2123 const blink::WebURL& url, |
2132 blink::WebMediaPlayerClient* client) { | 2124 blink::WebMediaPlayerClient* client) { |
2133 FOR_EACH_OBSERVER( | 2125 FOR_EACH_OBSERVER( |
2134 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 2126 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
2135 | 2127 |
2136 WebMediaPlayer* player = CreateWebMediaPlayerForMediaStream(frame, url, | 2128 WebMediaPlayer* player = CreateWebMediaPlayerForMediaStream(frame, url, |
2137 client); | 2129 client); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2521 } | 2513 } |
2522 | 2514 |
2523 void RenderViewImpl::didFinishLoad(WebLocalFrame* frame) { | 2515 void RenderViewImpl::didFinishLoad(WebLocalFrame* frame) { |
2524 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFinishLoad(frame)); | 2516 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFinishLoad(frame)); |
2525 } | 2517 } |
2526 | 2518 |
2527 void RenderViewImpl::didUpdateCurrentHistoryItem(WebLocalFrame* frame) { | 2519 void RenderViewImpl::didUpdateCurrentHistoryItem(WebLocalFrame* frame) { |
2528 StartNavStateSyncTimerIfNecessary(); | 2520 StartNavStateSyncTimerIfNecessary(); |
2529 } | 2521 } |
2530 | 2522 |
2531 void RenderViewImpl::willSendRequest(WebLocalFrame* frame, | |
2532 unsigned identifier, | |
2533 WebURLRequest& request, | |
2534 const WebURLResponse& redirect_response) { | |
2535 NOTREACHED(); | |
2536 } | |
2537 | |
2538 void RenderViewImpl::didReceiveResponse(WebLocalFrame* frame, | |
2539 unsigned identifier, | |
2540 const WebURLResponse& response) { | |
2541 NOTREACHED(); | |
2542 } | |
2543 | |
2544 void RenderViewImpl::didFinishResourceLoad(WebLocalFrame* frame, | 2523 void RenderViewImpl::didFinishResourceLoad(WebLocalFrame* frame, |
2545 unsigned identifier) { | 2524 unsigned identifier) { |
2546 InternalDocumentStateData* internal_data = | 2525 InternalDocumentStateData* internal_data = |
2547 InternalDocumentStateData::FromDataSource(frame->dataSource()); | 2526 InternalDocumentStateData::FromDataSource(frame->dataSource()); |
2548 if (!internal_data->use_error_page()) | 2527 if (!internal_data->use_error_page()) |
2549 return; | 2528 return; |
2550 | 2529 |
2551 // Do not show error page when DevTools is attached. | 2530 // Do not show error page when DevTools is attached. |
2552 if (devtools_agent_->IsAttached()) | 2531 if (devtools_agent_->IsAttached()) |
2553 return; | 2532 return; |
2554 | 2533 |
2555 // Display error page, if appropriate. | 2534 // Display error page, if appropriate. |
2556 std::string error_domain = "http"; | 2535 std::string error_domain = "http"; |
2557 int http_status_code = internal_data->http_status_code(); | 2536 int http_status_code = internal_data->http_status_code(); |
2558 if (GetContentClient()->renderer()->HasErrorPage( | 2537 if (GetContentClient()->renderer()->HasErrorPage( |
2559 http_status_code, &error_domain)) { | 2538 http_status_code, &error_domain)) { |
2560 WebURLError error; | 2539 WebURLError error; |
2561 error.unreachableURL = frame->document().url(); | 2540 error.unreachableURL = frame->document().url(); |
2562 error.domain = WebString::fromUTF8(error_domain); | 2541 error.domain = WebString::fromUTF8(error_domain); |
2563 error.reason = http_status_code; | 2542 error.reason = http_status_code; |
2564 LoadNavigationErrorPage(frame, frame->dataSource()->request(), error, true); | 2543 LoadNavigationErrorPage(frame, frame->dataSource()->request(), error, true); |
2565 } | 2544 } |
2566 } | 2545 } |
2567 | 2546 |
2568 void RenderViewImpl::didLoadResourceFromMemoryCache( | |
2569 WebLocalFrame* frame, | |
2570 const WebURLRequest& request, | |
2571 const WebURLResponse& response) { | |
2572 NOTREACHED(); | |
2573 } | |
2574 | |
2575 void RenderViewImpl::didDisplayInsecureContent(WebLocalFrame* frame) { | |
2576 NOTREACHED(); | |
2577 } | |
2578 | |
2579 void RenderViewImpl::didRunInsecureContent(WebLocalFrame* frame, | |
2580 const WebSecurityOrigin& origin, | |
2581 const WebURL& target) { | |
2582 NOTREACHED(); | |
2583 } | |
2584 | |
2585 void RenderViewImpl::didCreateScriptContext(WebLocalFrame* frame, | |
2586 v8::Handle<v8::Context> context, | |
2587 int extension_group, | |
2588 int world_id) { | |
2589 NOTREACHED(); | |
2590 } | |
2591 | |
2592 void RenderViewImpl::willReleaseScriptContext(WebLocalFrame* frame, | |
2593 v8::Handle<v8::Context> context, | |
2594 int world_id) { | |
2595 NOTREACHED(); | |
2596 } | |
2597 | |
2598 void RenderViewImpl::CheckPreferredSize() { | 2547 void RenderViewImpl::CheckPreferredSize() { |
2599 // We don't always want to send the change messages over IPC, only if we've | 2548 // We don't always want to send the change messages over IPC, only if we've |
2600 // been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| | 2549 // been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| |
2601 // message. | 2550 // message. |
2602 if (!send_preferred_size_changes_ || !webview()) | 2551 if (!send_preferred_size_changes_ || !webview()) |
2603 return; | 2552 return; |
2604 | 2553 |
2605 gfx::Size size = webview()->contentsPreferredMinimumSize(); | 2554 gfx::Size size = webview()->contentsPreferredMinimumSize(); |
2606 | 2555 |
2607 // In the presence of zoom, these sizes are still reported as if unzoomed, | 2556 // In the presence of zoom, these sizes are still reported as if unzoomed, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2696 void RenderViewImpl::didChangeScrollOffset(WebLocalFrame* frame) { | 2645 void RenderViewImpl::didChangeScrollOffset(WebLocalFrame* frame) { |
2697 StartNavStateSyncTimerIfNecessary(); | 2646 StartNavStateSyncTimerIfNecessary(); |
2698 | 2647 |
2699 if (webview()->mainFrame() == frame) | 2648 if (webview()->mainFrame() == frame) |
2700 UpdateScrollState(frame); | 2649 UpdateScrollState(frame); |
2701 | 2650 |
2702 FOR_EACH_OBSERVER( | 2651 FOR_EACH_OBSERVER( |
2703 RenderViewObserver, observers_, DidChangeScrollOffset(frame)); | 2652 RenderViewObserver, observers_, DidChangeScrollOffset(frame)); |
2704 } | 2653 } |
2705 | 2654 |
2706 void RenderViewImpl::willInsertBody(blink::WebLocalFrame* frame) { | |
2707 NOTREACHED(); | |
2708 } | |
2709 | |
2710 void RenderViewImpl::didFirstVisuallyNonEmptyLayout(WebLocalFrame* frame) { | 2655 void RenderViewImpl::didFirstVisuallyNonEmptyLayout(WebLocalFrame* frame) { |
2711 if (frame != webview()->mainFrame()) | 2656 if (frame != webview()->mainFrame()) |
2712 return; | 2657 return; |
2713 | 2658 |
2714 InternalDocumentStateData* data = | 2659 InternalDocumentStateData* data = |
2715 InternalDocumentStateData::FromDataSource(frame->dataSource()); | 2660 InternalDocumentStateData::FromDataSource(frame->dataSource()); |
2716 data->set_did_first_visually_non_empty_layout(true); | 2661 data->set_did_first_visually_non_empty_layout(true); |
2717 | 2662 |
2718 #if defined(OS_ANDROID) | 2663 #if defined(OS_ANDROID) |
2719 // Update body background color if necessary. | 2664 // Update body background color if necessary. |
(...skipping 18 matching lines...) Expand all Loading... |
2738 const WebRect& selection_rect, | 2683 const WebRect& selection_rect, |
2739 bool final_status_update) { | 2684 bool final_status_update) { |
2740 Send(new ViewHostMsg_Find_Reply(routing_id_, | 2685 Send(new ViewHostMsg_Find_Reply(routing_id_, |
2741 request_id, | 2686 request_id, |
2742 match_count, | 2687 match_count, |
2743 selection_rect, | 2688 selection_rect, |
2744 ordinal, | 2689 ordinal, |
2745 final_status_update)); | 2690 final_status_update)); |
2746 } | 2691 } |
2747 | 2692 |
2748 void RenderViewImpl::reportFindInPageMatchCount(int request_id, | |
2749 int count, | |
2750 bool final_update) { | |
2751 NOTREACHED(); | |
2752 } | |
2753 | |
2754 void RenderViewImpl::reportFindInPageSelection(int request_id, | |
2755 int active_match_ordinal, | |
2756 const WebRect& selection_rect) { | |
2757 NOTREACHED(); | |
2758 } | |
2759 | |
2760 void RenderViewImpl::requestStorageQuota( | |
2761 WebLocalFrame* frame, | |
2762 WebStorageQuotaType type, | |
2763 unsigned long long requested_size, | |
2764 blink::WebStorageQuotaCallbacks callbacks) { | |
2765 NOTREACHED(); | |
2766 } | |
2767 | |
2768 bool RenderViewImpl::willCheckAndDispatchMessageEvent( | 2693 bool RenderViewImpl::willCheckAndDispatchMessageEvent( |
2769 blink::WebLocalFrame* sourceFrame, | 2694 blink::WebLocalFrame* sourceFrame, |
2770 blink::WebFrame* targetFrame, | 2695 blink::WebFrame* targetFrame, |
2771 blink::WebSecurityOrigin target_origin, | 2696 blink::WebSecurityOrigin target_origin, |
2772 blink::WebDOMMessageEvent event) { | 2697 blink::WebDOMMessageEvent event) { |
2773 if (!is_swapped_out_) | 2698 if (!is_swapped_out_) |
2774 return false; | 2699 return false; |
2775 | 2700 |
2776 ViewMsg_PostMessage_Params params; | 2701 ViewMsg_PostMessage_Params params; |
2777 params.data = event.data().toString(); | 2702 params.data = event.data().toString(); |
(...skipping 22 matching lines...) Expand all Loading... |
2800 if (sourceFrame) { | 2725 if (sourceFrame) { |
2801 RenderViewImpl* source_view = FromWebView(sourceFrame->view()); | 2726 RenderViewImpl* source_view = FromWebView(sourceFrame->view()); |
2802 if (source_view) | 2727 if (source_view) |
2803 params.source_routing_id = source_view->routing_id(); | 2728 params.source_routing_id = source_view->routing_id(); |
2804 } | 2729 } |
2805 | 2730 |
2806 Send(new ViewHostMsg_RouteMessageEvent(routing_id_, params)); | 2731 Send(new ViewHostMsg_RouteMessageEvent(routing_id_, params)); |
2807 return true; | 2732 return true; |
2808 } | 2733 } |
2809 | 2734 |
2810 void RenderViewImpl::willOpenSocketStream( | |
2811 WebSocketStreamHandle* handle) { | |
2812 NOTREACHED(); | |
2813 } | |
2814 | |
2815 void RenderViewImpl::willStartUsingPeerConnectionHandler( | |
2816 blink::WebLocalFrame* frame, | |
2817 blink::WebRTCPeerConnectionHandler* handler) { | |
2818 NOTREACHED(); | |
2819 } | |
2820 | |
2821 blink::WebString RenderViewImpl::acceptLanguages() { | 2735 blink::WebString RenderViewImpl::acceptLanguages() { |
2822 return WebString::fromUTF8(renderer_preferences_.accept_languages); | 2736 return WebString::fromUTF8(renderer_preferences_.accept_languages); |
2823 } | 2737 } |
2824 | 2738 |
2825 blink::WebString RenderViewImpl::userAgentOverride(blink::WebLocalFrame* frame, | |
2826 const blink::WebURL& url) { | |
2827 NOTREACHED(); | |
2828 return blink::WebString(); | |
2829 } | |
2830 | |
2831 WebString RenderViewImpl::doNotTrackValue(WebLocalFrame* frame) { | |
2832 NOTREACHED(); | |
2833 return blink::WebString(); | |
2834 } | |
2835 | |
2836 bool RenderViewImpl::allowWebGL(WebLocalFrame* frame, bool default_value) { | |
2837 NOTREACHED(); | |
2838 return false; | |
2839 } | |
2840 | |
2841 void RenderViewImpl::didLoseWebGLContext(blink::WebLocalFrame* frame, | |
2842 int arb_robustness_status_code) { | |
2843 NOTREACHED(); | |
2844 } | |
2845 | |
2846 // blink::WebPageSerializerClient implementation ------------------------------ | 2739 // blink::WebPageSerializerClient implementation ------------------------------ |
2847 | 2740 |
2848 void RenderViewImpl::didSerializeDataForFrame( | 2741 void RenderViewImpl::didSerializeDataForFrame( |
2849 const WebURL& frame_url, | 2742 const WebURL& frame_url, |
2850 const WebCString& data, | 2743 const WebCString& data, |
2851 WebPageSerializerClient::PageSerializationStatus status) { | 2744 WebPageSerializerClient::PageSerializationStatus status) { |
2852 Send(new ViewHostMsg_SendSerializedHtmlData( | 2745 Send(new ViewHostMsg_SendSerializedHtmlData( |
2853 routing_id(), | 2746 routing_id(), |
2854 frame_url, | 2747 frame_url, |
2855 data.data(), | 2748 data.data(), |
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4700 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size()); | 4593 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size()); |
4701 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4594 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4702 if (!url.isEmpty()) | 4595 if (!url.isEmpty()) |
4703 urls.push_back( | 4596 urls.push_back( |
4704 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4597 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4705 } | 4598 } |
4706 SendUpdateFaviconURL(urls); | 4599 SendUpdateFaviconURL(urls); |
4707 } | 4600 } |
4708 | 4601 |
4709 } // namespace content | 4602 } // namespace content |
OLD | NEW |