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

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

Issue 618823002: GuestView: Move lifetime management out of content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment Created 6 years, 2 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // to destruction. 95 // to destruction.
96 virtual void EmbedderDestroyed() {} 96 virtual void EmbedderDestroyed() {}
97 97
98 // This method is called when the guest WebContents has been destroyed. This 98 // This method is called when the guest WebContents has been destroyed. This
99 // object will be destroyed after this call returns. 99 // object will be destroyed after this call returns.
100 // 100 //
101 // This gives the derived class an opportunity to perform some cleanup. 101 // This gives the derived class an opportunity to perform some cleanup.
102 virtual void GuestDestroyed() {} 102 virtual void GuestDestroyed() {}
103 103
104 // This method is invoked when the guest RenderView is ready, e.g. because we 104 // This method is invoked when the guest RenderView is ready, e.g. because we
105 // recreated it after a crash. 105 // recreated it after a crash or after reattachment.
106 // 106 //
107 // This gives the derived class an opportunity to perform some initialization 107 // This gives the derived class an opportunity to perform some initialization
108 // work. 108 // work.
109 virtual void GuestReady() {} 109 virtual void GuestReady() {}
110 110
111 // This method is invoked when the contents auto-resized to give the container 111 // This method is invoked when the contents auto-resized to give the container
112 // an opportunity to match it if it wishes. 112 // an opportunity to match it if it wishes.
113 // 113 //
114 // This gives the derived class an opportunity to inform its container element 114 // This gives the derived class an opportunity to inform its container element
115 // or perform other actions. 115 // or perform other actions.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // Returns the user browser context of the embedder. 217 // Returns the user browser context of the embedder.
218 content::BrowserContext* browser_context() const { return browser_context_; } 218 content::BrowserContext* browser_context() const { return browser_context_; }
219 219
220 // Returns the embedder's process ID. 220 // Returns the embedder's process ID.
221 int embedder_render_process_id() const { return embedder_render_process_id_; } 221 int embedder_render_process_id() const { return embedder_render_process_id_; }
222 222
223 GuestViewBase* GetOpener() const { 223 GuestViewBase* GetOpener() const {
224 return opener_.get(); 224 return opener_.get();
225 } 225 }
226 226
227 // Sets some additional chrome/ initialization parameters. 227 // Destroy this guest.
228 void Destroy();
229
230 // Saves the attach state of the custom element hosting this GuestView.
228 void SetAttachParams(const base::DictionaryValue& params); 231 void SetAttachParams(const base::DictionaryValue& params);
229 void SetOpener(GuestViewBase* opener); 232 void SetOpener(GuestViewBase* opener);
230 233
231 // RenderProcessHostObserver implementation 234 // RenderProcessHostObserver implementation
232 virtual void RenderProcessExited(content::RenderProcessHost* host, 235 virtual void RenderProcessExited(content::RenderProcessHost* host,
233 base::ProcessHandle handle, 236 base::ProcessHandle handle,
234 base::TerminationStatus status, 237 base::TerminationStatus status,
235 int exit_code) OVERRIDE; 238 int exit_code) OVERRIDE;
236 239
237 // BrowserPluginGuestDelegate implementation. 240 // BrowserPluginGuestDelegate implementation.
238 virtual void Destroy() OVERRIDE FINAL;
239 virtual void DidAttach(int guest_proxy_routing_id) OVERRIDE FINAL; 241 virtual void DidAttach(int guest_proxy_routing_id) OVERRIDE FINAL;
240 virtual void ElementSizeChanged(const gfx::Size& old_size, 242 virtual void ElementSizeChanged(const gfx::Size& old_size,
241 const gfx::Size& new_size) OVERRIDE FINAL; 243 const gfx::Size& new_size) OVERRIDE FINAL;
242 virtual void GuestSizeChanged(const gfx::Size& old_size, 244 virtual void GuestSizeChanged(const gfx::Size& old_size,
243 const gfx::Size& new_size) OVERRIDE FINAL; 245 const gfx::Size& new_size) OVERRIDE FINAL;
244 virtual void RegisterDestructionCallback( 246 virtual void RegisterDestructionCallback(
245 const DestructionCallback& callback) OVERRIDE FINAL; 247 const DestructionCallback& callback) OVERRIDE FINAL;
246 virtual void WillAttach( 248 virtual void WillAttach(
247 content::WebContents* embedder_web_contents, 249 content::WebContents* embedder_web_contents,
248 int browser_plugin_instance_id) OVERRIDE FINAL; 250 int browser_plugin_instance_id) OVERRIDE FINAL;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 // This is used to ensure pending tasks will not fire after this object is 343 // This is used to ensure pending tasks will not fire after this object is
342 // destroyed. 344 // destroyed.
343 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; 345 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_;
344 346
345 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); 347 DISALLOW_COPY_AND_ASSIGN(GuestViewBase);
346 }; 348 };
347 349
348 } // namespace extensions 350 } // namespace extensions
349 351
350 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 352 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698