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

Side by Side Diff: extensions/browser/guest_view/guest_view_base.h

Issue 444813002: Remove BrowserPlugin's -internal-attach method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated comment Created 6 years, 4 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 content::WebContents* embedder_web_contents() const { 186 content::WebContents* embedder_web_contents() const {
187 return embedder_web_contents_; 187 return embedder_web_contents_;
188 } 188 }
189 189
190 // Returns the guest WebContents. 190 // Returns the guest WebContents.
191 content::WebContents* guest_web_contents() const { 191 content::WebContents* guest_web_contents() const {
192 return web_contents(); 192 return web_contents();
193 } 193 }
194 194
195 // Returns the extra parameters associated with this GuestView passed 195 // Returns the parameters associated with the element hosting this GuestView
196 // in from JavaScript. 196 // passed in from JavaScript.
197 base::DictionaryValue* extra_params() const { 197 base::DictionaryValue* attach_params() const { return attach_params_.get(); }
198 return extra_params_.get();
199 }
200 198
201 // Returns whether this guest has an associated embedder. 199 // Returns whether this guest has an associated embedder.
202 bool attached() const { return !!embedder_web_contents_; } 200 bool attached() const { return !!embedder_web_contents_; }
203 201
204 // Returns the instance ID of the <*view> element. 202 // Returns the instance ID of the <*view> element.
205 int view_instance_id() const { return view_instance_id_; } 203 int view_instance_id() const { return view_instance_id_; }
206 204
207 // Returns the extension ID of the embedder. 205 // Returns the extension ID of the embedder.
208 const std::string& embedder_extension_id() const { 206 const std::string& embedder_extension_id() const {
209 return embedder_extension_id_; 207 return embedder_extension_id_;
210 } 208 }
211 209
212 // Returns whether this GuestView is embedded in an extension/app. 210 // Returns whether this GuestView is embedded in an extension/app.
213 bool in_extension() const { return !embedder_extension_id_.empty(); } 211 bool in_extension() const { return !embedder_extension_id_.empty(); }
214 212
215 // Returns the user browser context of the embedder. 213 // Returns the user browser context of the embedder.
216 content::BrowserContext* browser_context() const { return browser_context_; } 214 content::BrowserContext* browser_context() const { return browser_context_; }
217 215
218 // Returns the embedder's process ID. 216 // Returns the embedder's process ID.
219 int embedder_render_process_id() const { return embedder_render_process_id_; } 217 int embedder_render_process_id() const { return embedder_render_process_id_; }
220 218
221 GuestViewBase* GetOpener() const { 219 GuestViewBase* GetOpener() const {
222 return opener_.get(); 220 return opener_.get();
223 } 221 }
224 222
223 // Sets some additional chrome/ initialization parameters.
224 void SetAttachParams(const base::DictionaryValue& params);
225 void SetOpener(GuestViewBase* opener); 225 void SetOpener(GuestViewBase* opener);
226 226
227 // RenderProcessHostObserver implementation 227 // RenderProcessHostObserver implementation
228 virtual void RenderProcessExited(content::RenderProcessHost* host, 228 virtual void RenderProcessExited(content::RenderProcessHost* host,
229 base::ProcessHandle handle, 229 base::ProcessHandle handle,
230 base::TerminationStatus status, 230 base::TerminationStatus status,
231 int exit_code) OVERRIDE; 231 int exit_code) OVERRIDE;
232 232
233 // BrowserPluginGuestDelegate implementation. 233 // BrowserPluginGuestDelegate implementation.
234 virtual void Destroy() OVERRIDE FINAL; 234 virtual void Destroy() OVERRIDE FINAL;
235 virtual void DidAttach() OVERRIDE FINAL; 235 virtual void DidAttach() OVERRIDE FINAL;
236 virtual void ElementSizeChanged(const gfx::Size& old_size, 236 virtual void ElementSizeChanged(const gfx::Size& old_size,
237 const gfx::Size& new_size) OVERRIDE FINAL; 237 const gfx::Size& new_size) OVERRIDE FINAL;
238 virtual int GetGuestInstanceID() const OVERRIDE; 238 virtual int GetGuestInstanceID() const OVERRIDE;
239 virtual void GuestSizeChanged(const gfx::Size& old_size, 239 virtual void GuestSizeChanged(const gfx::Size& old_size,
240 const gfx::Size& new_size) OVERRIDE FINAL; 240 const gfx::Size& new_size) OVERRIDE FINAL;
241 virtual void RegisterDestructionCallback( 241 virtual void RegisterDestructionCallback(
242 const DestructionCallback& callback) OVERRIDE FINAL; 242 const DestructionCallback& callback) OVERRIDE FINAL;
243 virtual void WillAttach( 243 virtual void WillAttach(
244 content::WebContents* embedder_web_contents, 244 content::WebContents* embedder_web_contents) OVERRIDE FINAL;
245 const base::DictionaryValue& extra_params) OVERRIDE FINAL;
246 245
247 // Dispatches an event |event_name| to the embedder with the |event| fields. 246 // Dispatches an event |event_name| to the embedder with the |event| fields.
248 void DispatchEventToEmbedder(Event* event); 247 void DispatchEventToEmbedder(Event* event);
249 248
250 protected: 249 protected:
251 GuestViewBase(content::BrowserContext* browser_context, 250 GuestViewBase(content::BrowserContext* browser_context,
252 int guest_instance_id); 251 int guest_instance_id);
253 252
254 virtual ~GuestViewBase(); 253 virtual ~GuestViewBase();
255 254
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 291
293 // This is a queue of Events that are destined to be sent to the embedder once 292 // This is a queue of Events that are destined to be sent to the embedder once
294 // the guest is attached to a particular embedder. 293 // the guest is attached to a particular embedder.
295 std::deque<linked_ptr<Event> > pending_events_; 294 std::deque<linked_ptr<Event> > pending_events_;
296 295
297 // The opener guest view. 296 // The opener guest view.
298 base::WeakPtr<GuestViewBase> opener_; 297 base::WeakPtr<GuestViewBase> opener_;
299 298
300 DestructionCallback destruction_callback_; 299 DestructionCallback destruction_callback_;
301 300
302 // The extra parameters associated with this GuestView passed 301 // The parameters associated with the element hosting this GuestView that
303 // in from JavaScript. This will typically be the view instance ID, 302 // are passed in from JavaScript. This will typically be the view instance ID,
304 // the API to use, and view-specific parameters. These parameters 303 // and element-specific parameters. These parameters are passed along to new
305 // are passed along to new guests that are created from this guest. 304 // guests that are created from this guest.
306 scoped_ptr<base::DictionaryValue> extra_params_; 305 scoped_ptr<base::DictionaryValue> attach_params_;
307 306
308 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; 307 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_;
309 308
310 // The size of the container element. 309 // The size of the container element.
311 gfx::Size element_size_; 310 gfx::Size element_size_;
312 311
313 // The size of the guest content. Note: In autosize mode, the container 312 // The size of the guest content. Note: In autosize mode, the container
314 // element may not match the size of the guest. 313 // element may not match the size of the guest.
315 gfx::Size guest_size_; 314 gfx::Size guest_size_;
316 315
317 // Indicates whether autosize mode is enabled or not. 316 // Indicates whether autosize mode is enabled or not.
318 bool auto_size_enabled_; 317 bool auto_size_enabled_;
319 318
320 // The maximum size constraints of the container element in autosize mode. 319 // The maximum size constraints of the container element in autosize mode.
321 gfx::Size max_auto_size_; 320 gfx::Size max_auto_size_;
322 321
323 // The minimum size constraints of the container element in autosize mode. 322 // The minimum size constraints of the container element in autosize mode.
324 gfx::Size min_auto_size_; 323 gfx::Size min_auto_size_;
325 324
326 // This is used to ensure pending tasks will not fire after this object is 325 // This is used to ensure pending tasks will not fire after this object is
327 // destroyed. 326 // destroyed.
328 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; 327 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_;
329 328
330 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); 329 DISALLOW_COPY_AND_ASSIGN(GuestViewBase);
331 }; 330 };
332 331
333 } // namespace extensions 332 } // namespace extensions
334 333
335 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 334 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698