| Index: content/public/renderer/browser_plugin/browser_plugin_observer.cc
|
| diff --git a/content/public/renderer/browser_plugin/browser_plugin_observer.cc b/content/public/renderer/browser_plugin/browser_plugin_observer.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..219ed49a5f9068e98dc882fd59c530c566b088f6
|
| --- /dev/null
|
| +++ b/content/public/renderer/browser_plugin/browser_plugin_observer.cc
|
| @@ -0,0 +1,51 @@
|
| +// Copyright (c) 2012 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/browser_plugin/browser_plugin_observer.h"
|
| +
|
| +#include "content/public/renderer/browser_plugin/browser_plugin.h"
|
| +#include "content/renderer/browser_plugin/browser_plugin_impl.h"
|
| +#include "ipc/ipc_message.h"
|
| +
|
| +namespace content {
|
| +
|
| +BrowserPluginObserver::BrowserPluginObserver(BrowserPlugin* browser_plugin)
|
| + : browser_plugin_(browser_plugin) {
|
| + CHECK(browser_plugin);
|
| + BrowserPluginImpl* impl = static_cast<BrowserPluginImpl*>(browser_plugin);
|
| + impl->AddObserver(this);
|
| +}
|
| +
|
| +BrowserPluginObserver::~BrowserPluginObserver() {
|
| + if (browser_plugin_) {
|
| + BrowserPluginImpl* impl = static_cast<BrowserPluginImpl*>(browser_plugin_);
|
| + impl->RemoveObserver(this);
|
| + }
|
| +}
|
| +
|
| +void BrowserPluginObserver::OnDestruct() {
|
| + delete this;
|
| +}
|
| +
|
| +bool BrowserPluginObserver::OnMessageReceived(const IPC::Message& message) {
|
| + return false;
|
| +}
|
| +
|
| +bool BrowserPluginObserver::Send(IPC::Message* message) {
|
| + if (browser_plugin_)
|
| + return browser_plugin_->Send(message);
|
| +
|
| + delete message;
|
| + return false;
|
| +}
|
| +
|
| +BrowserPlugin* BrowserPluginObserver::browser_plugin() const {
|
| + return browser_plugin_;
|
| +}
|
| +
|
| +void BrowserPluginObserver::BrowserPluginGone() {
|
| + browser_plugin_ = NULL;
|
| +}
|
| +
|
| +} // namespace content
|
|
|