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_dependency_factory.h" | 90 #include "content/renderer/media/media_stream_dependency_factory.h" |
92 #include "content/renderer/media/media_stream_dispatcher.h" | 91 #include "content/renderer/media/media_stream_dispatcher.h" |
93 #include "content/renderer/media/midi_dispatcher.h" | 92 #include "content/renderer/media/midi_dispatcher.h" |
94 #include "content/renderer/media/video_capture_impl_manager.h" | 93 #include "content/renderer/media/video_capture_impl_manager.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_process.h" | 98 #include "content/renderer/render_process.h" |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 #endif | 669 #endif |
671 #if defined(OS_WIN) | 670 #if defined(OS_WIN) |
672 focused_plugin_id_(-1), | 671 focused_plugin_id_(-1), |
673 #endif | 672 #endif |
674 #if defined(ENABLE_PLUGINS) | 673 #if defined(ENABLE_PLUGINS) |
675 plugin_find_handler_(NULL), | 674 plugin_find_handler_(NULL), |
676 focused_pepper_plugin_(NULL), | 675 focused_pepper_plugin_(NULL), |
677 pepper_last_mouse_event_target_(NULL), | 676 pepper_last_mouse_event_target_(NULL), |
678 #endif | 677 #endif |
679 enumeration_completion_id_(0), | 678 enumeration_completion_id_(0), |
680 load_progress_tracker_(new LoadProgressTracker(this)), | |
681 session_storage_namespace_id_(params->session_storage_namespace_id), | 679 session_storage_namespace_id_(params->session_storage_namespace_id), |
682 next_snapshot_id_(0) { | 680 next_snapshot_id_(0) { |
683 } | 681 } |
684 | 682 |
685 void RenderViewImpl::Initialize(RenderViewImplParams* params) { | 683 void RenderViewImpl::Initialize(RenderViewImplParams* params) { |
686 routing_id_ = params->routing_id; | 684 routing_id_ = params->routing_id; |
687 surface_id_ = params->surface_id; | 685 surface_id_ = params->surface_id; |
688 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) | 686 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) |
689 opener_id_ = params->opener_id; | 687 opener_id_ = params->opener_id; |
690 | 688 |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 WebFileChooserCompletion* chooser_completion) { | 1557 WebFileChooserCompletion* chooser_completion) { |
1560 int id = enumeration_completion_id_++; | 1558 int id = enumeration_completion_id_++; |
1561 enumeration_completions_[id] = chooser_completion; | 1559 enumeration_completions_[id] = chooser_completion; |
1562 return Send(new ViewHostMsg_EnumerateDirectory( | 1560 return Send(new ViewHostMsg_EnumerateDirectory( |
1563 routing_id_, | 1561 routing_id_, |
1564 id, | 1562 id, |
1565 base::FilePath::FromUTF16Unsafe(path))); | 1563 base::FilePath::FromUTF16Unsafe(path))); |
1566 } | 1564 } |
1567 | 1565 |
1568 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { | 1566 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { |
1569 if (load_progress_tracker_ != NULL) { | |
1570 load_progress_tracker_->DidStartLoading( | |
1571 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID()); | |
1572 } | |
1573 DCHECK_GE(frames_in_progress_, 0); | 1567 DCHECK_GE(frames_in_progress_, 0); |
1574 if (frames_in_progress_ == 0) | 1568 if (frames_in_progress_ == 0) |
1575 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStartLoading()); | 1569 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStartLoading()); |
1576 frames_in_progress_++; | 1570 frames_in_progress_++; |
1577 } | 1571 } |
1578 | 1572 |
1579 void RenderViewImpl::FrameDidStopLoading(WebFrame* frame) { | 1573 void RenderViewImpl::FrameDidStopLoading(WebFrame* frame) { |
1580 if (load_progress_tracker_ != NULL) { | |
1581 load_progress_tracker_->DidStopLoading( | |
1582 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID()); | |
1583 } | |
1584 // TODO(japhet): This should be a DCHECK, but the pdf plugin sometimes | 1574 // TODO(japhet): This should be a DCHECK, but the pdf plugin sometimes |
1585 // calls DidStopLoading() without a matching DidStartLoading(). | 1575 // calls DidStopLoading() without a matching DidStartLoading(). |
1586 if (frames_in_progress_ == 0) | 1576 if (frames_in_progress_ == 0) |
1587 return; | 1577 return; |
1588 frames_in_progress_--; | 1578 frames_in_progress_--; |
1589 if (frames_in_progress_ == 0) { | 1579 if (frames_in_progress_ == 0) { |
1590 DidStopLoadingIcons(); | 1580 DidStopLoadingIcons(); |
1591 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); | 1581 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); |
1592 } | 1582 } |
1593 } | 1583 } |
1594 | 1584 |
1595 void RenderViewImpl::FrameDidChangeLoadProgress(WebFrame* frame, | |
1596 double load_progress) { | |
1597 if (load_progress_tracker_ != NULL) { | |
1598 load_progress_tracker_->DidChangeLoadProgress( | |
1599 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID(), load_progress); | |
1600 } | |
1601 } | |
1602 | |
1603 void RenderViewImpl::didCancelCompositionOnSelectionChange() { | 1585 void RenderViewImpl::didCancelCompositionOnSelectionChange() { |
1604 Send(new ViewHostMsg_ImeCancelComposition(routing_id())); | 1586 Send(new ViewHostMsg_ImeCancelComposition(routing_id())); |
1605 } | 1587 } |
1606 | 1588 |
1607 void RenderViewImpl::didExecuteCommand(const WebString& command_name) { | 1589 void RenderViewImpl::didExecuteCommand(const WebString& command_name) { |
1608 const std::string& name = base::UTF16ToUTF8(command_name); | 1590 const std::string& name = base::UTF16ToUTF8(command_name); |
1609 if (StartsWithASCII(name, "Move", true) || | 1591 if (StartsWithASCII(name, "Move", true) || |
1610 StartsWithASCII(name, "Insert", true) || | 1592 StartsWithASCII(name, "Insert", true) || |
1611 StartsWithASCII(name, "Delete", true)) | 1593 StartsWithASCII(name, "Delete", true)) |
1612 return; | 1594 return; |
(...skipping 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4148 std::vector<gfx::Size> sizes; | 4130 std::vector<gfx::Size> sizes; |
4149 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4131 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4150 if (!url.isEmpty()) | 4132 if (!url.isEmpty()) |
4151 urls.push_back( | 4133 urls.push_back( |
4152 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4134 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4153 } | 4135 } |
4154 SendUpdateFaviconURL(urls); | 4136 SendUpdateFaviconURL(urls); |
4155 } | 4137 } |
4156 | 4138 |
4157 } // namespace content | 4139 } // namespace content |
OLD | NEW |