Skip to content

Commit

Permalink
Move RenderProcessObserver and RenderViewVisitor to content\public\re…
Browse files Browse the repository at this point in the history
…nderer and put them in the content namespace.

BUG=98716
Review URL: http://codereview.chromium.org/8116009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103796 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jam@chromium.org committed Oct 3, 2011
1 parent 26be0e2 commit 64ffa04
Show file tree
Hide file tree
Showing 20 changed files with 92 additions and 95 deletions.
15 changes: 8 additions & 7 deletions chrome/renderer/chrome_render_process_observer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#include "content/common/resource_dispatcher.h"
#include "content/common/resource_dispatcher_delegate.h"
#include "content/common/view_messages.h"
#include "content/public/renderer/render_view_visitor.h"
#include "content/renderer/render_thread.h"
#include "content/renderer/render_view.h"
#include "content/renderer/render_view_visitor.h"
#include "crypto/nss_util.h"
#include "media/base/media.h"
#include "media/base/media_switches.h"
Expand Down Expand Up @@ -107,7 +107,7 @@ class RendererResourceDelegate : public ResourceDispatcherDelegate {
DISALLOW_COPY_AND_ASSIGN(RendererResourceDelegate);
};

class RenderViewContentSettingsSetter : public RenderViewVisitor {
class RenderViewContentSettingsSetter : public content::RenderViewVisitor {
public:
RenderViewContentSettingsSetter(const GURL& url,
const ContentSettings& content_settings)
Expand Down Expand Up @@ -326,7 +326,7 @@ void ChromeRenderProcessObserver::OnClearCache(bool on_navigation) {
void ChromeRenderProcessObserver::OnGetCacheResourceStats() {
WebCache::ResourceTypeStats stats;
WebCache::getResourceTypeStats(&stats);
Send(new ChromeViewHostMsg_ResourceTypeStats(stats));
RenderThread::current()->Send(new ChromeViewHostMsg_ResourceTypeStats(stats));
}

#if defined(USE_TCMALLOC)
Expand All @@ -335,7 +335,7 @@ void ChromeRenderProcessObserver::OnGetRendererTcmalloc() {
char buffer[1024 * 32];
MallocExtension::instance()->GetStats(buffer, sizeof(buffer));
result.append(buffer);
Send(new ChromeViewHostMsg_RendererTcmalloc(result));
RenderThread::current()->Send(new ChromeViewHostMsg_RendererTcmalloc(result));
}

void ChromeRenderProcessObserver::OnSetTcmallocHeapProfiling(
Expand Down Expand Up @@ -364,7 +364,8 @@ void ChromeRenderProcessObserver::OnWriteTcmallocHeapProfile(
// a string and pass it to the handler (which runs on the browser host).
std::string result(profile);
delete profile;
Send(new ChromeViewHostMsg_WriteTcmallocHeapProfile_ACK(filename, result));
RenderThread::current()->Send(
new ChromeViewHostMsg_WriteTcmallocHeapProfile_ACK(filename, result));
#endif
}

Expand All @@ -379,8 +380,8 @@ void ChromeRenderProcessObserver::OnSetFieldTrialGroup(
void ChromeRenderProcessObserver::OnGetV8HeapStats() {
v8::HeapStatistics heap_stats;
v8::V8::GetHeapStatistics(&heap_stats);
Send(new ChromeViewHostMsg_V8HeapStats(heap_stats.total_heap_size(),
heap_stats.used_heap_size()));
RenderThread::current()->Send(new ChromeViewHostMsg_V8HeapStats(
heap_stats.total_heap_size(), heap_stats.used_heap_size()));
}

void ChromeRenderProcessObserver::OnPurgeMemory() {
Expand Down
4 changes: 2 additions & 2 deletions chrome/renderer/chrome_render_process_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "base/compiler_specific.h"
#include "base/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "content/renderer/render_process_observer.h"
#include "content/public/renderer/render_process_observer.h"

namespace chrome {
class ChromeContentRendererClient;
Expand All @@ -25,7 +25,7 @@ struct ContentSettings;
// a RenderView) for Chrome specific messages that the content layer doesn't
// happen. If a few messages are related, they should probably have their own
// observer.
class ChromeRenderProcessObserver : public RenderProcessObserver {
class ChromeRenderProcessObserver : public content::RenderProcessObserver {
public:
explicit ChromeRenderProcessObserver(
chrome::ChromeContentRendererClient* client);
Expand Down
4 changes: 2 additions & 2 deletions chrome/renderer/extensions/extension_dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "base/shared_memory.h"
#include "base/timer.h"
#include "content/renderer/render_process_observer.h"
#include "content/public/renderer/render_process_observer.h"
#include "chrome/common/extensions/extension_set.h"

class GURL;
Expand All @@ -36,7 +36,7 @@ class Extension;

// Dispatches extension control messages sent to the renderer and stores
// renderer extension related state.
class ExtensionDispatcher : public RenderProcessObserver {
class ExtensionDispatcher : public content::RenderProcessObserver {
public:
ExtensionDispatcher();
virtual ~ExtensionDispatcher();
Expand Down
4 changes: 2 additions & 2 deletions chrome/renderer/extensions/extension_process_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "chrome/common/extensions/url_pattern.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "content/public/renderer/render_view_visitor.h"
#include "chrome/renderer/chrome_render_process_observer.h"
#include "chrome/renderer/extensions/chrome_v8_extension.h"
#include "chrome/renderer/extensions/event_bindings.h"
Expand All @@ -35,7 +36,6 @@
#include "chrome/renderer/extensions/user_script_slave.h"
#include "chrome/renderer/static_v8_external_string_resource.h"
#include "content/renderer/render_view.h"
#include "content/renderer/render_view_visitor.h"
#include "grit/common_resources.h"
#include "grit/renderer_resources.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebBlob.h"
Expand Down Expand Up @@ -78,7 +78,7 @@ base::LazyInstance<PendingRequestMap> g_pending_requests(
// views, looking for a view of the given type, in the given browser window
// and within the given extension.
// Used to accumulate the list of views associated with an extension.
class ExtensionViewAccumulator : public RenderViewVisitor {
class ExtensionViewAccumulator : public content::RenderViewVisitor {
public:
ExtensionViewAccumulator(const std::string& extension_id,
int browser_window_id,
Expand Down
4 changes: 2 additions & 2 deletions chrome/renderer/renderer_histogram_snapshots.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#include "base/process.h"
#include "base/task.h"
#include "chrome/common/metrics_helpers.h"
#include "content/renderer/render_process_observer.h"
#include "content/public/renderer/render_process_observer.h"

class RendererHistogramSnapshots : public HistogramSender,
public RenderProcessObserver {
public content::RenderProcessObserver {
public:
RendererHistogramSnapshots();
virtual ~RendererHistogramSnapshots();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void PhishingClassifierDelegate::ClassificationDone(
<< " score = " << verdict.client_score();
if (verdict.client_score() != PhishingClassifier::kInvalidScore) {
DCHECK_EQ(last_url_sent_to_classifier_.spec(), verdict.url());
Send(new SafeBrowsingHostMsg_PhishingDetectionDone(
RenderThread::current()->Send(new SafeBrowsingHostMsg_PhishingDetectionDone(
routing_id(), verdict.SerializeAsString()));
}
}
Expand Down
4 changes: 2 additions & 2 deletions chrome/renderer/safe_browsing/phishing_classifier_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
#include "content/common/page_transition_types.h"
#include "content/public/renderer/render_process_observer.h"
#include "content/public/renderer/render_view_observer.h"
#include "content/renderer/render_process_observer.h"
#include "googleurl/src/gurl.h"

namespace safe_browsing {
class ClientPhishingRequest;
class PhishingClassifier;
class Scorer;

class PhishingClassifierFilter : public RenderProcessObserver {
class PhishingClassifierFilter : public content::RenderProcessObserver {
public:
static PhishingClassifierFilter* Create();
virtual ~PhishingClassifierFilter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "chrome/renderer/chrome_content_renderer_client.h"
#include "content/renderer/render_view_visitor.h"
#include "content/public/renderer/render_view_visitor.h"
#include "ipc/ipc_channel.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand All @@ -70,7 +70,7 @@ namespace safe_browsing {

class RenderViewFakeResourcesTest : public ::testing::Test,
public IPC::Channel::Listener,
public RenderViewVisitor {
public content::RenderViewVisitor {
public:
// IPC::Channel::Listener implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
Expand Down
12 changes: 7 additions & 5 deletions chrome/renderer/spellchecker/spellcheck.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "chrome/common/render_messages.h"
#include "chrome/common/spellcheck_common.h"
#include "chrome/common/spellcheck_messages.h"
#include "content/renderer/render_thread.h"
#include "third_party/hunspell/src/hunspell/hunspell.hxx"

using base::TimeTicks;
Expand Down Expand Up @@ -221,7 +222,7 @@ bool SpellCheck::InitializeIfNeeded() {
return false;

if (!initialized_) {
Send(new SpellCheckHostMsg_RequestDictionary);
RenderThread::current()->Send(new SpellCheckHostMsg_RequestDictionary);
initialized_ = true;
return true;
}
Expand All @@ -239,8 +240,8 @@ bool SpellCheck::CheckSpelling(const string16& word_to_check, int tag) {
bool word_correct = false;

if (is_using_platform_spelling_engine_) {
Send(new SpellCheckHostMsg_PlatformCheckSpelling(word_to_check, tag,
&word_correct));
RenderThread::current()->Send(new SpellCheckHostMsg_PlatformCheckSpelling(
word_to_check, tag, &word_correct));
} else {
std::string word_to_check_utf8(UTF16ToUTF8(word_to_check));
// Hunspell shouldn't let us exceed its max, but check just in case
Expand All @@ -264,8 +265,9 @@ void SpellCheck::FillSuggestionList(
const string16& wrong_word,
std::vector<string16>* optional_suggestions) {
if (is_using_platform_spelling_engine_) {
Send(new SpellCheckHostMsg_PlatformFillSuggestionList(
wrong_word, optional_suggestions));
RenderThread::current()->Send(
new SpellCheckHostMsg_PlatformFillSuggestionList(
wrong_word, optional_suggestions));
return;
}

Expand Down
4 changes: 2 additions & 2 deletions chrome/renderer/spellchecker/spellcheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "base/string16.h"
#include "base/time.h"
#include "chrome/renderer/spellchecker/spellcheck_worditerator.h"
#include "content/renderer/render_process_observer.h"
#include "content/public/renderer/render_process_observer.h"
#include "ipc/ipc_platform_file.h"
#include "unicode/uscript.h"

Expand All @@ -27,7 +27,7 @@ class MemoryMappedFile;

// TODO(morrita): Needs reorg with SpellCheckProvider.
// See http://crbug.com/73699.
class SpellCheck : public RenderProcessObserver {
class SpellCheck : public content::RenderProcessObserver {
public:
SpellCheck();
virtual ~SpellCheck();
Expand Down
4 changes: 2 additions & 2 deletions chrome/renderer/visitedlink_slave.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

#include "base/shared_memory.h"
#include "chrome/common/visitedlink_common.h"
#include "content/renderer/render_process_observer.h"
#include "content/public/renderer/render_process_observer.h"

// Reads the link coloring database provided by the master. There can be any
// number of slaves reading the same database.
class VisitedLinkSlave : public VisitedLinkCommon,
public RenderProcessObserver {
public content::RenderProcessObserver {
public:
VisitedLinkSlave();
virtual ~VisitedLinkSlave();
Expand Down
6 changes: 3 additions & 3 deletions content/content_renderer.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
],
'sources': [
'public/renderer/content_renderer_client.h',
'public/renderer/render_process_observer.cc',
'public/renderer/render_process_observer.h',
'public/renderer/render_view_observer.cc',
'public/renderer/render_view_observer.h',
'public/renderer/render_view_observer_tracker.h',
'public/renderer/render_view_visitor.h',
'renderer/active_notification_tracker.cc',
'renderer/active_notification_tracker.h',
'renderer/device_orientation_dispatcher.cc',
Expand Down Expand Up @@ -105,16 +108,13 @@
'renderer/render_process.h',
'renderer/render_process_impl.cc',
'renderer/render_process_impl.h',
'renderer/render_process_observer.cc',
'renderer/render_process_observer.h',
'renderer/render_thread.cc',
'renderer/render_thread.h',
'renderer/render_view.cc',
'renderer/render_view.h',
'renderer/render_view_linux.cc',
'renderer/render_view_selection.cc',
'renderer/render_view_selection.h',
'renderer/render_view_visitor.h',
'renderer/render_widget.cc',
'renderer/render_widget.h',
'renderer/render_widget_fullscreen.cc',
Expand Down
14 changes: 14 additions & 0 deletions content/public/renderer/render_process_observer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// 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.

#include "content/public/renderer/render_process_observer.h"

namespace content {

bool RenderProcessObserver::OnControlMessageReceived(
const IPC::Message& message) {
return false;
}

} // namespace content
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,41 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_RENDERER_RENDER_PROCESS_OBSERVER_H_
#define CONTENT_RENDERER_RENDER_PROCESS_OBSERVER_H_
#ifndef CONTENT_PUBLIC_RENDERER_RENDER_PROCESS_OBSERVER_H_
#define CONTENT_PUBLIC_RENDERER_RENDER_PROCESS_OBSERVER_H_
#pragma once

#include "base/basictypes.h"
#include "ipc/ipc_message.h"
#include "content/common/content_export.h"

class GURL;
namespace IPC {
class Message;
}

namespace content {

// Base class for objects that want to filter control IPC messages and get
// notified of events.
class CONTENT_EXPORT RenderProcessObserver : public IPC::Message::Sender {
class CONTENT_EXPORT RenderProcessObserver {
public:
RenderProcessObserver();
virtual ~RenderProcessObserver();

// IPC::Message::Sender
virtual bool Send(IPC::Message* message);
RenderProcessObserver() {}
virtual ~RenderProcessObserver() {}

// Allows filtering of control messages.
virtual bool OnControlMessageReceived(const IPC::Message& message);

// Notification that the render process is shutting down.
virtual void OnRenderProcessShutdown();
virtual void OnRenderProcessShutdown() {}

// Called right after the WebKit API is initialized.
virtual void WebKitInitialized();
virtual void WebKitInitialized() {}

virtual void IdleNotification();
virtual void IdleNotification() {}

private:
DISALLOW_COPY_AND_ASSIGN(RenderProcessObserver);
};

#endif // CONTENT_RENDERER_RENDER_PROCESS_OBSERVER_H_
} // namespace content

#endif // CONTENT_PUBLIC_RENDERER_RENDER_PROCESS_OBSERVER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_RENDERER_RENDER_VIEW_VISITOR_H_
#define CONTENT_RENDERER_RENDER_VIEW_VISITOR_H_
#ifndef CONTENT_PUBLIC_RENDERER_RENDER_VIEW_VISITOR_H_
#define CONTENT_PUBLIC_RENDERER_RENDER_VIEW_VISITOR_H_
#pragma once

class RenderView;

namespace content {

class RenderViewVisitor {
public:
// Return true to continue visiting RenderViews or false to stop.
Expand All @@ -17,4 +19,6 @@ class RenderViewVisitor {
virtual ~RenderViewVisitor() {}
};

#endif // CONTENT_RENDERER_RENDER_VIEW_VISITOR_H_
} // namespace content

#endif // CONTENT_PUBLIC_RENDERER_RENDER_VIEW_VISITOR_H_
Loading

0 comments on commit 64ffa04

Please sign in to comment.