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

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

Issue 10965009: BrowserPluginGuest/Embedder: Remove friend helper classes, made necessary calls public (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A BrowserPluginEmbedder has a list of guests it manages. 5 // A BrowserPluginEmbedder has a list of guests it manages.
6 // In the beginning when a renderer sees one or more guests (BrowserPlugin 6 // In the beginning when a renderer sees one or more guests (BrowserPlugin
7 // instance(s)) and there is a request to navigate to them, the WebContents for 7 // instance(s)) and there is a request to navigate to them, the WebContents for
8 // that renderer creates a BrowserPluginEmbedder for itself. The 8 // that renderer creates a BrowserPluginEmbedder for itself. The
9 // BrowserPluginEmbedder, in turn, manages a set of BrowserPluginGuests -- one 9 // BrowserPluginEmbedder, in turn, manages a set of BrowserPluginGuests -- one
10 // BrowserPluginGuest for each guest in the embedding WebContents. Note that 10 // BrowserPluginGuest for each guest in the embedding WebContents. Note that
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 // WebContentsObserver implementation. 71 // WebContentsObserver implementation.
72 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; 72 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
73 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; 73 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
74 74
75 // NotificationObserver method override. 75 // NotificationObserver method override.
76 virtual void Observe(int type, 76 virtual void Observe(int type,
77 const NotificationSource& source, 77 const NotificationSource& source,
78 const NotificationDetails& details) OVERRIDE; 78 const NotificationDetails& details) OVERRIDE;
79 79
80 // Overrides factory for testing. Default (NULL) value indicates regular
81 // (non-test) environment.
82 static void set_factory_for_testing(BrowserPluginHostFactory* factory) {
83 factory_ = factory;
84 }
85
86 private:
87 friend class BrowserPluginEmbedderHelper;
88 friend class TestBrowserPluginEmbedder;
89
90 BrowserPluginEmbedder(WebContentsImpl* web_contents,
91 RenderViewHost* render_view_host);
92
93 // Returns a guest browser plugin delegate by its container ID specified
94 // in BrowserPlugin.
95 BrowserPluginGuest* GetGuestByInstanceID(int instance_id) const;
96 // Adds a new guest web_contents to the embedder (overridable in test).
97 virtual void AddGuest(int instance_id,
98 WebContents* guest_web_contents,
99 int64 frame_id);
100 void DestroyGuestByInstanceID(int instance_id);
101 void DestroyGuests();
102
103 // Message handlers (direct/indirect via BrowserPluginEmbedderHelper). 80 // Message handlers (direct/indirect via BrowserPluginEmbedderHelper).
104 // Routes update rect ack message to the appropriate guest. 81 // Routes update rect ack message to the appropriate guest.
105 void UpdateRectACK(int instance_id, int message_id, const gfx::Size& size); 82 void UpdateRectACK(int instance_id, int message_id, const gfx::Size& size);
106 void SetFocus(int instance_id, bool focused); 83 void SetFocus(int instance_id, bool focused);
107 void ResizeGuest(int instance_id, 84 void ResizeGuest(int instance_id,
108 TransportDIB* damage_buffer, 85 TransportDIB* damage_buffer,
109 #if defined(OS_WIN) 86 #if defined(OS_WIN)
110 int damage_buffer_size, 87 int damage_buffer_size,
111 #endif 88 #endif
112 int width, 89 int width,
113 int height, 90 int height,
114 bool resize_pending, 91 bool resize_pending,
115 float scale_factor); 92 float scale_factor);
116 // Handles input events sent from the BrowserPlugin (embedder's renderer 93 // Handles input events sent from the BrowserPlugin (embedder's renderer
117 // process) by passing them to appropriate guest's input handler. 94 // process) by passing them to appropriate guest's input handler.
118 void HandleInputEvent(int instance_id, 95 void HandleInputEvent(int instance_id,
119 RenderViewHost* render_view_host, 96 RenderViewHost* render_view_host,
120 const gfx::Rect& guest_rect, 97 const gfx::Rect& guest_rect,
121 const WebKit::WebInputEvent& event, 98 const WebKit::WebInputEvent& event,
122 IPC::Message* reply_message); 99 IPC::Message* reply_message);
123 void PluginDestroyed(int instance_id); 100 void PluginDestroyed(int instance_id);
124 101
102 // Overrides factory for testing. Default (NULL) value indicates regular
103 // (non-test) environment.
104 static void set_factory_for_testing(BrowserPluginHostFactory* factory) {
105 factory_ = factory;
106 }
107
108 private:
109 friend class TestBrowserPluginEmbedder;
110
111 BrowserPluginEmbedder(WebContentsImpl* web_contents,
112 RenderViewHost* render_view_host);
113
114 // Returns a guest browser plugin delegate by its container ID specified
115 // in BrowserPlugin.
116 BrowserPluginGuest* GetGuestByInstanceID(int instance_id) const;
117 // Adds a new guest web_contents to the embedder (overridable in test).
118 virtual void AddGuest(int instance_id,
119 WebContents* guest_web_contents,
120 int64 frame_id);
121 void DestroyGuestByInstanceID(int instance_id);
122 void DestroyGuests();
123
125 // Called when visiblity of web_contents changes, so the embedder will 124 // Called when visiblity of web_contents changes, so the embedder will
126 // show/hide its guest. 125 // show/hide its guest.
127 void WebContentsVisibilityChanged(bool visible); 126 void WebContentsVisibilityChanged(bool visible);
128 127
129 // Static factory instance (always NULL for non-test). 128 // Static factory instance (always NULL for non-test).
130 static BrowserPluginHostFactory* factory_; 129 static BrowserPluginHostFactory* factory_;
131 130
132 // A scoped container for notification registries. 131 // A scoped container for notification registries.
133 NotificationRegistrar registrar_; 132 NotificationRegistrar registrar_;
134 133
135 // Contains guests' WebContents, mapping from their instance ids. 134 // Contains guests' WebContents, mapping from their instance ids.
136 ContainerInstanceMap guest_web_contents_by_instance_id_; 135 ContainerInstanceMap guest_web_contents_by_instance_id_;
137 RenderViewHost* render_view_host_; 136 RenderViewHost* render_view_host_;
138 137
139 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); 138 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder);
140 }; 139 };
141 140
142 } // namespace content 141 } // namespace content
143 142
144 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ 143 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698