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

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: Clean up bindings API 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 instance_id_(0) {
16 CHECK(browser_plugin);
17 BrowserPluginImpl* impl = static_cast<BrowserPluginImpl*>(browser_plugin);
18 instance_id_ = impl->instance_id();
19 impl->AddObserver(this);
20 }
21
22 BrowserPluginObserver::~BrowserPluginObserver() {
23 if (browser_plugin_) {
24 BrowserPluginImpl* impl = static_cast<BrowserPluginImpl*>(browser_plugin_);
25 impl->RemoveObserver(this);
26 }
27 }
28
29 void BrowserPluginObserver::OnDestruct() {
30 delete this;
31 }
32
33 bool BrowserPluginObserver::OnMessageReceived(const IPC::Message& message) {
34 return false;
35 }
36
37 bool BrowserPluginObserver::Send(IPC::Message* message) {
38 if (browser_plugin_)
39 return browser_plugin_->Send(message);
40
41 delete message;
42 return false;
43 }
44
45 BrowserPlugin* BrowserPluginObserver::browser_plugin() const {
46 return browser_plugin_;
47 }
48
49 void BrowserPluginObserver::BrowserPluginGone() {
50 browser_plugin_ = NULL;
51 }
52
53 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698