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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 #include "v8/include/v8.h" | 192 #include "v8/include/v8.h" |
193 #include "webkit/child/weburlresponse_extradata_impl.h" | 193 #include "webkit/child/weburlresponse_extradata_impl.h" |
194 | 194 |
195 #if defined(OS_ANDROID) | 195 #if defined(OS_ANDROID) |
196 #include <cpu-features.h> | 196 #include <cpu-features.h> |
197 | 197 |
198 #include "content/renderer/android/address_detector.h" | 198 #include "content/renderer/android/address_detector.h" |
199 #include "content/renderer/android/content_detector.h" | 199 #include "content/renderer/android/content_detector.h" |
200 #include "content/renderer/android/email_detector.h" | 200 #include "content/renderer/android/email_detector.h" |
201 #include "content/renderer/android/phone_number_detector.h" | 201 #include "content/renderer/android/phone_number_detector.h" |
202 #include "content/renderer/media/android/renderer_media_player_manager.h" | |
203 #include "net/android/network_library.h" | 202 #include "net/android/network_library.h" |
204 #include "skia/ext/platform_canvas.h" | 203 #include "skia/ext/platform_canvas.h" |
205 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 204 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
206 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 205 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
207 #include "third_party/WebKit/public/web/WebHitTestResult.h" | 206 #include "third_party/WebKit/public/web/WebHitTestResult.h" |
208 #include "ui/gfx/rect_f.h" | 207 #include "ui/gfx/rect_f.h" |
209 | 208 |
210 #elif defined(OS_WIN) | 209 #elif defined(OS_WIN) |
211 // TODO(port): these files are currently Windows only because they concern: | 210 // TODO(port): these files are currently Windows only because they concern: |
212 // * theming | 211 // * theming |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
654 speech_recognition_dispatcher_(NULL), | 653 speech_recognition_dispatcher_(NULL), |
655 media_stream_dispatcher_(NULL), | 654 media_stream_dispatcher_(NULL), |
656 browser_plugin_manager_(NULL), | 655 browser_plugin_manager_(NULL), |
657 midi_dispatcher_(NULL), | 656 midi_dispatcher_(NULL), |
658 devtools_agent_(NULL), | 657 devtools_agent_(NULL), |
659 accessibility_mode_(AccessibilityModeOff), | 658 accessibility_mode_(AccessibilityModeOff), |
660 renderer_accessibility_(NULL), | 659 renderer_accessibility_(NULL), |
661 mouse_lock_dispatcher_(NULL), | 660 mouse_lock_dispatcher_(NULL), |
662 #if defined(OS_ANDROID) | 661 #if defined(OS_ANDROID) |
663 expected_content_intent_id_(0), | 662 expected_content_intent_id_(0), |
664 media_player_manager_(NULL), | |
665 #endif | 663 #endif |
666 #if defined(OS_WIN) | 664 #if defined(OS_WIN) |
667 focused_plugin_id_(-1), | 665 focused_plugin_id_(-1), |
668 #endif | 666 #endif |
669 #if defined(ENABLE_PLUGINS) | 667 #if defined(ENABLE_PLUGINS) |
670 plugin_find_handler_(NULL), | 668 plugin_find_handler_(NULL), |
671 focused_pepper_plugin_(NULL), | 669 focused_pepper_plugin_(NULL), |
672 pepper_last_mouse_event_target_(NULL), | 670 pepper_last_mouse_event_target_(NULL), |
673 #endif | 671 #endif |
674 enumeration_completion_id_(0), | 672 enumeration_completion_id_(0), |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
781 #if defined(ENABLE_WEBRTC) | 779 #if defined(ENABLE_WEBRTC) |
782 if (!media_stream_dispatcher_) | 780 if (!media_stream_dispatcher_) |
783 media_stream_dispatcher_ = new MediaStreamDispatcher(this); | 781 media_stream_dispatcher_ = new MediaStreamDispatcher(this); |
784 #endif | 782 #endif |
785 | 783 |
786 new MHTMLGenerator(this); | 784 new MHTMLGenerator(this); |
787 #if defined(OS_MACOSX) | 785 #if defined(OS_MACOSX) |
788 new TextInputClientObserver(this); | 786 new TextInputClientObserver(this); |
789 #endif // defined(OS_MACOSX) | 787 #endif // defined(OS_MACOSX) |
790 | 788 |
791 #if defined(OS_ANDROID) | |
792 media_player_manager_ = new RendererMediaPlayerManager(this); | |
793 #endif | |
794 | |
795 // The next group of objects all implement RenderViewObserver, so are deleted | 789 // The next group of objects all implement RenderViewObserver, so are deleted |
796 // along with the RenderView automatically. | 790 // along with the RenderView automatically. |
797 devtools_agent_ = new DevToolsAgent(this); | 791 devtools_agent_ = new DevToolsAgent(this); |
798 if (RenderWidgetCompositor* rwc = compositor()) { | 792 if (RenderWidgetCompositor* rwc = compositor()) { |
799 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); | 793 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); |
800 } | 794 } |
801 mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); | 795 mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); |
802 | 796 |
803 history_controller_.reset(new HistoryController(this)); | 797 history_controller_.reset(new HistoryController(this)); |
804 | 798 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1134 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted, | 1128 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted, |
1135 OnWindowSnapshotCompleted) | 1129 OnWindowSnapshotCompleted) |
1136 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) | 1130 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) |
1137 #if defined(OS_ANDROID) | 1131 #if defined(OS_ANDROID) |
1138 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, | 1132 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, |
1139 OnActivateNearestFindResult) | 1133 OnActivateNearestFindResult) |
1140 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) | 1134 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) |
1141 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | 1135 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
1142 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, | 1136 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, |
1143 OnUpdateTopControlsState) | 1137 OnUpdateTopControlsState) |
1144 IPC_MESSAGE_HANDLER(ViewMsg_PauseVideo, OnPauseVideo) | |
1145 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) | 1138 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) |
1146 #elif defined(OS_MACOSX) | 1139 #elif defined(OS_MACOSX) |
1147 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, | 1140 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, |
1148 OnPluginImeCompositionCompleted) | 1141 OnPluginImeCompositionCompleted) |
1149 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 1142 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
1150 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | 1143 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
1151 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) | 1144 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) |
1152 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) | 1145 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) |
1153 #endif | 1146 #endif |
1154 // Adding a new message? Add platform independent ones first, then put the | 1147 // Adding a new message? Add platform independent ones first, then put the |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1313 void RenderViewImpl::OnSetInLiveResize(bool in_live_resize) { | 1306 void RenderViewImpl::OnSetInLiveResize(bool in_live_resize) { |
1314 if (!webview()) | 1307 if (!webview()) |
1315 return; | 1308 return; |
1316 if (in_live_resize) | 1309 if (in_live_resize) |
1317 webview()->willStartLiveResize(); | 1310 webview()->willStartLiveResize(); |
1318 else | 1311 else |
1319 webview()->willEndLiveResize(); | 1312 webview()->willEndLiveResize(); |
1320 } | 1313 } |
1321 #endif | 1314 #endif |
1322 | 1315 |
1323 #if defined(OS_ANDROID) | |
1324 void RenderViewImpl::OnPauseVideo() { | |
1325 // Inform RendererMediaPlayerManager to release all video player resources. | |
1326 // If something is in progress the resource will not be freed, it will | |
1327 // only be freed once the tab is destroyed or if the user navigates away | |
1328 // via WebMediaPlayerAndroid::Destroy. | |
dcheng
2014/05/23 21:19:41
Is it worth moving this comment to the new IPC han
xhwang
2014/05/23 23:34:35
Done.
| |
1329 media_player_manager_->ReleaseVideoResources(); | |
1330 } | |
1331 #endif | |
1332 | |
1333 /////////////////////////////////////////////////////////////////////////////// | 1316 /////////////////////////////////////////////////////////////////////////////// |
1334 | 1317 |
1335 // Sends the current history state to the browser so it will be saved before we | 1318 // Sends the current history state to the browser so it will be saved before we |
1336 // navigate to a new page. | 1319 // navigate to a new page. |
1337 void RenderViewImpl::UpdateSessionHistory(WebFrame* frame) { | 1320 void RenderViewImpl::UpdateSessionHistory(WebFrame* frame) { |
1338 // If we have a valid page ID at this point, then it corresponds to the page | 1321 // If we have a valid page ID at this point, then it corresponds to the page |
1339 // we are navigating away from. Otherwise, this is the first navigation, so | 1322 // we are navigating away from. Otherwise, this is the first navigation, so |
1340 // there is no past session history to record. | 1323 // there is no past session history to record. |
1341 if (page_id_ == -1) | 1324 if (page_id_ == -1) |
1342 return; | 1325 return; |
(...skipping 2744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4087 std::vector<gfx::Size> sizes; | 4070 std::vector<gfx::Size> sizes; |
4088 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4071 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4089 if (!url.isEmpty()) | 4072 if (!url.isEmpty()) |
4090 urls.push_back( | 4073 urls.push_back( |
4091 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4074 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4092 } | 4075 } |
4093 SendUpdateFaviconURL(urls); | 4076 SendUpdateFaviconURL(urls); |
4094 } | 4077 } |
4095 | 4078 |
4096 } // namespace content | 4079 } // namespace content |
OLD | NEW |