| Index: content/browser/browser_plugin/browser_plugin_host.h
|
| diff --git a/content/browser/browser_plugin/browser_plugin_web_contents_observer.h b/content/browser/browser_plugin/browser_plugin_host.h
|
| similarity index 51%
|
| rename from content/browser/browser_plugin/browser_plugin_web_contents_observer.h
|
| rename to content/browser/browser_plugin/browser_plugin_host.h
|
| index 99df72b88779c56e3508633ec60446a2258eafa3..c864059169bf464037e2067bc42230abb6706662 100644
|
| --- a/content/browser/browser_plugin/browser_plugin_web_contents_observer.h
|
| +++ b/content/browser/browser_plugin/browser_plugin_host.h
|
| @@ -2,43 +2,60 @@
|
| // 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__
|
| +#ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_H__
|
| +#define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_H__
|
| #pragma once
|
|
|
| #include <map>
|
| +#include <set>
|
|
|
| #include "content/public/browser/notification_registrar.h"
|
| #include "content/public/browser/notification_observer.h"
|
| #include "content/public/browser/web_contents_observer.h"
|
| +#include "googleurl/src/gurl.h"
|
| +#include "ppapi/c/pp_instance.h"
|
| #include "ui/gfx/size.h"
|
|
|
| class WebContentsImpl;
|
|
|
| namespace content {
|
|
|
| -class BrowserPluginWebContentsObserver: public WebContentsObserver,
|
| - public NotificationObserver {
|
| +class BrowserPluginHost: public WebContentsObserver,
|
| + public NotificationObserver {
|
| public:
|
| - BrowserPluginWebContentsObserver(WebContentsImpl* web_contents);
|
| + BrowserPluginHost(WebContentsImpl* web_contents);
|
|
|
| - virtual ~BrowserPluginWebContentsObserver();
|
| + virtual ~BrowserPluginHost();
|
|
|
| - // A Host BrowserPluginWebContentsObserver keeps track of
|
| + BrowserPluginHost* GetGuestByContainerID(int container_id);
|
| +
|
| + void RegisterContainerInstance(
|
| + int container_id,
|
| + BrowserPluginHost* observer);
|
| +
|
| + // An embedder BrowserPluginHost 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(WebContentsImpl* guest, int64 frame_id);
|
|
|
| void RemoveGuest(WebContentsImpl* guest);
|
|
|
| - WebContentsImpl* host() const { return host_; }
|
| + WebContentsImpl* embedder() const { return embedder_; }
|
|
|
| - void set_host(WebContentsImpl* host) { host_ = host; }
|
| + void set_embedder(WebContentsImpl* embedder) { embedder_ = embedder; }
|
|
|
| int instance_id() const { return instance_id_; }
|
|
|
| void set_instance_id(int instance_id) { instance_id_ = instance_id; }
|
|
|
| + void set_url(const GURL& url) { url_ = url; }
|
| +
|
| + const GURL& url() const { return url_; }
|
| +
|
| + void set_initial_size(const gfx::Size& size) { initial_size_ = size; }
|
| +
|
| + const gfx::Size& initial_size() const { return initial_size_; }
|
| +
|
| // WebContentObserver implementation.
|
|
|
| virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
| @@ -49,8 +66,7 @@ class BrowserPluginWebContentsObserver: public WebContentsObserver,
|
| const GURL& url,
|
| PageTransition transition_type) OVERRIDE;
|
|
|
| - virtual void RenderViewDeleted(
|
| - RenderViewHost* render_view_host) OVERRIDE;
|
| + virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
|
|
|
| virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
|
|
|
| @@ -58,17 +74,21 @@ class BrowserPluginWebContentsObserver: public WebContentsObserver,
|
|
|
| private:
|
| typedef std::map<WebContentsImpl*, int64> GuestMap;
|
| + typedef std::map<int, BrowserPluginHost*> ContainerInstanceMap;
|
| +
|
| + void OnNavigateFromEmbedder(int32 instance_id,
|
| + long long frame_id,
|
| + const std::string& src,
|
| + const gfx::Size& size);
|
|
|
| - void OnOpenChannelToBrowserPlugin(int32 instance_id,
|
| - long long frame_id,
|
| - const std::string& src,
|
| - const gfx::Size& size);
|
| + void OnNavigateFromGuest(PP_Instance instance,
|
| + const std::string& src);
|
|
|
| - void OnGuestReady();
|
| + void OnMapInstance(int routing_id, PP_Instance instance);
|
|
|
| void OnResizeGuest(int width, int height);
|
|
|
| - void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle);
|
| + void OnConnectToChannel(const IPC::ChannelHandle& handle);
|
|
|
| void DestroyGuests();
|
|
|
| @@ -79,16 +99,16 @@ class BrowserPluginWebContentsObserver: public WebContentsObserver,
|
|
|
| // A scoped container for notification registries.
|
| NotificationRegistrar registrar_;
|
| -
|
| - WebContentsImpl* host_;
|
| -
|
| + WebContentsImpl* embedder_;
|
| // An identifier that uniquely identifies a browser plugin container
|
| - // within a host.
|
| + // within an embedder.
|
| int instance_id_;
|
| -
|
| + GURL url_;
|
| + gfx::Size initial_size_;
|
| GuestMap guests_;
|
| + ContainerInstanceMap guests_by_container_id_;
|
| };
|
|
|
| } // namespace content
|
|
|
| -#endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_WEB_CONTENTS_OBSERVER_H_
|
| +#endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_H_
|
|
|