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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 #endif | 664 #endif |
666 #if defined(OS_WIN) | 665 #if defined(OS_WIN) |
667 focused_plugin_id_(-1), | 666 focused_plugin_id_(-1), |
668 #endif | 667 #endif |
669 #if defined(ENABLE_PLUGINS) | 668 #if defined(ENABLE_PLUGINS) |
670 plugin_find_handler_(NULL), | 669 plugin_find_handler_(NULL), |
671 focused_pepper_plugin_(NULL), | 670 focused_pepper_plugin_(NULL), |
672 pepper_last_mouse_event_target_(NULL), | 671 pepper_last_mouse_event_target_(NULL), |
673 #endif | 672 #endif |
674 enumeration_completion_id_(0), | 673 enumeration_completion_id_(0), |
675 load_progress_tracker_(new LoadProgressTracker(this)), | |
676 session_storage_namespace_id_(params->session_storage_namespace_id), | 674 session_storage_namespace_id_(params->session_storage_namespace_id), |
677 next_snapshot_id_(0) { | 675 next_snapshot_id_(0) { |
678 } | 676 } |
679 | 677 |
680 void RenderViewImpl::Initialize(RenderViewImplParams* params) { | 678 void RenderViewImpl::Initialize(RenderViewImplParams* params) { |
681 routing_id_ = params->routing_id; | 679 routing_id_ = params->routing_id; |
682 surface_id_ = params->surface_id; | 680 surface_id_ = params->surface_id; |
683 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) | 681 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) |
684 opener_id_ = params->opener_id; | 682 opener_id_ = params->opener_id; |
685 | 683 |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 WebFileChooserCompletion* chooser_completion) { | 1524 WebFileChooserCompletion* chooser_completion) { |
1527 int id = enumeration_completion_id_++; | 1525 int id = enumeration_completion_id_++; |
1528 enumeration_completions_[id] = chooser_completion; | 1526 enumeration_completions_[id] = chooser_completion; |
1529 return Send(new ViewHostMsg_EnumerateDirectory( | 1527 return Send(new ViewHostMsg_EnumerateDirectory( |
1530 routing_id_, | 1528 routing_id_, |
1531 id, | 1529 id, |
1532 base::FilePath::FromUTF16Unsafe(path))); | 1530 base::FilePath::FromUTF16Unsafe(path))); |
1533 } | 1531 } |
1534 | 1532 |
1535 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { | 1533 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { |
1536 if (load_progress_tracker_ != NULL) { | |
1537 load_progress_tracker_->DidStartLoading( | |
1538 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID()); | |
1539 } | |
1540 DCHECK_GE(frames_in_progress_, 0); | 1534 DCHECK_GE(frames_in_progress_, 0); |
1541 if (frames_in_progress_ == 0) | 1535 if (frames_in_progress_ == 0) |
1542 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStartLoading()); | 1536 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStartLoading()); |
1543 frames_in_progress_++; | 1537 frames_in_progress_++; |
1544 } | 1538 } |
1545 | 1539 |
1546 void RenderViewImpl::FrameDidStopLoading(WebFrame* frame) { | 1540 void RenderViewImpl::FrameDidStopLoading(WebFrame* frame) { |
1547 if (load_progress_tracker_ != NULL) { | |
1548 load_progress_tracker_->DidStopLoading( | |
1549 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID()); | |
1550 } | |
1551 // TODO(japhet): This should be a DCHECK, but the pdf plugin sometimes | 1541 // TODO(japhet): This should be a DCHECK, but the pdf plugin sometimes |
1552 // calls DidStopLoading() without a matching DidStartLoading(). | 1542 // calls DidStopLoading() without a matching DidStartLoading(). |
1553 if (frames_in_progress_ == 0) | 1543 if (frames_in_progress_ == 0) |
1554 return; | 1544 return; |
1555 frames_in_progress_--; | 1545 frames_in_progress_--; |
1556 if (frames_in_progress_ == 0) { | 1546 if (frames_in_progress_ == 0) { |
1557 DidStopLoadingIcons(); | 1547 DidStopLoadingIcons(); |
1558 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); | 1548 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); |
1559 } | 1549 } |
1560 } | 1550 } |
1561 | 1551 |
1562 void RenderViewImpl::FrameDidChangeLoadProgress(WebFrame* frame, | |
1563 double load_progress) { | |
1564 if (load_progress_tracker_ != NULL) { | |
1565 load_progress_tracker_->DidChangeLoadProgress( | |
1566 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID(), load_progress); | |
1567 } | |
1568 } | |
1569 | |
1570 void RenderViewImpl::didCancelCompositionOnSelectionChange() { | 1552 void RenderViewImpl::didCancelCompositionOnSelectionChange() { |
1571 Send(new ViewHostMsg_ImeCancelComposition(routing_id())); | 1553 Send(new ViewHostMsg_ImeCancelComposition(routing_id())); |
1572 } | 1554 } |
1573 | 1555 |
1574 void RenderViewImpl::didExecuteCommand(const WebString& command_name) { | 1556 void RenderViewImpl::didExecuteCommand(const WebString& command_name) { |
1575 const std::string& name = base::UTF16ToUTF8(command_name); | 1557 const std::string& name = base::UTF16ToUTF8(command_name); |
1576 if (StartsWithASCII(name, "Move", true) || | 1558 if (StartsWithASCII(name, "Move", true) || |
1577 StartsWithASCII(name, "Insert", true) || | 1559 StartsWithASCII(name, "Insert", true) || |
1578 StartsWithASCII(name, "Delete", true)) | 1560 StartsWithASCII(name, "Delete", true)) |
1579 return; | 1561 return; |
(...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4063 std::vector<gfx::Size> sizes; | 4045 std::vector<gfx::Size> sizes; |
4064 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4046 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4065 if (!url.isEmpty()) | 4047 if (!url.isEmpty()) |
4066 urls.push_back( | 4048 urls.push_back( |
4067 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4049 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4068 } | 4050 } |
4069 SendUpdateFaviconURL(urls); | 4051 SendUpdateFaviconURL(urls); |
4070 } | 4052 } |
4071 | 4053 |
4072 } // namespace content | 4054 } // namespace content |
OLD | NEW |