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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_host_embedder_delegate.h

Issue 10868012: Browser Plugin: New Implementation (Browser Side) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master-trial-obrowser
Patch Set: Address two nits from original CL's comments by creis Created 8 years, 3 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
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 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_EMBEDDER_DELEGATE_H_
6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_EMBEDDER_DELEGATE_H_
7
8 #include <string>
9
10 #include "base/compiler_specific.h"
11 #include "content/public/browser/render_view_host_observer.h"
12 #include "content/public/browser/web_contents_delegate.h"
13 #include "content/public/browser/web_contents_observer.h"
14 #include "ipc/ipc_channel_handle.h"
15 #include "ipc/ipc_sync_message.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
17 #include "ui/surface/transport_dib.h"
18 #include "webkit/glue/webcursor.h"
19
20 namespace gfx {
21 class Size;
22 }
23
24 struct BrowserPluginHostMsg_ResizeGuest_Params;
25 struct ViewHostMsg_UpdateRect_Params;
26
27 namespace content {
28
29 class BrowserPluginHostGuestDelegate;
30
31 typedef std::map<WebContents*, int64> GuestMap;
32 typedef std::map<int, BrowserPluginHostGuestDelegate*> ContainerInstanceMap;
33
34 // Delegate for browser plugin embedder. Provides functionality for WebContents
35 // to operate in the 'embedder' role, manages list of guests inside the
36 // embedder.
37 class BrowserPluginHostEmbedderDelegate : public WebContentsObserver {
38 public:
39 BrowserPluginHostEmbedderDelegate(WebContentsImpl* web_contents);
40 virtual ~BrowserPluginHostEmbedderDelegate();
41
42 const ContainerInstanceMap& guests_for_testing() const {
43 return guests_by_instance_id_;
44 }
45
46 private:
47 friend class BrowserPluginHostEmbedderRole;
48
49 // Returns a guest browser plugin delegate by its container ID specified
50 // in BrowserPlugin.
51 BrowserPluginHostGuestDelegate* GetGuestByInstanceID(int instance_id) const;
52 // Adds a new guest to the embedder.
53 void AddGuest(int instance_id,
54 BrowserPluginHostGuestDelegate* guest,
55 int64 frame_id);
56 void DestroyGuestByInstanceID(int instance_id);
57 void DestroyGuests();
58
59 // Message handlers (direct/indirect via BrowserPluginHostEmbedderRole).
60 // Navigates to a guest (new or existing).
61 void NavigateGuest(RenderViewHost* render_view_host,
62 int instance_id,
63 int64 frame_id,
64 const std::string& src,
65 const gfx::Size& size);
66 // Routes update rect ack message to the appropriate guest.
67 void UpdateRectACK(int instance_id, int message_id, const gfx::Size& size);
68 void SetFocus(int instance_id, bool focused);
69 void ResizeGuest(int instance_id,
70 TransportDIB* damage_buffer,
71 int width,
72 int height,
73 bool resize_pending,
74 float scale_factor);
75 // Called when visiblity of web_contents changes, the embedder would show/hide
76 // its guest.
77 void WebContentsVisiblitlyChanged(bool visible);
78 // Handles input event sent from the BrowserPlugin (renderer) by passing it to
79 // appropriate guest's input handler.
80 void HandleInputEvent(int instance_id,
81 RenderViewHost* render_view_host,
82 const gfx::Rect& guest_rect,
83 const WebKit::WebInputEvent& event,
84 IPC::Message* reply_message);
85 void PluginDestroyed(int instance_id);
86
87 // WebContentsObserver implementation.
88 // Used to monitor frame navigation to cleanup guests when a frame navigates
89 // away from the browser plugin it's hosting.
90 virtual void DidCommitProvisionalLoadForFrame(
91 int64 frame_id,
92 bool is_main_frame,
93 const GURL& url,
94 PageTransition transition_type,
95 RenderViewHost* render_view_host) OVERRIDE;
96 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
97 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
98
99 GuestMap guests_;
100 ContainerInstanceMap guests_by_instance_id_;
101
102 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostEmbedderDelegate);
103 };
104
105 } // namespace content
106
107 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_EMBEDDER_DELEGATE_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698