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

Unified Diff: content/browser/browser_plugin/browser_plugin_web_contents_observer.h

Issue 9924026: Browser side implementation of browser plugin (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed an extra semicolon. Created 8 years, 8 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
« no previous file with comments | « no previous file | content/browser/browser_plugin/browser_plugin_web_contents_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_plugin/browser_plugin_web_contents_observer.h
diff --git a/content/browser/browser_plugin/browser_plugin_web_contents_observer.h b/content/browser/browser_plugin/browser_plugin_web_contents_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc7722f1c96da7fc3b0e88069907363b957586bf
--- /dev/null
+++ b/content/browser/browser_plugin/browser_plugin_web_contents_observer.h
@@ -0,0 +1,94 @@
+// 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.
+
+#ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_WEB_CONTENTS_OBSERVER_H__
+#define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_WEB_CONTENTS_OBSERVER_H__
+#pragma once
+
+#include <map>
+
+#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "ui/gfx/size.h"
+
+class TabContents;
+
+namespace content {
+
+class BrowserPluginWebContentsObserver: public WebContentsObserver,
+ public NotificationObserver {
+ public:
+ BrowserPluginWebContentsObserver(TabContents* web_contents);
+
+ virtual ~BrowserPluginWebContentsObserver();
+
+ // A Host BrowserPluginWebContentsObserver keeps track of
+ // its guests so that if it navigates away, its associated RenderView
+ // crashes or it is hidden, it takes appropriate action on the guest.
+ void AddGuest(TabContents* guest, int64 frame_id);
+
+ void RemoveGuest(TabContents* guest);
+
+ TabContents* host() const { return host_; }
+
+ void set_host(TabContents* host) { host_ = host; }
+
+ int instance_id() const { return instance_id_; }
+
+ void set_instance_id(int instance_id) { instance_id_ = instance_id; }
+
+ // WebContentObserver implementation.
+
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+
+ virtual void DidCommitProvisionalLoadForFrame(
+ int64 frame_id,
+ bool is_main_frame,
+ const GURL& url,
+ PageTransition transition_type) OVERRIDE;
+
+ virtual void RenderViewDeleted(
+ RenderViewHost* render_view_host) OVERRIDE;
+
+ virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
+
+ virtual void WebContentsDestroyed(WebContents* tab) OVERRIDE;
+
+ private:
+ typedef std::map<TabContents*, int64> GuestMap;
+
+ void OnOpenChannelToBrowserPlugin(int32 instance_id,
+ long long frame_id,
+ const std::string& src,
+ const gfx::Size& size);
+
+ void OnGuestReady();
+
+ void OnResizeGuest(int width, int height);
+
+ void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle);
+
+ void DestroyGuests();
+
+ // NotificationObserver method override.
+ virtual void Observe(int type,
+ const NotificationSource& source,
+ const NotificationDetails& details) OVERRIDE;
+
+ // A scoped container for notification registries.
+ NotificationRegistrar registrar_;
+
+ TabContents* host_;
+
+ // An identifier that uniquely identifies a browser plugin container
+ // within a host.
+ int instance_id_;
+
+ GuestMap guests_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_WEB_CONTENTS_OBSERVER_H_
« no previous file with comments | « no previous file | content/browser/browser_plugin/browser_plugin_web_contents_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698