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

Unified Diff: content/renderer/browser_plugin/browser_plugin_impl.h

Issue 11826005: Browser Plugin: Implement BrowserPluginObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/browser_plugin/browser_plugin_impl.h
diff --git a/content/renderer/browser_plugin/browser_plugin.h b/content/renderer/browser_plugin/browser_plugin_impl.h
similarity index 91%
rename from content/renderer/browser_plugin/browser_plugin.h
rename to content/renderer/browser_plugin/browser_plugin_impl.h
index 0eeb8f90723f55767130696d2053e6c37b7b5ce3..859580445b9d611493ed61bc55e869913ba545cf 100644
--- a/content/renderer/browser_plugin/browser_plugin.h
+++ b/content/renderer/browser_plugin/browser_plugin_impl.h
@@ -2,22 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
-#define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
-
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h"
+#ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_IMPL_H_
+#define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_IMPL_H_
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/observer_list.h"
#include "base/process_util.h"
#include "base/sequenced_task_runner_helpers.h"
#if defined(OS_WIN)
#include "base/shared_memory.h"
#endif
+#include "content/public/renderer/browser_plugin/browser_plugin.h"
#include "content/renderer/browser_plugin/browser_plugin_backing_store.h"
#include "content/renderer/browser_plugin/browser_plugin_bindings.h"
#include "content/renderer/render_view_impl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragStatus.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h"
struct BrowserPluginHostMsg_AutoSize_Params;
struct BrowserPluginHostMsg_ResizeGuest_Params;
@@ -27,10 +28,12 @@ struct BrowserPluginMsg_UpdateRect_Params;
namespace content {
class BrowserPluginManager;
+class BrowserPluginObserver;
class MockBrowserPlugin;
-class CONTENT_EXPORT BrowserPlugin :
- NON_EXPORTED_BASE(public WebKit::WebPlugin) {
+class CONTENT_EXPORT BrowserPluginImpl :
+ NON_EXPORTED_BASE(public WebKit::WebPlugin),
+ public BrowserPlugin {
public:
RenderViewImpl* render_view() const { return render_view_.get(); }
@@ -118,6 +121,15 @@ class CONTENT_EXPORT BrowserPlugin :
gfx::Point ToLocalCoordinates(const gfx::Point& point) const;
+ // BrowserPlugin implementation.
+
sadrul 2013/01/09 15:21:54 remove newline
Fady Samuel 2013/01/09 17:41:24 Done.
+ virtual void AddMethodBinding(
+ BrowserPluginMethodBinding* method_binding) OVERRIDE;
+ virtual void AddPropertyBinding(
+ BrowserPluginPropertyBinding* method_binding) OVERRIDE;
+ virtual bool Send(IPC::Message* message) OVERRIDE;
sadrul 2013/01/09 15:21:54 It might make more sense to group the IPC::Sender
Fady Samuel 2013/01/09 17:41:24 Done.
+ virtual void RequestMessage(uint32 message_id) OVERRIDE;
+
// WebKit::WebPlugin implementation.
virtual WebKit::WebPluginContainer* container() const OVERRIDE;
virtual bool initialize(WebKit::WebPluginContainer* container) OVERRIDE;
@@ -157,9 +169,10 @@ class CONTENT_EXPORT BrowserPlugin :
void* notify_data,
const WebKit::WebURLError& error) OVERRIDE;
private:
- friend class base::DeleteHelper<BrowserPlugin>;
+ friend class base::DeleteHelper<BrowserPluginImpl>;
// Only the manager is allowed to create a BrowserPlugin.
friend class BrowserPluginManagerImpl;
+ friend class BrowserPluginObserver;
friend class MockBrowserPluginManager;
// For unit/integration tests.
@@ -171,13 +184,18 @@ class CONTENT_EXPORT BrowserPlugin :
// to it. It takes in a RenderViewImpl that it's associated with along
// with the frame within which it lives and the initial attributes assigned
// to it on creation.
- BrowserPlugin(
+ BrowserPluginImpl(
int instance_id,
RenderViewImpl* render_view,
WebKit::WebFrame* frame,
const WebKit::WebPluginParams& params);
- virtual ~BrowserPlugin();
+ virtual ~BrowserPluginImpl();
+
+ // Add and remove observers for filtering IPC messages. Clients must be sure
sadrul 2013/01/09 15:21:54 single space after the dot
Fady Samuel 2013/01/09 17:41:24 Done.
+ // to remove the observer before they go away.
+ void AddObserver(BrowserPluginObserver* observer);
+ void RemoveObserver(BrowserPluginObserver* observer);
int width() const { return plugin_rect_.width(); }
int height() const { return plugin_rect_.height(); }
@@ -310,6 +328,9 @@ class CONTENT_EXPORT BrowserPlugin :
// avoid accessing the RenderViewImpl.
scoped_refptr<BrowserPluginManager> browser_plugin_manager_;
+ // A list of observers that filter messages. Weak references.
sadrul 2013/01/09 15:21:54 ditto
Fady Samuel 2013/01/09 17:41:24 Done.
+ ObserverList<BrowserPluginObserver> observers_;
+
// Important: Do not add more history state here.
// We strongly discourage storing additional history state (such as page IDs)
// in the embedder process, at the risk of having incorrect information that
@@ -326,9 +347,9 @@ class CONTENT_EXPORT BrowserPlugin :
// Used for HW compositing.
bool compositing_enabled_;
- DISALLOW_COPY_AND_ASSIGN(BrowserPlugin);
+ DISALLOW_COPY_AND_ASSIGN(BrowserPluginImpl);
};
} // namespace content
-#endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
+#endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698