summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 18:17:08 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 18:17:08 +0000
commit8d97adeeabe5d28a50711423268168448bf56fd5 (patch)
tree9ef3250afc5c77c3425bb8c3789d7136cc99336b /content
parent9e611f644c8043f2cf957af5ed094b1280ee1459 (diff)
downloadchromium_src-8d97adeeabe5d28a50711423268168448bf56fd5.zip
chromium_src-8d97adeeabe5d28a50711423268168448bf56fd5.tar.gz
chromium_src-8d97adeeabe5d28a50711423268168448bf56fd5.tar.bz2
Move a bunch of Chrome specific code out of RenderThread, in preparation of moving it to content.
Review URL: http://codereview.chromium.org/6850003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81614 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/common/content_client.cc2
-rw-r--r--content/common/content_client.h9
-rw-r--r--content/common/gpu/content_gpu_client.h24
-rw-r--r--content/content_common.gypi1
-rw-r--r--content/gpu/gpu_child_thread.cc4
-rw-r--r--content/renderer/DEPS1
-rw-r--r--content/renderer/content_renderer_client.cc14
-rw-r--r--content/renderer/content_renderer_client.h11
-rw-r--r--content/renderer/render_view.cc22
-rw-r--r--content/renderer/render_view.h4
-rw-r--r--content/renderer/renderer_webkitclient_impl.cc5
11 files changed, 36 insertions, 61 deletions
diff --git a/content/common/content_client.cc b/content/common/content_client.cc
index 79fe8cc..53758bb 100644
--- a/content/common/content_client.cc
+++ b/content/common/content_client.cc
@@ -17,7 +17,7 @@ ContentClient* GetContentClient() {
}
ContentClient::ContentClient() :
- browser_(NULL), gpu_(NULL), plugin_(NULL), renderer_(NULL) {
+ browser_(NULL), plugin_(NULL), renderer_(NULL) {
}
ContentClient::~ContentClient() {
diff --git a/content/common/content_client.h b/content/common/content_client.h
index 8836a44..9b7da6f 100644
--- a/content/common/content_client.h
+++ b/content/common/content_client.h
@@ -9,12 +9,12 @@
#include "base/basictypes.h"
class GURL;
+struct GPUInfo;
namespace content {
class ContentBrowserClient;
class ContentClient;
-class ContentGpuClient;
class ContentPluginClient;
class ContentRendererClient;
@@ -31,8 +31,6 @@ class ContentClient {
ContentBrowserClient* browser() { return browser_; }
void set_browser(ContentBrowserClient* c) { browser_ = c; }
- ContentGpuClient* gpu() { return gpu_; }
- void set_gpu(ContentGpuClient* g) { gpu_ = g; }
ContentPluginClient* plugin() { return plugin_; }
void set_plugin(ContentPluginClient* r) { plugin_ = r; }
ContentRendererClient* renderer() { return renderer_; }
@@ -42,11 +40,12 @@ class ContentClient {
// clear the URL.
virtual void SetActiveURL(const GURL& url) {}
+ // Sets the data on the current gpu.
+ virtual void SetGpuInfo(const GPUInfo& gpu_info) {}
+
private:
// The embedder API for participating in browser logic.
ContentBrowserClient* browser_;
- // The embedder API for participating in gpu logic.
- ContentGpuClient* gpu_;
// The embedder API for participating in plugin logic.
ContentPluginClient* plugin_;
// The embedder API for participating in renderer logic.
diff --git a/content/common/gpu/content_gpu_client.h b/content/common/gpu/content_gpu_client.h
deleted file mode 100644
index 3df4de2..0000000
--- a/content/common/gpu/content_gpu_client.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_COMMON_GPU_CONTENT_GPU_CLIENT_H_
-#define CONTENT_COMMON_GPU_CONTENT_GPU_CLIENT_H_
-#pragma once
-
-#include "content/common/content_client.h"
-
-struct GPUInfo;
-
-namespace content {
-
-// Embedder API for participating in plugin logic.
-class ContentGpuClient {
- public:
- // Sets the data on the gpu to send along with crash reports.
- virtual void SetGpuInfo(const GPUInfo& gpu_info) {}
-};
-
-} // namespace content
-
-#endif // CONTENT_COMMON_GPU_CONTENT_GPU_CLIENT_H_
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 1047715..de8e378 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -94,7 +94,6 @@
'common/geolocation_messages.h',
'common/geoposition.cc',
'common/geoposition.h',
- 'common/gpu/content_gpu_client.h',
'common/gpu/gpu_channel.cc',
'common/gpu/gpu_channel.h',
'common/gpu/gpu_channel_manager.cc',
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
index f0a8aad..af52c53 100644
--- a/content/gpu/gpu_child_thread.cc
+++ b/content/gpu/gpu_child_thread.cc
@@ -13,7 +13,7 @@
#include "build/build_config.h"
#include "chrome/common/chrome_switches.h"
#include "content/common/child_process.h"
-#include "content/common/gpu/content_gpu_client.h"
+#include "content/common/content_client.h"
#include "content/common/gpu_messages.h"
#include "content/gpu/gpu_info_collector.h"
#include "content/gpu/gpu_watchdog_thread.h"
@@ -125,7 +125,7 @@ void GpuChildThread::OnInitialize() {
}
gpu_info_collector::CollectGraphicsInfo(&gpu_info_);
- content::GetContentClient()->gpu()->SetGpuInfo(gpu_info_);
+ content::GetContentClient()->SetGpuInfo(gpu_info_);
LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo complete";
// Record initialization only after collecting the GPU info because that can
diff --git a/content/renderer/DEPS b/content/renderer/DEPS
index bda91c8..9758979 100644
--- a/content/renderer/DEPS
+++ b/content/renderer/DEPS
@@ -4,6 +4,7 @@ include_rules = [
"-chrome/renderer/autofill",
"-chrome/renderer/extensions",
"-chrome/renderer/safe_browsing",
+ "-chrome/renderer/spellchecker",
"+content/plugin", # For shared npruntime proxying code.
"+v8/include",
diff --git a/content/renderer/content_renderer_client.cc b/content/renderer/content_renderer_client.cc
index a4bdd28..87dd711 100644
--- a/content/renderer/content_renderer_client.cc
+++ b/content/renderer/content_renderer_client.cc
@@ -9,10 +9,15 @@
using WebKit::WebFrame;
namespace content {
+void ContentRendererClient::RenderThreadStarted() {
+}
void ContentRendererClient::RenderViewCreated(RenderView* render_view) {
}
+void ContentRendererClient::SetNumberOfViews(int number_of_views) {
+}
+
SkBitmap* ContentRendererClient::GetSadPluginBitmap() {
return NULL;
}
@@ -63,4 +68,13 @@ void ContentRendererClient::DidDestroyScriptContext(WebFrame* frame) {
void ContentRendererClient::DidCreateIsolatedScriptContext(WebFrame* frame) {
}
+unsigned long long ContentRendererClient::VisitedLinkHash(
+ const char* canonical_url, size_t length) {
+ return 0;
+}
+
+bool ContentRendererClient::IsLinkVisited(unsigned long long link_hash) {
+ return false;
+}
+
} // namespace content
diff --git a/content/renderer/content_renderer_client.h b/content/renderer/content_renderer_client.h
index ea15759..1dc9450 100644
--- a/content/renderer/content_renderer_client.h
+++ b/content/renderer/content_renderer_client.h
@@ -28,9 +28,15 @@ namespace content {
// Embedder API for participating in renderer logic.
class ContentRendererClient {
public:
+ // Notifies us that the RenderThread has been created.
+ virtual void RenderThreadStarted();
+
// Notifies that a new RenderView has been created.
virtual void RenderViewCreated(RenderView* render_view);
+ // Sets a number of views/tabs opened in this process.
+ virtual void SetNumberOfViews(int number_of_views);
+
// Returns the bitmap to show when a plugin crashed, or NULL for none.
virtual SkBitmap* GetSadPluginBitmap();
@@ -72,6 +78,11 @@ class ContentRendererClient {
virtual void DidCreateScriptContext(WebKit::WebFrame* frame);
virtual void DidDestroyScriptContext(WebKit::WebFrame* frame);
virtual void DidCreateIsolatedScriptContext(WebKit::WebFrame* frame);
+
+ // See WebKit::WebKitClient.
+ virtual unsigned long long VisitedLinkHash(const char* canonical_url,
+ size_t length);
+ virtual bool IsLinkVisited(unsigned long long link_hash);
};
} // namespace content
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc
index 4ea0bcc..74ef462 100644
--- a/content/renderer/render_view.cc
+++ b/content/renderer/render_view.cc
@@ -42,8 +42,6 @@
#include "chrome/renderer/render_process.h"
#include "chrome/renderer/render_thread.h"
#include "chrome/renderer/searchbox.h"
-#include "chrome/renderer/spellchecker/spellcheck.h"
-#include "chrome/renderer/spellchecker/spellcheck_provider.h"
#include "chrome/renderer/visitedlink_slave.h"
#include "content/common/appcache/appcache_dispatcher.h"
#include "content/common/clipboard_messages.h"
@@ -442,7 +440,6 @@ RenderView::RenderView(RenderThreadBase* render_thread,
geolocation_dispatcher_(NULL),
speech_input_dispatcher_(NULL),
device_orientation_dispatcher_(NULL),
- spellcheck_provider_(NULL),
accessibility_ack_pending_(false),
p2p_socket_dispatcher_(NULL),
pending_app_icon_requests_(0),
@@ -501,11 +498,6 @@ RenderView::RenderView(RenderThreadBase* render_thread,
audio_message_filter_ = new AudioMessageFilter(routing_id_);
render_thread_->AddFilter(audio_message_filter_);
- RenderThread* current_thread = RenderThread::current();
- SpellCheck* spellcheck = current_thread ? current_thread->spellchecker() : 0;
- spellcheck_provider_ = new SpellCheckProvider(this, spellcheck);
- webview()->setSpellCheckClient(spellcheck_provider_);
-
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableP2PApi)) {
p2p_socket_dispatcher_ = new P2PSocketDispatcher(this);
@@ -1945,20 +1937,6 @@ bool RenderView::runModalBeforeUnloadDialog(
void RenderView::showContextMenu(
WebFrame* frame, const WebContextMenuData& data) {
ContextMenuParams params = ContextMenuParams(data);
-#if !defined(WEBSPELLCHECKCLIENT_HAS_SUGGESTIONS)
- if (!params.misspelled_word.empty() && RenderThread::current()) {
- int misspelled_offset, misspelled_length;
- bool spelled_right = RenderThread::current()->spellchecker()->
- SpellCheckWord(
- params.misspelled_word.c_str(), params.misspelled_word.size(),
- spellcheck_provider_->document_tag(),
- &misspelled_offset, &misspelled_length,
- &params.dictionary_suggestions);
- if (spelled_right)
- params.misspelled_word.clear();
- }
-#endif
-
// Serializing a GURL longer than content::kMaxURLChars will fail, so don't do
// it. We replace it with an empty GURL so the appropriate items are disabled
// in the context menu.
diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h
index efe2323..f1c983e 100644
--- a/content/renderer/render_view.h
+++ b/content/renderer/render_view.h
@@ -72,7 +72,6 @@ class RenderViewVisitor;
class RenderWidgetFullscreenPepper;
class SkBitmap;
class SpeechInputDispatcher;
-class SpellCheckProvider;
class WebPluginDelegatePepper;
class WebPluginDelegateProxy;
class WebUIBindings;
@@ -1215,9 +1214,6 @@ class RenderView : public RenderWidget,
// Device orientation dispatcher attached to this view; lazily initialized.
DeviceOrientationDispatcher* device_orientation_dispatcher_;
- // spellcheck provider which is registered as a view observer.
- SpellCheckProvider* spellcheck_provider_;
-
scoped_refptr<AudioMessageFilter> audio_message_filter_;
// Handles accessibility requests into the renderer side, as well as
diff --git a/content/renderer/renderer_webkitclient_impl.cc b/content/renderer/renderer_webkitclient_impl.cc
index 92ec578f..6ae54fc 100644
--- a/content/renderer/renderer_webkitclient_impl.cc
+++ b/content/renderer/renderer_webkitclient_impl.cc
@@ -23,6 +23,7 @@
#include "content/common/webblobregistry_impl.h"
#include "content/common/webmessageportchannel_impl.h"
#include "content/plugin/npobject_util.h"
+#include "content/renderer/content_renderer_client.h"
#include "content/renderer/render_view.h"
#include "content/renderer/renderer_webaudiodevice_impl.h"
#include "content/renderer/renderer_webidbfactory_impl.h"
@@ -201,12 +202,12 @@ bool RendererWebKitClientImpl::SendSyncMessageFromAnyThread(
unsigned long long RendererWebKitClientImpl::visitedLinkHash(
const char* canonical_url,
size_t length) {
- return RenderThread::current()->visited_link_slave()->ComputeURLFingerprint(
+ return content::GetContentClient()->renderer()->VisitedLinkHash(
canonical_url, length);
}
bool RendererWebKitClientImpl::isLinkVisited(unsigned long long link_hash) {
- return RenderThread::current()->visited_link_slave()->IsVisited(link_hash);
+ return content::GetContentClient()->renderer()->IsLinkVisited(link_hash);
}
WebKit::WebMessagePortChannel*