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

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: Updated message names Created 8 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 side-by-side diff with in-line comments
Download patch
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..35351e97856b8ea35ce825ac340e69ce0e8eca7f
--- /dev/null
+++ b/content/browser/browser_plugin/browser_plugin_web_contents_observer.h
@@ -0,0 +1,97 @@
+// 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"
+
+namespace content {
+
+class BrowserPluginWebContentsObserver: public WebContentsObserver,
+ public NotificationObserver {
+ public:
+ typedef std::set<WebContents*> GuestSet;
jam 2012/04/04 00:54:45 nit: don't see this used anywhere
Fady Samuel 2012/04/04 16:45:40 Moved to BrowserPluginWebContentsObserver::DidComm
+ typedef std::map<WebContents*, int64> GuestMap;
jam 2012/04/04 00:54:45 nit: this is only used in the private section, so
Fady Samuel 2012/04/04 16:45:40 Done.
+
+ virtual ~BrowserPluginWebContentsObserver();
+
+ static BrowserPluginWebContentsObserver* Get(
+ WebContents* web_contents);
jam 2012/04/04 00:54:45 for this file, please use TabContents (the concret
Fady Samuel 2012/04/04 16:45:40 Done.
+
+ // 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(WebContents* guest, int64 frame_id);
+
+ void RemoveGuest(WebContents* guest);
+
+ WebContents* host() const { return host_; }
+
+ void set_host(WebContents* 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:
+ BrowserPluginWebContentsObserver(
jam 2012/04/04 00:54:45 nit: this can fit on one line
Fady Samuel 2012/04/04 16:45:40 Done.
+ WebContents* web_contents);
+
+ void OnOpenChannelToBrowserPlugin(int32 instance_id,
+ long long frame_id,
+ const std::string& src,
+ const gfx::Size& size);
+
+ void OnMsgGuestReady();
+
+ void OnMsgResizeGuest(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_;
+
+ WebContents* host_;
+
+ // An identifier that uniquely identifies a browser plugin container
+ // within a house.
+ int instance_id_;
+
+ GuestMap guests_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_WEB_CONTENTS_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698