15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// A BrowserPluginGuest is the browser side of a browser <--> embedder 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// renderer side of browser <--> embedder renderer communication. 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 91e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// BrowserPluginGuest lives on the UI thread of the browser process. Any 101e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// messages about the guest render process that the embedder might be interested 111e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// in receiving should be listened for here. 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 13cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// BrowserPluginGuest is a WebContentsObserver for the guest WebContents. 14cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// BrowserPluginGuest operates under the assumption that the guest will be 15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// accessible through only one RenderViewHost for the lifetime of 162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// the guest WebContents. Thus, cross-process navigation is not supported. 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <map> 22b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include <queue> 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/compiler_specific.h" 25f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)#include "base/memory/linked_ptr.h" 262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/memory/weak_ptr.h" 27eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "base/values.h" 28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "content/common/edit_command.h" 29010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#include "content/common/input/input_event_ack_state.h" 307dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "content/public/browser/browser_plugin_guest_delegate.h" 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/web_contents_observer.h" 325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "third_party/WebKit/public/web/WebCompositionUnderline.h" 337d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "third_party/WebKit/public/web/WebDragOperation.h" 347d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "third_party/WebKit/public/web/WebDragStatus.h" 357d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "third_party/WebKit/public/web/WebInputEvent.h" 365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ui/base/ime/text_input_mode.h" 375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ui/base/ime/text_input_type.h" 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/rect.h" 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 40cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class SkBitmap; 41c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)struct BrowserPluginHostMsg_Attach_Params; 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct BrowserPluginHostMsg_ResizeGuest_Params; 435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)struct FrameHostMsg_CompositorFrameSwappedACK_Params; 445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)struct FrameHostMsg_ReclaimCompositorResources_Params; 452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#if defined(OS_MACOSX) 461320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccistruct FrameHostMsg_ShowPopup_Params; 472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 49f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace blink { 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class WebInputEvent; 511320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci} // namespace blink 521320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 531320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccinamespace cc { 541320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass CompositorFrame; 551320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci} // namespace cc 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace gfx { 585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class Range; 591320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci} // namespace gfx 605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content { 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 63010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)class BrowserPluginGuestManager; 64cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class RenderViewHostImpl; 651320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass RenderWidgetHost; 662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class RenderWidgetHostView; 670f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)class SiteInstance; 68eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochstruct DropData; 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// A browser plugin guest provides functionality for WebContents to operate in 712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// the guest role and implements guest-specific overrides for ViewHostMsg_* 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// messages. 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// When a guest is initially created, it is in an unattached state. That is, 752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// it is not visible anywhere and has no embedder WebContents assigned. 762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// A BrowserPluginGuest is said to be "attached" if it has an embedder. 772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// A BrowserPluginGuest can also create a new unattached guest via 782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// CreateNewWindow. The newly created guest will live in the same partition, 792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// which means it can share storage and can script this guest. 80cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class CONTENT_EXPORT BrowserPluginGuest : public WebContentsObserver { 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ~BrowserPluginGuest(); 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 840f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // The WebContents passed into the factory method here has not been 850f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // initialized yet and so it does not yet hold a SiteInstance. 860f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // BrowserPluginGuest must be constructed and installed into a WebContents 870f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // prior to its initialization because WebContents needs to determine what 880f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // type of WebContentsView to construct on initialization. The content 890f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // embedder needs to be aware of |guest_site_instance| on the guest's 900f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // construction and so we pass it in here. 9103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) static BrowserPluginGuest* Create(WebContentsImpl* web_contents, 9203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) BrowserPluginGuestDelegate* delegate); 93c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 94cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Returns whether the given WebContents is a BrowserPlugin guest. 95cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) static bool IsGuest(WebContentsImpl* web_contents); 96cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 97cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Returns whether the given RenderviewHost is a BrowserPlugin guest. 98cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) static bool IsGuest(RenderViewHostImpl* render_view_host); 99cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 1005d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Returns a WeakPtr to this BrowserPluginGuest. 1015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::WeakPtr<BrowserPluginGuest> AsWeakPtr(); 1025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1031320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // Sets the focus state of the current RenderWidgetHostView. 1041320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci void SetFocus(RenderWidgetHost* rwh, bool focused); 1051320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 106cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Sets the lock state of the pointer. Returns true if |allowed| is true and 107cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // the mouse has been successfully locked. 108cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) bool LockMouse(bool allowed); 109d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 11003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) // Return true if the mouse is locked. 11103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) bool mouse_locked() const { return mouse_locked_; } 11203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 1134e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // Called when the embedder WebContents changes visibility. 1144e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) void EmbedderVisibilityChanged(bool visible); 1154e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Destroys the guest WebContents and all its associated state, including 1172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // this BrowserPluginGuest, and its new unattached windows. 1182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void Destroy(); 1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 120116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // Creates a new guest WebContentsImpl with the provided |params| with |this| 121116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // as the |opener|. 122116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch WebContentsImpl* CreateNewGuestWindow( 123116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch const WebContents::CreateParams& params); 124116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 1252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Returns the identifier that uniquely identifies a browser plugin guest 1262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // within an embedder. 12703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) int browser_plugin_instance_id() const { return browser_plugin_instance_id_; } 1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool OnMessageReceivedFromEmbedder(const IPC::Message& message); 1302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) WebContentsImpl* embedder_web_contents() const { 1322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return embedder_web_contents_; 1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Returns the embedder's RenderWidgetHostView if it is available. 1365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Returns NULL otherwise. 1372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); 1382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool focused() const { return focused_; } 1402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool visible() const { return guest_visible_; } 1413551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) bool is_in_destruction() { return is_in_destruction_; } 1422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void UpdateVisibility(); 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 145a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) void CopyFromCompositingSurface( 146a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) gfx::Rect src_subrect, 147a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) gfx::Size dst_size, 148a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const base::Callback<void(bool, const SkBitmap&)>& callback); 149a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 150010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; 151010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) 1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // WebContentsObserver implementation. 1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void DidCommitProvisionalLoadForFrame( 154116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch RenderFrameHost* render_frame_host, 1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const GURL& url, 1561320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci ui::PageTransition transition_type) OVERRIDE; 1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void RenderViewReady() OVERRIDE; 1597dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; 1602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 1611320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci virtual bool OnMessageReceived(const IPC::Message& message, 1621320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci RenderFrameHost* render_frame_host) OVERRIDE; 1632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Exposes the protected web_contents() from WebContentsObserver. 165010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) WebContentsImpl* GetWebContents() const; 1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const; 1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Helper to send messages to embedder. This methods fills the message with 1702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // the correct routing id. 17146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) void SendMessageToEmbedder(IPC::Message* msg); 1722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Returns whether the guest is attached to an embedder. 174f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) bool attached() const { return embedder_web_contents_ != NULL; } 1752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Attaches this BrowserPluginGuest to the provided |embedder_web_contents| 1772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // and initializes the guest with the provided |params|. Attaching a guest 1782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // to an embedder implies that this guest's lifetime is no longer managed 17903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) // by its opener, and it can begin loading resources. 18003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) void Attach(int browser_plugin_instance_id, 18103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) WebContentsImpl* embedder_web_contents, 18203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) const BrowserPluginHostMsg_Attach_Params& params); 1832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Returns whether BrowserPluginGuest is interested in receiving the given 1852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // |message|. 1862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static bool ShouldForwardToBrowserPluginGuest(const IPC::Message& message); 1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 188c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) void DragSourceEndedAt(int client_x, int client_y, int screen_x, 189f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) int screen_y, blink::WebDragOperation operation); 190c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 191c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Called when the drag started by this guest ends at an OS-level. 192c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) void EndSystemDrag(); 1932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 194c2db58bd994c04d98e4ee2cd7565b71548655fe3Ben Murdoch void RespondToPermissionRequest(int request_id, 195c2db58bd994c04d98e4ee2cd7565b71548655fe3Ben Murdoch bool should_allow, 196c2db58bd994c04d98e4ee2cd7565b71548655fe3Ben Murdoch const std::string& user_input); 197c2db58bd994c04d98e4ee2cd7565b71548655fe3Ben Murdoch 1980529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch void PointerLockPermissionResponse(bool allow); 1990529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch 2001320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci void SwapCompositorFrame(uint32 output_surface_id, 2011320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci int host_process_id, 2021320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci int host_routing_id, 2031320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci scoped_ptr<cc::CompositorFrame> frame); 2041320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 2051320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci void SetContentsOpaque(bool opaque); 2061320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 207c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) private: 2084e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) class EmbedderWebContentsObserver; 2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 210f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // BrowserPluginGuest is a WebContentsObserver of |web_contents| and 211f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest. 21203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) BrowserPluginGuest(bool has_render_view, 213116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch WebContentsImpl* web_contents, 214116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch BrowserPluginGuestDelegate* delegate); 2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 216cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void WillDestroy(); 217d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 21803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) void Initialize(int browser_plugin_instance_id, 21903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) const BrowserPluginHostMsg_Attach_Params& params, 22003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) WebContentsImpl* embedder_web_contents); 221f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool InAutoSizeBounds(const gfx::Size& size) const; 2232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Message handlers for messages from embedder. 2252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void OnCompositorFrameSwappedACK( 2275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int instance_id, 2285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const FrameHostMsg_CompositorFrameSwappedACK_Params& params); 229a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) void OnCopyFromCompositingSurfaceAck(int instance_id, 230a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) int request_id, 231a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const SkBitmap& bitmap); 2322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Handles drag events from the embedder. 2332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // When dragging, the drag events go to the embedder first, and if the drag 2342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // happens on the browser plugin, then the plugin sends a corresponding 2352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // drag-message to the guest. This routes the drag-message to the guest 2362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // renderer. 2372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnDragStatusUpdate(int instance_id, 238f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) blink::WebDragStatus drag_status, 239eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const DropData& drop_data, 240f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) blink::WebDragOperationsMask drag_mask, 2412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const gfx::Point& location); 242c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Instructs the guest to execute an edit command decoded in the embedder. 243c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) void OnExecuteEditCommand(int instance_id, 244c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const std::string& command); 245f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 246f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Returns compositor resources reclaimed in the embedder to the guest. 2475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void OnReclaimCompositorResources( 2485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int instance_id, 2495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const FrameHostMsg_ReclaimCompositorResources_Params& params); 250f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 2512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnLockMouse(bool user_gesture, 2522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool last_unlocked_by_target, 2532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool privileged); 2542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnLockMouseAck(int instance_id, bool succeeded); 2552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnPluginDestroyed(int instance_id); 2565c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu // Resizes the guest's web contents. 257cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void OnResizeGuest( 2585c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu int instance_id, const BrowserPluginHostMsg_ResizeGuest_Params& params); 259cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void OnSetFocus(int instance_id, bool focused); 2602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Sets the name of the guest so that other guests in the same partition can 2612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // access it. 2622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnSetName(int instance_id, const std::string& name); 2632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Updates the size state of the guest. 264868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) void OnSetEditCommandsForNextKeyEvent( 265868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int instance_id, 266868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const std::vector<EditCommand>& edit_commands); 2672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The guest WebContents is visible if both its embedder is visible and 2682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // the browser plugin element is visible. If either one is not then the 2692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // WebContents is marked as hidden. A hidden WebContents will consume 2702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // fewer GPU and CPU resources. 2712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 2722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // When every WebContents in a RenderProcessHost is hidden, it will lower 2732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // the priority of the process (see RenderProcessHostImpl::WidgetHidden). 2742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 2752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // It will also send a message to the guest renderer process to cleanup 2762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // resources such as dropping back buffers and adjusting memory limits (if in 2772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // compositing mode, see CCLayerTreeHost::setVisible). 2782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 2792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Additionally, it will slow down Javascript execution and garbage 2802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // collection. See RenderThreadImpl::IdleHandler (executed when hidden) and 2812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // RenderThreadImpl::IdleHandlerInForegroundTab (executed when visible). 2822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnSetVisibility(int instance_id, bool visible); 2832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnUnlockMouse(); 2842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnUnlockMouseAck(int instance_id); 28590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) void OnUpdateGeometry(int instance_id, const gfx::Rect& view_rect); 2862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2871675a649fd7a8b3cb80ffddae2dc181f122353c5Ben Murdoch void OnTextInputTypeChanged(ui::TextInputType type, 2881675a649fd7a8b3cb80ffddae2dc181f122353c5Ben Murdoch ui::TextInputMode input_mode, 2891675a649fd7a8b3cb80ffddae2dc181f122353c5Ben Murdoch bool can_compose_inline); 2905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void OnImeSetComposition( 2915d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int instance_id, 2925d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const std::string& text, 2935d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const std::vector<blink::WebCompositionUnderline>& underlines, 2945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int selection_start, 2955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int selection_end); 2965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void OnImeConfirmComposition( 2975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int instance_id, 2985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const std::string& text, 2995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool keep_selection); 3005d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void OnExtendSelectionAndDelete(int instance_id, int before, int after); 30146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) void OnImeCancelComposition(); 302a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#if defined(OS_MACOSX) || defined(USE_AURA) 3035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void OnImeCompositionRangeChanged( 3045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const gfx::Range& range, 3055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const std::vector<gfx::Rect>& character_bounds); 3065d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif 3072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Message handlers for messages from guest. 3092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnHandleInputEventAck( 310f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) blink::WebInputEvent::Type event_type, 3112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) InputEventAckState ack_result); 3122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnHasTouchEventHandlers(bool accept); 3132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#if defined(OS_MACOSX) 3141320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // On MacOS X popups are painted by the browser process. We handle them here 3151320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // so that they are positioned correctly. 3161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci void OnShowPopup(RenderFrameHost* render_frame_host, 3171320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const FrameHostMsg_ShowPopup_Params& params); 3182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif 3192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnShowWidget(int route_id, const gfx::Rect& initial_pos); 320cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void OnTakeFocus(bool reverse); 3212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnUpdateFrameName(int frame_id, 3222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool is_top_level, 3232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string& name); 3242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 325b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // Forwards all messages from the |pending_messages_| queue to the embedder. 326b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) void SendQueuedMessages(); 327b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 3284e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; 3295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) WebContentsImpl* embedder_web_contents_; 330c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 33103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) // An identifier that uniquely identifies a browser plugin within an embedder. 33203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) int browser_plugin_instance_id_; 333c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) float guest_device_scale_factor_; 3342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) gfx::Rect guest_window_rect_; 3355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool focused_; 3362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool mouse_locked_; 3372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool pending_lock_request_; 3382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool guest_visible_; 3392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool embedder_visible_; 3405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 341a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // Each copy-request is identified by a unique number. The unique number is 342a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // used to keep track of the right callback. 343a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) int copy_request_id_; 344a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) typedef base::Callback<void(bool, const SkBitmap&)> CopyRequestCallback; 345a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) typedef std::map<int, const CopyRequestCallback> CopyRequestMap; 346a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) CopyRequestMap copy_request_callbacks_; 347a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 348c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Indicates that this BrowserPluginGuest has associated renderer-side state. 349c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // This is used to determine whether or not to create a new RenderView when 3506d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) // this guest is attached. A BrowserPluginGuest would have renderer-side state 3516d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) // prior to attachment if it is created via a call to window.open and 3526d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) // maintains a JavaScript reference to its opener. 353c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) bool has_render_view_; 3542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3551320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // Last seen size of guest contents (by SwapCompositorFrame). 3563551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) gfx::Size last_seen_view_size_; 3575f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) // Last seen size of BrowserPlugin (by OnResizeGuest). 3585f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) gfx::Size last_seen_browser_plugin_size_; 3593551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 3603551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) bool is_in_destruction_; 3613551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 3625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Text input type states. 3635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ui::TextInputType last_text_input_type_; 3645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ui::TextInputMode last_input_mode_; 3655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool last_can_compose_inline_; 3665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 367b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // This is a queue of messages that are destined to be sent to the embedder 368b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // once the guest is attached to a particular embedder. 369f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) std::deque<linked_ptr<IPC::Message> > pending_messages_; 370b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 371116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch BrowserPluginGuestDelegate* const delegate_; 372d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 3735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Weak pointer used to ask GeolocationPermissionContext about geolocation 3745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // permission. 3755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; 3765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 3775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); 3785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 3795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace content 3815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 383