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

Side by Side Diff: content/public/renderer/browser_plugin/browser_plugin_observer.cc

Issue 11826005: Browser Plugin: Implement BrowserPluginObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with ToT Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698