OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/public/renderer/browser_plugin/browser_plugin_observer.h" |
| 6 |
| 7 #include "content/public/renderer/browser_plugin/browser_plugin.h" |
| 8 #include "content/renderer/browser_plugin/browser_plugin_impl.h" |
| 9 #include "ipc/ipc_message.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 BrowserPluginObserver::BrowserPluginObserver(BrowserPlugin* browser_plugin) |
| 14 : browser_plugin_(browser_plugin) { |
| 15 CHECK(browser_plugin); |
| 16 BrowserPluginImpl* impl = static_cast<BrowserPluginImpl*>(browser_plugin); |
| 17 impl->AddObserver(this); |
| 18 } |
| 19 |
| 20 BrowserPluginObserver::~BrowserPluginObserver() { |
| 21 if (browser_plugin_) { |
| 22 BrowserPluginImpl* impl = static_cast<BrowserPluginImpl*>(browser_plugin_); |
| 23 impl->RemoveObserver(this); |
| 24 } |
| 25 } |
| 26 |
| 27 void BrowserPluginObserver::OnDestruct() { |
| 28 delete this; |
| 29 } |
| 30 |
| 31 bool BrowserPluginObserver::OnMessageReceived(const IPC::Message& message) { |
| 32 return false; |
| 33 } |
| 34 |
| 35 bool BrowserPluginObserver::Send(IPC::Message* message) { |
| 36 if (browser_plugin_) |
| 37 return browser_plugin_->Send(message); |
| 38 |
| 39 delete message; |
| 40 return false; |
| 41 } |
| 42 |
| 43 BrowserPlugin* BrowserPluginObserver::browser_plugin() const { |
| 44 return browser_plugin_; |
| 45 } |
| 46 |
| 47 void BrowserPluginObserver::BrowserPluginGone() { |
| 48 browser_plugin_ = NULL; |
| 49 } |
| 50 |
| 51 } // namespace content |
OLD | NEW |