| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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/input_tag_speech_dispatcher.h" | 88 #include "content/renderer/input_tag_speech_dispatcher.h" |
| 89 #include "content/renderer/internal_document_state_data.h" | 89 #include "content/renderer/internal_document_state_data.h" |
| 90 #include "content/renderer/load_progress_tracker.h" | |
| 91 #include "content/renderer/media/audio_device_factory.h" | 90 #include "content/renderer/media/audio_device_factory.h" |
| 92 #include "content/renderer/media/audio_renderer_mixer_manager.h" | 91 #include "content/renderer/media/audio_renderer_mixer_manager.h" |
| 93 #include "content/renderer/media/media_stream_dependency_factory.h" | 92 #include "content/renderer/media/media_stream_dependency_factory.h" |
| 94 #include "content/renderer/media/media_stream_dispatcher.h" | 93 #include "content/renderer/media/media_stream_dispatcher.h" |
| 95 #include "content/renderer/media/media_stream_impl.h" | 94 #include "content/renderer/media/media_stream_impl.h" |
| 96 #include "content/renderer/media/midi_dispatcher.h" | 95 #include "content/renderer/media/midi_dispatcher.h" |
| 97 #include "content/renderer/media/render_media_log.h" | 96 #include "content/renderer/media/render_media_log.h" |
| 98 #include "content/renderer/media/video_capture_impl_manager.h" | 97 #include "content/renderer/media/video_capture_impl_manager.h" |
| 99 #include "content/renderer/media/webmediaplayer_impl.h" | 98 #include "content/renderer/media/webmediaplayer_impl.h" |
| 100 #include "content/renderer/media/webmediaplayer_ms.h" | 99 #include "content/renderer/media/webmediaplayer_ms.h" |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 #endif | 687 #endif |
| 689 #if defined(OS_WIN) | 688 #if defined(OS_WIN) |
| 690 focused_plugin_id_(-1), | 689 focused_plugin_id_(-1), |
| 691 #endif | 690 #endif |
| 692 #if defined(ENABLE_PLUGINS) | 691 #if defined(ENABLE_PLUGINS) |
| 693 plugin_find_handler_(NULL), | 692 plugin_find_handler_(NULL), |
| 694 focused_pepper_plugin_(NULL), | 693 focused_pepper_plugin_(NULL), |
| 695 pepper_last_mouse_event_target_(NULL), | 694 pepper_last_mouse_event_target_(NULL), |
| 696 #endif | 695 #endif |
| 697 enumeration_completion_id_(0), | 696 enumeration_completion_id_(0), |
| 698 load_progress_tracker_(new LoadProgressTracker(this)), | |
| 699 session_storage_namespace_id_(params->session_storage_namespace_id), | 697 session_storage_namespace_id_(params->session_storage_namespace_id), |
| 700 next_snapshot_id_(0) { | 698 next_snapshot_id_(0) { |
| 701 } | 699 } |
| 702 | 700 |
| 703 void RenderViewImpl::Initialize(RenderViewImplParams* params) { | 701 void RenderViewImpl::Initialize(RenderViewImplParams* params) { |
| 704 routing_id_ = params->routing_id; | 702 routing_id_ = params->routing_id; |
| 705 surface_id_ = params->surface_id; | 703 surface_id_ = params->surface_id; |
| 706 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) | 704 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) |
| 707 opener_id_ = params->opener_id; | 705 opener_id_ = params->opener_id; |
| 708 | 706 |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 WebFileChooserCompletion* chooser_completion) { | 1575 WebFileChooserCompletion* chooser_completion) { |
| 1578 int id = enumeration_completion_id_++; | 1576 int id = enumeration_completion_id_++; |
| 1579 enumeration_completions_[id] = chooser_completion; | 1577 enumeration_completions_[id] = chooser_completion; |
| 1580 return Send(new ViewHostMsg_EnumerateDirectory( | 1578 return Send(new ViewHostMsg_EnumerateDirectory( |
| 1581 routing_id_, | 1579 routing_id_, |
| 1582 id, | 1580 id, |
| 1583 base::FilePath::FromUTF16Unsafe(path))); | 1581 base::FilePath::FromUTF16Unsafe(path))); |
| 1584 } | 1582 } |
| 1585 | 1583 |
| 1586 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { | 1584 void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { |
| 1587 if (load_progress_tracker_ != NULL) { | |
| 1588 load_progress_tracker_->DidStartLoading( | |
| 1589 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID()); | |
| 1590 } | |
| 1591 DCHECK_GE(frames_in_progress_, 0); | 1585 DCHECK_GE(frames_in_progress_, 0); |
| 1592 if (frames_in_progress_ == 0) | 1586 if (frames_in_progress_ == 0) |
| 1593 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStartLoading()); | 1587 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStartLoading()); |
| 1594 frames_in_progress_++; | 1588 frames_in_progress_++; |
| 1595 } | 1589 } |
| 1596 | 1590 |
| 1597 void RenderViewImpl::FrameDidStopLoading(WebFrame* frame) { | 1591 void RenderViewImpl::FrameDidStopLoading(WebFrame* frame) { |
| 1598 if (load_progress_tracker_ != NULL) { | |
| 1599 load_progress_tracker_->DidStopLoading( | |
| 1600 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID()); | |
| 1601 } | |
| 1602 // TODO(japhet): This should be a DCHECK, but the pdf plugin sometimes | 1592 // TODO(japhet): This should be a DCHECK, but the pdf plugin sometimes |
| 1603 // calls DidStopLoading() without a matching DidStartLoading(). | 1593 // calls DidStopLoading() without a matching DidStartLoading(). |
| 1604 if (frames_in_progress_ == 0) | 1594 if (frames_in_progress_ == 0) |
| 1605 return; | 1595 return; |
| 1606 frames_in_progress_--; | 1596 frames_in_progress_--; |
| 1607 if (frames_in_progress_ == 0) { | 1597 if (frames_in_progress_ == 0) { |
| 1608 DidStopLoadingIcons(); | 1598 DidStopLoadingIcons(); |
| 1609 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); | 1599 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); |
| 1610 } | 1600 } |
| 1611 } | 1601 } |
| 1612 | 1602 |
| 1613 void RenderViewImpl::FrameDidChangeLoadProgress(WebFrame* frame, | |
| 1614 double load_progress) { | |
| 1615 if (load_progress_tracker_ != NULL) { | |
| 1616 load_progress_tracker_->DidChangeLoadProgress( | |
| 1617 RenderFrameImpl::FromWebFrame(frame)->GetRoutingID(), load_progress); | |
| 1618 } | |
| 1619 } | |
| 1620 | |
| 1621 void RenderViewImpl::didCancelCompositionOnSelectionChange() { | 1603 void RenderViewImpl::didCancelCompositionOnSelectionChange() { |
| 1622 Send(new ViewHostMsg_ImeCancelComposition(routing_id())); | 1604 Send(new ViewHostMsg_ImeCancelComposition(routing_id())); |
| 1623 } | 1605 } |
| 1624 | 1606 |
| 1625 void RenderViewImpl::didExecuteCommand(const WebString& command_name) { | 1607 void RenderViewImpl::didExecuteCommand(const WebString& command_name) { |
| 1626 const std::string& name = base::UTF16ToUTF8(command_name); | 1608 const std::string& name = base::UTF16ToUTF8(command_name); |
| 1627 if (StartsWithASCII(name, "Move", true) || | 1609 if (StartsWithASCII(name, "Move", true) || |
| 1628 StartsWithASCII(name, "Insert", true) || | 1610 StartsWithASCII(name, "Insert", true) || |
| 1629 StartsWithASCII(name, "Delete", true)) | 1611 StartsWithASCII(name, "Delete", true)) |
| 1630 return; | 1612 return; |
| (...skipping 2695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4326 std::vector<gfx::Size> sizes; | 4308 std::vector<gfx::Size> sizes; |
| 4327 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4309 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4328 if (!url.isEmpty()) | 4310 if (!url.isEmpty()) |
| 4329 urls.push_back( | 4311 urls.push_back( |
| 4330 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4312 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4331 } | 4313 } |
| 4332 SendUpdateFaviconURL(urls); | 4314 SendUpdateFaviconURL(urls); |
| 4333 } | 4315 } |
| 4334 | 4316 |
| 4335 } // namespace content | 4317 } // namespace content |
| OLD | NEW |