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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 #include "content/renderer/drop_data_builder.h" | 79 #include "content/renderer/drop_data_builder.h" |
80 #include "content/renderer/external_popup_menu.h" | 80 #include "content/renderer/external_popup_menu.h" |
81 #include "content/renderer/geolocation_dispatcher.h" | 81 #include "content/renderer/geolocation_dispatcher.h" |
82 #include "content/renderer/gpu/render_widget_compositor.h" | 82 #include "content/renderer/gpu/render_widget_compositor.h" |
83 #include "content/renderer/history_controller.h" | 83 #include "content/renderer/history_controller.h" |
84 #include "content/renderer/history_serialization.h" | 84 #include "content/renderer/history_serialization.h" |
85 #include "content/renderer/idle_user_detector.h" | 85 #include "content/renderer/idle_user_detector.h" |
86 #include "content/renderer/ime_event_guard.h" | 86 #include "content/renderer/ime_event_guard.h" |
87 #include "content/renderer/input/input_handler_manager.h" | 87 #include "content/renderer/input/input_handler_manager.h" |
88 #include "content/renderer/internal_document_state_data.h" | 88 #include "content/renderer/internal_document_state_data.h" |
89 #include "content/renderer/load_progress_tracker.h" | |
90 #include "content/renderer/media/audio_device_factory.h" | 89 #include "content/renderer/media/audio_device_factory.h" |
91 #include "content/renderer/media/media_stream_dispatcher.h" | 90 #include "content/renderer/media/media_stream_dispatcher.h" |
92 #include "content/renderer/media/midi_dispatcher.h" | 91 #include "content/renderer/media/midi_dispatcher.h" |
93 #include "content/renderer/media/video_capture_impl_manager.h" | 92 #include "content/renderer/media/video_capture_impl_manager.h" |
94 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" | 93 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" |
95 #include "content/renderer/memory_benchmarking_extension.h" | 94 #include "content/renderer/memory_benchmarking_extension.h" |
96 #include "content/renderer/mhtml_generator.h" | 95 #include "content/renderer/mhtml_generator.h" |
97 #include "content/renderer/push_messaging_dispatcher.h" | 96 #include "content/renderer/push_messaging_dispatcher.h" |
98 #include "content/renderer/render_frame_impl.h" | 97 #include "content/renderer/render_frame_impl.h" |
99 #include "content/renderer/render_frame_proxy.h" | 98 #include "content/renderer/render_frame_proxy.h" |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 #endif | 665 #endif |
667 #if defined(OS_WIN) | 666 #if defined(OS_WIN) |
668 focused_plugin_id_(-1), | 667 focused_plugin_id_(-1), |
669 #endif | 668 #endif |
670 #if defined(ENABLE_PLUGINS) | 669 #if defined(ENABLE_PLUGINS) |
671 plugin_find_handler_(NULL), | 670 plugin_find_handler_(NULL), |
672 focused_pepper_plugin_(NULL), | 671 focused_pepper_plugin_(NULL), |
673 pepper_last_mouse_event_target_(NULL), | 672 pepper_last_mouse_event_target_(NULL), |
674 #endif | 673 #endif |
675 enumeration_completion_id_(0), | 674 enumeration_completion_id_(0), |
676 load_progress_tracker_(new LoadProgressTracker(this)), | |
677 session_storage_namespace_id_(params->session_storage_namespace_id), | 675 session_storage_namespace_id_(params->session_storage_namespace_id), |
678 next_snapshot_id_(0) { | 676 next_snapshot_id_(0) { |
679 } | 677 } |
680 | 678 |
681 void RenderViewImpl::Initialize(RenderViewImplParams* params) { | 679 void RenderViewImpl::Initialize(RenderViewImplParams* params) { |
682 routing_id_ = params->routing_id; | 680 routing_id_ = params->routing_id; |
683 surface_id_ = params->surface_id; | 681 surface_id_ = params->surface_id; |
684 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) | 682 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) |
685 opener_id_ = params->opener_id; | 683 opener_id_ = params->opener_id; |
686 | 684 |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 WebFileChooserCompletion* chooser_completion) { | 1538 WebFileChooserCompletion* chooser_completion) { |
1541 int id = enumeration_completion_id_++; | 1539 int id = enumeration_completion_id_++; |
1542 enumeration_completions_[id] = chooser_completion; | 1540 enumeration_completions_[id] = chooser_completion; |
1543 return Send(new ViewHostMsg_EnumerateDirectory( | 1541 return Send(new ViewHostMsg_EnumerateDirectory( |
1544 routing_id_, | 1542 routing_id_, |
1545 id, | 1543 id, |
1546 base::FilePath::FromUTF16Unsafe(path))); | 1544 base::FilePath::FromUTF16Unsafe(path))); |
1547 } | 1545 } |
1548 | 1546 |
1549 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { | 1547 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { |
1550 if (load_progress_tracker_ != NULL) { | |
1551 load_progress_tracker_->DidStartLoading( | |
1552 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID()); | |
1553 } | |
1554 DCHECK_GE(frames_in_progress_, 0); | 1548 DCHECK_GE(frames_in_progress_, 0); |
1555 if (frames_in_progress_ == 0) | 1549 if (frames_in_progress_ == 0) |
1556 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStartLoading()); | 1550 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStartLoading()); |
1557 frames_in_progress_++; | 1551 frames_in_progress_++; |
1558 } | 1552 } |
1559 | 1553 |
1560 void RenderViewImpl::FrameDidStopLoading(WebFrame* frame) { | 1554 void RenderViewImpl::FrameDidStopLoading(WebFrame* frame) { |
1561 if (load_progress_tracker_ != NULL) { | |
1562 load_progress_tracker_->DidStopLoading( | |
1563 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID()); | |
1564 } | |
1565 // TODO(japhet): This should be a DCHECK, but the pdf plugin sometimes | 1555 // TODO(japhet): This should be a DCHECK, but the pdf plugin sometimes |
1566 // calls DidStopLoading() without a matching DidStartLoading(). | 1556 // calls DidStopLoading() without a matching DidStartLoading(). |
1567 if (frames_in_progress_ == 0) | 1557 if (frames_in_progress_ == 0) |
1568 return; | 1558 return; |
1569 frames_in_progress_--; | 1559 frames_in_progress_--; |
1570 if (frames_in_progress_ == 0) { | 1560 if (frames_in_progress_ == 0) { |
1571 DidStopLoadingIcons(); | 1561 DidStopLoadingIcons(); |
1572 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); | 1562 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); |
1573 } | 1563 } |
1574 } | 1564 } |
1575 | 1565 |
1576 void RenderViewImpl::FrameDidChangeLoadProgress(WebFrame* frame, | |
1577 double load_progress) { | |
1578 if (load_progress_tracker_ != NULL) { | |
1579 load_progress_tracker_->DidChangeLoadProgress( | |
1580 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID(), load_progress); | |
1581 } | |
1582 } | |
1583 | |
1584 void RenderViewImpl::didCancelCompositionOnSelectionChange() { | 1566 void RenderViewImpl::didCancelCompositionOnSelectionChange() { |
1585 Send(new ViewHostMsg_ImeCancelComposition(routing_id())); | 1567 Send(new ViewHostMsg_ImeCancelComposition(routing_id())); |
1586 } | 1568 } |
1587 | 1569 |
1588 void RenderViewImpl::didExecuteCommand(const WebString& command_name) { | 1570 void RenderViewImpl::didExecuteCommand(const WebString& command_name) { |
1589 const std::string& name = base::UTF16ToUTF8(command_name); | 1571 const std::string& name = base::UTF16ToUTF8(command_name); |
1590 if (StartsWithASCII(name, "Move", true) || | 1572 if (StartsWithASCII(name, "Move", true) || |
1591 StartsWithASCII(name, "Insert", true) || | 1573 StartsWithASCII(name, "Insert", true) || |
1592 StartsWithASCII(name, "Delete", true)) | 1574 StartsWithASCII(name, "Delete", true)) |
1593 return; | 1575 return; |
(...skipping 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4105 std::vector<gfx::Size> sizes; | 4087 std::vector<gfx::Size> sizes; |
4106 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4088 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4107 if (!url.isEmpty()) | 4089 if (!url.isEmpty()) |
4108 urls.push_back( | 4090 urls.push_back( |
4109 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4091 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4110 } | 4092 } |
4111 SendUpdateFaviconURL(urls); | 4093 SendUpdateFaviconURL(urls); |
4112 } | 4094 } |
4113 | 4095 |
4114 } // namespace content | 4096 } // namespace content |
OLD | NEW |