Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: content/renderer/render_view.cc

Issue 8171015: Rename RenderThread to RenderThreadImpl (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "content/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "content/renderer/load_progress_tracker.h" 54 #include "content/renderer/load_progress_tracker.h"
55 #include "content/renderer/media/audio_message_filter.h" 55 #include "content/renderer/media/audio_message_filter.h"
56 #include "content/renderer/media/audio_renderer_impl.h" 56 #include "content/renderer/media/audio_renderer_impl.h"
57 #include "content/renderer/media/media_stream_impl.h" 57 #include "content/renderer/media/media_stream_impl.h"
58 #include "content/renderer/media/render_media_log.h" 58 #include "content/renderer/media/render_media_log.h"
59 #include "content/renderer/mhtml_generator.h" 59 #include "content/renderer/mhtml_generator.h"
60 #include "content/renderer/notification_provider.h" 60 #include "content/renderer/notification_provider.h"
61 #include "content/renderer/p2p/socket_dispatcher.h" 61 #include "content/renderer/p2p/socket_dispatcher.h"
62 #include "content/renderer/plugin_channel_host.h" 62 #include "content/renderer/plugin_channel_host.h"
63 #include "content/renderer/render_process.h" 63 #include "content/renderer/render_process.h"
64 #include "content/renderer/render_thread.h" 64 #include "content/renderer/render_thread_impl.h"
65 #include "content/renderer/render_widget_fullscreen_pepper.h" 65 #include "content/renderer/render_widget_fullscreen_pepper.h"
66 #include "content/renderer/renderer_accessibility.h" 66 #include "content/renderer/renderer_accessibility.h"
67 #include "content/renderer/renderer_webapplicationcachehost_impl.h" 67 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
68 #include "content/renderer/renderer_webstoragenamespace_impl.h" 68 #include "content/renderer/renderer_webstoragenamespace_impl.h"
69 #include "content/renderer/speech_input_dispatcher.h" 69 #include "content/renderer/speech_input_dispatcher.h"
70 #include "content/renderer/text_input_client_observer.h" 70 #include "content/renderer/text_input_client_observer.h"
71 #include "content/renderer/v8_value_converter_impl.h" 71 #include "content/renderer/v8_value_converter_impl.h"
72 #include "content/renderer/web_ui_bindings.h" 72 #include "content/renderer/web_ui_bindings.h"
73 #include "content/renderer/webplugin_delegate_proxy.h" 73 #include "content/renderer/webplugin_delegate_proxy.h"
74 #include "content/renderer/websharedworker_proxy.h" 74 #include "content/renderer/websharedworker_proxy.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 new TextInputClientObserver(this); 392 new TextInputClientObserver(this);
393 #endif // defined(OS_MACOSX) 393 #endif // defined(OS_MACOSX)
394 394
395 devtools_agent_ = new DevToolsAgent(this); 395 devtools_agent_ = new DevToolsAgent(this);
396 396
397 renderer_accessibility_ = new RendererAccessibility(this); 397 renderer_accessibility_ = new RendererAccessibility(this);
398 398
399 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 399 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
400 if (command_line.HasSwitch(switches::kEnableMediaStream)) { 400 if (command_line.HasSwitch(switches::kEnableMediaStream)) {
401 media_stream_impl_ = new MediaStreamImpl( 401 media_stream_impl_ = new MediaStreamImpl(
402 RenderThread::current()->video_capture_impl_manager()); 402 RenderThreadImpl::current()->video_capture_impl_manager());
403 } 403 }
404 404
405 content::GetContentClient()->renderer()->RenderViewCreated(this); 405 content::GetContentClient()->renderer()->RenderViewCreated(this);
406 } 406 }
407 407
408 RenderView::~RenderView() { 408 RenderView::~RenderView() {
409 history_page_ids_.clear(); 409 history_page_ids_.clear();
410 410
411 if (decrement_shared_popup_at_destruction_) 411 if (decrement_shared_popup_at_destruction_)
412 shared_popup_counter_->data--; 412 shared_popup_counter_->data--;
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 #if defined(OS_MACOSX) 942 #if defined(OS_MACOSX)
943 void RenderView::OnCopyToFindPboard() { 943 void RenderView::OnCopyToFindPboard() {
944 if (!webview()) 944 if (!webview())
945 return; 945 return;
946 946
947 // Since the find pasteboard supports only plain text, this can be simpler 947 // Since the find pasteboard supports only plain text, this can be simpler
948 // than the |OnCopy()| case. 948 // than the |OnCopy()| case.
949 WebFrame* frame = webview()->focusedFrame(); 949 WebFrame* frame = webview()->focusedFrame();
950 if (frame->hasSelection()) { 950 if (frame->hasSelection()) {
951 string16 selection = frame->selectionAsText(); 951 string16 selection = frame->selectionAsText();
952 RenderThread::current()->Send( 952 render_thread_->Send(
953 new ClipboardHostMsg_FindPboardWriteStringAsync(selection)); 953 new ClipboardHostMsg_FindPboardWriteStringAsync(selection));
954 } 954 }
955 } 955 }
956 #endif 956 #endif
957 957
958 void RenderView::OnPaste() { 958 void RenderView::OnPaste() {
959 if (!webview()) 959 if (!webview())
960 return; 960 return;
961 961
962 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Paste")); 962 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Paste"));
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( 1293 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage(
1294 routing_id_, message, default_value, frame_url, type, &success, result)); 1294 routing_id_, message, default_value, frame_url, type, &success, result));
1295 return success; 1295 return success;
1296 } 1296 }
1297 1297
1298 bool RenderView::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { 1298 bool RenderView::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) {
1299 // Before WebKit asks us to show an alert (etc.), it takes care of doing the 1299 // Before WebKit asks us to show an alert (etc.), it takes care of doing the
1300 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog 1300 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog
1301 // it is particularly important that we do not call willEnterModalLoop as 1301 // it is particularly important that we do not call willEnterModalLoop as
1302 // that would defer resource loads for the dialog itself. 1302 // that would defer resource loads for the dialog itself.
1303 if (RenderThread::current()) // Will be NULL during unit tests. 1303 if (RenderThreadImpl::current()) // Will be NULL during unit tests.
1304 RenderThread::current()->DoNotNotifyWebKitOfModalLoop(); 1304 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop();
1305 1305
1306 message->EnableMessagePumping(); // Runs a nested message loop. 1306 message->EnableMessagePumping(); // Runs a nested message loop.
1307 return Send(message); 1307 return Send(message);
1308 } 1308 }
1309 1309
1310 // WebKit::WebViewClient ------------------------------------------------------ 1310 // WebKit::WebViewClient ------------------------------------------------------
1311 1311
1312 WebView* RenderView::createView( 1312 WebView* RenderView::createView(
1313 WebFrame* creator, 1313 WebFrame* creator,
1314 const WebURLRequest& request, 1314 const WebURLRequest& request,
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 SyncSelectionIfRequired(); 1523 SyncSelectionIfRequired();
1524 #endif // defined(OS_POSIX) 1524 #endif // defined(OS_POSIX)
1525 } 1525 }
1526 1526
1527 void RenderView::didExecuteCommand(const WebString& command_name) { 1527 void RenderView::didExecuteCommand(const WebString& command_name) {
1528 const std::string& name = UTF16ToUTF8(command_name); 1528 const std::string& name = UTF16ToUTF8(command_name);
1529 if (StartsWithASCII(name, "Move", true) || 1529 if (StartsWithASCII(name, "Move", true) ||
1530 StartsWithASCII(name, "Insert", true) || 1530 StartsWithASCII(name, "Insert", true) ||
1531 StartsWithASCII(name, "Delete", true)) 1531 StartsWithASCII(name, "Delete", true))
1532 return; 1532 return;
1533 RenderThread::current()->RecordUserMetrics(name); 1533 RenderThreadImpl::current()->RecordUserMetrics(name);
1534 } 1534 }
1535 1535
1536 bool RenderView::handleCurrentKeyboardEvent() { 1536 bool RenderView::handleCurrentKeyboardEvent() {
1537 if (edit_commands_.empty()) 1537 if (edit_commands_.empty())
1538 return false; 1538 return false;
1539 1539
1540 WebFrame* frame = webview()->focusedFrame(); 1540 WebFrame* frame = webview()->focusedFrame();
1541 if (!frame) 1541 if (!frame)
1542 return false; 1542 return false;
1543 1543
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 void RenderView::runModal() { 1843 void RenderView::runModal() {
1844 DCHECK(did_show_) << "should already have shown the view"; 1844 DCHECK(did_show_) << "should already have shown the view";
1845 1845
1846 // We must keep WebKit's shared timer running in this case in order to allow 1846 // We must keep WebKit's shared timer running in this case in order to allow
1847 // showModalDialog to function properly. 1847 // showModalDialog to function properly.
1848 // 1848 //
1849 // TODO(darin): WebKit should really be smarter about suppressing events and 1849 // TODO(darin): WebKit should really be smarter about suppressing events and
1850 // timers so that we do not need to manage the shared timer in such a heavy 1850 // timers so that we do not need to manage the shared timer in such a heavy
1851 // handed manner. 1851 // handed manner.
1852 // 1852 //
1853 if (RenderThread::current()) // Will be NULL during unit tests. 1853 if (RenderThreadImpl::current()) // Will be NULL during unit tests.
1854 RenderThread::current()->DoNotSuspendWebKitSharedTimer(); 1854 RenderThreadImpl::current()->DoNotSuspendWebKitSharedTimer();
1855 1855
1856 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(routing_id_)); 1856 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(routing_id_));
1857 } 1857 }
1858 1858
1859 // WebKit::WebFrameClient ----------------------------------------------------- 1859 // WebKit::WebFrameClient -----------------------------------------------------
1860 1860
1861 WebPlugin* RenderView::createPlugin(WebFrame* frame, 1861 WebPlugin* RenderView::createPlugin(WebFrame* frame,
1862 const WebPluginParams& params) { 1862 const WebPluginParams& params) {
1863 WebPlugin* plugin = NULL; 1863 WebPlugin* plugin = NULL;
1864 if (content::GetContentClient()->renderer()->OverrideCreatePlugin( 1864 if (content::GetContentClient()->renderer()->OverrideCreatePlugin(
1865 this, frame, params, &plugin)) { 1865 this, frame, params, &plugin)) {
1866 return plugin; 1866 return plugin;
1867 } 1867 }
1868 1868
1869 return CreatePluginNoCheck(frame, params); 1869 return CreatePluginNoCheck(frame, params);
1870 } 1870 }
1871 1871
1872 WebWorker* RenderView::createWorker(WebFrame* frame, WebWorkerClient* client) { 1872 WebWorker* RenderView::createWorker(WebFrame* frame, WebWorkerClient* client) {
1873 WebApplicationCacheHostImpl* appcache_host = 1873 WebApplicationCacheHostImpl* appcache_host =
1874 WebApplicationCacheHostImpl::FromFrame(frame); 1874 WebApplicationCacheHostImpl::FromFrame(frame);
1875 int appcache_host_id = appcache_host ? appcache_host->host_id() : 0; 1875 int appcache_host_id = appcache_host ? appcache_host->host_id() : 0;
1876 return new WebWorkerProxy(client, RenderThread::current(), routing_id_, 1876 return new WebWorkerProxy(client, RenderThreadImpl::current(), routing_id_,
1877 appcache_host_id); 1877 appcache_host_id);
1878 } 1878 }
1879 1879
1880 WebSharedWorker* RenderView::createSharedWorker( 1880 WebSharedWorker* RenderView::createSharedWorker(
1881 WebFrame* frame, const WebURL& url, const WebString& name, 1881 WebFrame* frame, const WebURL& url, const WebString& name,
1882 unsigned long long document_id) { 1882 unsigned long long document_id) {
1883 1883
1884 int route_id = MSG_ROUTING_NONE; 1884 int route_id = MSG_ROUTING_NONE;
1885 bool exists = false; 1885 bool exists = false;
1886 bool url_mismatch = false; 1886 bool url_mismatch = false;
1887 ViewHostMsg_CreateWorker_Params params; 1887 ViewHostMsg_CreateWorker_Params params;
1888 params.url = url; 1888 params.url = url;
1889 params.is_shared = true; 1889 params.is_shared = true;
1890 params.name = name; 1890 params.name = name;
1891 params.document_id = document_id; 1891 params.document_id = document_id;
1892 params.render_view_route_id = routing_id_; 1892 params.render_view_route_id = routing_id_;
1893 params.route_id = MSG_ROUTING_NONE; 1893 params.route_id = MSG_ROUTING_NONE;
1894 params.parent_appcache_host_id = 0; 1894 params.parent_appcache_host_id = 0;
1895 params.script_resource_appcache_id = 0; 1895 params.script_resource_appcache_id = 0;
1896 Send(new ViewHostMsg_LookupSharedWorker( 1896 Send(new ViewHostMsg_LookupSharedWorker(
1897 params, &exists, &route_id, &url_mismatch)); 1897 params, &exists, &route_id, &url_mismatch));
1898 if (url_mismatch) { 1898 if (url_mismatch) {
1899 return NULL; 1899 return NULL;
1900 } else { 1900 } else {
1901 return new WebSharedWorkerProxy(RenderThread::current(), 1901 return new WebSharedWorkerProxy(RenderThreadImpl::current(),
1902 document_id, 1902 document_id,
1903 exists, 1903 exists,
1904 route_id, 1904 route_id,
1905 routing_id_); 1905 routing_id_);
1906 } 1906 }
1907 } 1907 }
1908 1908
1909 WebMediaPlayer* RenderView::createMediaPlayer( 1909 WebMediaPlayer* RenderView::createMediaPlayer(
1910 WebFrame* frame, WebMediaPlayerClient* client) { 1910 WebFrame* frame, WebMediaPlayerClient* client) {
1911 FOR_EACH_OBSERVER( 1911 FOR_EACH_OBSERVER(
(...skipping 29 matching lines...) Expand all
1941 video_renderer)) { 1941 video_renderer)) {
1942 return NULL; 1942 return NULL;
1943 } 1943 }
1944 return result.release(); 1944 return result.release();
1945 } 1945 }
1946 1946
1947 WebApplicationCacheHost* RenderView::createApplicationCacheHost( 1947 WebApplicationCacheHost* RenderView::createApplicationCacheHost(
1948 WebFrame* frame, WebApplicationCacheHostClient* client) { 1948 WebFrame* frame, WebApplicationCacheHostClient* client) {
1949 return new RendererWebApplicationCacheHostImpl( 1949 return new RendererWebApplicationCacheHostImpl(
1950 FromWebView(frame->view()), client, 1950 FromWebView(frame->view()), client,
1951 RenderThread::current()->appcache_dispatcher()->backend_proxy()); 1951 RenderThreadImpl::current()->appcache_dispatcher()->backend_proxy());
1952 } 1952 }
1953 1953
1954 WebCookieJar* RenderView::cookieJar(WebFrame* frame) { 1954 WebCookieJar* RenderView::cookieJar(WebFrame* frame) {
1955 return &cookie_jar_; 1955 return &cookie_jar_;
1956 } 1956 }
1957 1957
1958 void RenderView::frameDetached(WebFrame* frame) { 1958 void RenderView::frameDetached(WebFrame* frame) {
1959 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); 1959 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame));
1960 } 1960 }
1961 1961
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
2966 NOTIMPLEMENTED(); 2966 NOTIMPLEMENTED();
2967 return NULL; 2967 return NULL;
2968 #endif 2968 #endif
2969 } 2969 }
2970 2970
2971 return new WebPluginDelegateProxy(mime_type, AsWeakPtr()); 2971 return new WebPluginDelegateProxy(mime_type, AsWeakPtr());
2972 } 2972 }
2973 2973
2974 void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) { 2974 void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) {
2975 #if defined(USE_X11) 2975 #if defined(USE_X11)
2976 RenderThread::current()->Send(new ViewHostMsg_CreatePluginContainer( 2976 render_thread_->Send(new ViewHostMsg_CreatePluginContainer(
2977 routing_id(), window)); 2977 routing_id(), window));
2978 #endif 2978 #endif
2979 } 2979 }
2980 2980
2981 void RenderView::WillDestroyPluginWindow(gfx::PluginWindowHandle window) { 2981 void RenderView::WillDestroyPluginWindow(gfx::PluginWindowHandle window) {
2982 #if defined(USE_X11) 2982 #if defined(USE_X11)
2983 RenderThread::current()->Send(new ViewHostMsg_DestroyPluginContainer( 2983 render_thread_->Send(new ViewHostMsg_DestroyPluginContainer(
2984 routing_id(), window)); 2984 routing_id(), window));
2985 #endif 2985 #endif
2986 CleanupWindowInPluginMoves(window); 2986 CleanupWindowInPluginMoves(window);
2987 } 2987 }
2988 2988
2989 void RenderView::DidMovePlugin(const webkit::npapi::WebPluginGeometry& move) { 2989 void RenderView::DidMovePlugin(const webkit::npapi::WebPluginGeometry& move) {
2990 SchedulePluginMove(move); 2990 SchedulePluginMove(move);
2991 } 2991 }
2992 2992
2993 void RenderView::DidStartLoadingForPlugin() { 2993 void RenderView::DidStartLoadingForPlugin() {
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
4310 4310
4311 void RenderView::registerProtocolHandler(const WebString& scheme, 4311 void RenderView::registerProtocolHandler(const WebString& scheme,
4312 const WebString& base_url, 4312 const WebString& base_url,
4313 const WebString& url, 4313 const WebString& url,
4314 const WebString& title) { 4314 const WebString& title) {
4315 GURL base(base_url); 4315 GURL base(base_url);
4316 GURL absolute_url = base.Resolve(UTF16ToUTF8(url)); 4316 GURL absolute_url = base.Resolve(UTF16ToUTF8(url));
4317 if (base.GetOrigin() != absolute_url.GetOrigin()) { 4317 if (base.GetOrigin() != absolute_url.GetOrigin()) {
4318 return; 4318 return;
4319 } 4319 }
4320 RenderThread::current()->Send( 4320 Send(new ViewHostMsg_RegisterProtocolHandler(routing_id_,
4321 new ViewHostMsg_RegisterProtocolHandler(routing_id_, 4321 UTF16ToUTF8(scheme),
4322 UTF16ToUTF8(scheme), 4322 absolute_url,
4323 absolute_url, 4323 title));
4324 title));
4325 } 4324 }
4326 4325
4327 void RenderView::registerIntentHandler(const WebString& action, 4326 void RenderView::registerIntentHandler(const WebString& action,
4328 const WebString& type, 4327 const WebString& type,
4329 const WebString& href, 4328 const WebString& href,
4330 const WebString& title) { 4329 const WebString& title) {
4331 RenderThread::current()->Send( 4330 Send(new ViewHostMsg_RegisterIntentHandler(routing_id_,
4332 new ViewHostMsg_RegisterIntentHandler(routing_id_, 4331 action,
4333 action, 4332 type,
4334 type, 4333 href,
4335 href, 4334 title));
4336 title));
4337 } 4335 }
4338 4336
4339 WebKit::WebPageVisibilityState RenderView::visibilityState() const { 4337 WebKit::WebPageVisibilityState RenderView::visibilityState() const {
4340 WebKit::WebPageVisibilityState current_state = is_hidden() ? 4338 WebKit::WebPageVisibilityState current_state = is_hidden() ?
4341 WebKit::WebPageVisibilityStateHidden : 4339 WebKit::WebPageVisibilityStateHidden :
4342 WebKit::WebPageVisibilityStateVisible; 4340 WebKit::WebPageVisibilityStateVisible;
4343 WebKit::WebPageVisibilityState override_state = current_state; 4341 WebKit::WebPageVisibilityState override_state = current_state;
4344 if (content::GetContentClient()->renderer()-> 4342 if (content::GetContentClient()->renderer()->
4345 ShouldOverridePageVisibilityState(this, 4343 ShouldOverridePageVisibilityState(this,
4346 &override_state)) 4344 &override_state))
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
4459 main_frame->enableViewSourceMode(true); 4457 main_frame->enableViewSourceMode(true);
4460 } 4458 }
4461 4459
4462 void RenderView::OnLockMouseACK(bool succeeded) { 4460 void RenderView::OnLockMouseACK(bool succeeded) {
4463 pepper_delegate_.OnLockMouseACK(succeeded); 4461 pepper_delegate_.OnLockMouseACK(succeeded);
4464 } 4462 }
4465 4463
4466 void RenderView::OnMouseLockLost() { 4464 void RenderView::OnMouseLockLost() {
4467 pepper_delegate_.OnMouseLockLost(); 4465 pepper_delegate_.OnMouseLockLost();
4468 } 4466 }
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698