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

Side by Side Diff: chrome/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: All tests pass 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 CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 5 #ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 6 #define CHROME_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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 return embedder_web_contents_; 189 return embedder_web_contents_;
190 } 190 }
191 191
192 // Returns the guest WebContents. 192 // Returns the guest WebContents.
193 content::WebContents* guest_web_contents() const { 193 content::WebContents* guest_web_contents() const {
194 return web_contents(); 194 return web_contents();
195 } 195 }
196 196
197 // Returns the extra parameters associated with this GuestView passed 197 // Returns the extra parameters associated with this GuestView passed
198 // in from JavaScript. 198 // in from JavaScript.
199 base::DictionaryValue* extra_params() const { 199 base::DictionaryValue* attach_params() const { return attach_params_.get(); }
200 return extra_params_.get();
201 }
202 200
203 // Returns whether this guest has an associated embedder. 201 // Returns whether this guest has an associated embedder.
204 bool attached() const { return !!embedder_web_contents_; } 202 bool attached() const { return !!embedder_web_contents_; }
205 203
206 // Returns the instance ID of the <*view> element. 204 // Returns the instance ID of the <*view> element.
207 int view_instance_id() const { return view_instance_id_; } 205 int view_instance_id() const { return view_instance_id_; }
208 206
209 // Returns the extension ID of the embedder. 207 // Returns the extension ID of the embedder.
210 const std::string& embedder_extension_id() const { 208 const std::string& embedder_extension_id() const {
211 return embedder_extension_id_; 209 return embedder_extension_id_;
212 } 210 }
213 211
214 // Returns whether this GuestView is embedded in an extension/app. 212 // Returns whether this GuestView is embedded in an extension/app.
215 bool in_extension() const { return !embedder_extension_id_.empty(); } 213 bool in_extension() const { return !embedder_extension_id_.empty(); }
216 214
217 // Returns the user browser context of the embedder. 215 // Returns the user browser context of the embedder.
218 content::BrowserContext* browser_context() const { return browser_context_; } 216 content::BrowserContext* browser_context() const { return browser_context_; }
219 217
220 // Returns the embedder's process ID. 218 // Returns the embedder's process ID.
221 int embedder_render_process_id() const { return embedder_render_process_id_; } 219 int embedder_render_process_id() const { return embedder_render_process_id_; }
222 220
223 GuestViewBase* GetOpener() const { 221 GuestViewBase* GetOpener() const {
224 return opener_.get(); 222 return opener_.get();
225 } 223 }
226 224
225 // Sets some additional chrome/ initialization parameters.
226 void SetAttachParams(const base::DictionaryValue& params);
227 void SetOpener(GuestViewBase* opener); 227 void SetOpener(GuestViewBase* opener);
228 228
229 // RenderProcessHostObserver implementation 229 // RenderProcessHostObserver implementation
230 virtual void RenderProcessExited(content::RenderProcessHost* host, 230 virtual void RenderProcessExited(content::RenderProcessHost* host,
231 base::ProcessHandle handle, 231 base::ProcessHandle handle,
232 base::TerminationStatus status, 232 base::TerminationStatus status,
233 int exit_code) OVERRIDE; 233 int exit_code) OVERRIDE;
234 234
235 // BrowserPluginGuestDelegate implementation. 235 // BrowserPluginGuestDelegate implementation.
236 virtual void Destroy() OVERRIDE FINAL; 236 virtual void Destroy() OVERRIDE FINAL;
237 virtual void DidAttach() OVERRIDE FINAL; 237 virtual void DidAttach() OVERRIDE FINAL;
238 virtual void ElementSizeChanged(const gfx::Size& old_size, 238 virtual void ElementSizeChanged(const gfx::Size& old_size,
239 const gfx::Size& new_size) OVERRIDE FINAL; 239 const gfx::Size& new_size) OVERRIDE FINAL;
240 virtual int GetGuestInstanceID() const OVERRIDE; 240 virtual int GetGuestInstanceID() const OVERRIDE;
241 virtual void GuestSizeChanged(const gfx::Size& old_size, 241 virtual void GuestSizeChanged(const gfx::Size& old_size,
242 const gfx::Size& new_size) OVERRIDE FINAL; 242 const gfx::Size& new_size) OVERRIDE FINAL;
243 virtual void RegisterDestructionCallback( 243 virtual void RegisterDestructionCallback(
244 const DestructionCallback& callback) OVERRIDE FINAL; 244 const DestructionCallback& callback) OVERRIDE FINAL;
245 virtual void WillAttach( 245 virtual void WillAttach(
246 content::WebContents* embedder_web_contents, 246 content::WebContents* embedder_web_contents) OVERRIDE FINAL;
247 const base::DictionaryValue& extra_params) OVERRIDE FINAL;
248 247
249 // Dispatches an event |event_name| to the embedder with the |event| fields. 248 // Dispatches an event |event_name| to the embedder with the |event| fields.
250 void DispatchEventToEmbedder(Event* event); 249 void DispatchEventToEmbedder(Event* event);
251 250
252 protected: 251 protected:
253 GuestViewBase(content::BrowserContext* browser_context, 252 GuestViewBase(content::BrowserContext* browser_context,
254 int guest_instance_id); 253 int guest_instance_id);
255 254
256 virtual ~GuestViewBase(); 255 virtual ~GuestViewBase();
257 256
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 297
299 // The opener guest view. 298 // The opener guest view.
300 base::WeakPtr<GuestViewBase> opener_; 299 base::WeakPtr<GuestViewBase> opener_;
301 300
302 DestructionCallback destruction_callback_; 301 DestructionCallback destruction_callback_;
303 302
304 // The extra parameters associated with this GuestView passed 303 // The extra parameters associated with this GuestView passed
305 // in from JavaScript. This will typically be the view instance ID, 304 // in from JavaScript. This will typically be the view instance ID,
306 // the API to use, and view-specific parameters. These parameters 305 // the API to use, and view-specific parameters. These parameters
307 // are passed along to new guests that are created from this guest. 306 // are passed along to new guests that are created from this guest.
308 scoped_ptr<base::DictionaryValue> extra_params_; 307 scoped_ptr<base::DictionaryValue> attach_params_;
Xi Han 2014/08/12 18:17:54 Please update the first line of the description: "
Fady Samuel 2014/08/13 22:24:39 Done.
309 308
310 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; 309 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_;
311 310
312 // The size of the container element. 311 // The size of the container element.
313 gfx::Size element_size_; 312 gfx::Size element_size_;
314 313
315 // The size of the guest content. Note: In autosize mode, the container 314 // The size of the guest content. Note: In autosize mode, the container
316 // element may not match the size of the guest. 315 // element may not match the size of the guest.
317 gfx::Size guest_size_; 316 gfx::Size guest_size_;
318 317
319 // Indicates whether autosize mode is enabled or not. 318 // Indicates whether autosize mode is enabled or not.
320 bool auto_size_enabled_; 319 bool auto_size_enabled_;
321 320
322 // The maximum size constraints of the container element in autosize mode. 321 // The maximum size constraints of the container element in autosize mode.
323 gfx::Size max_auto_size_; 322 gfx::Size max_auto_size_;
324 323
325 // The minimum size constraints of the container element in autosize mode. 324 // The minimum size constraints of the container element in autosize mode.
326 gfx::Size min_auto_size_; 325 gfx::Size min_auto_size_;
327 326
328 // This is used to ensure pending tasks will not fire after this object is 327 // This is used to ensure pending tasks will not fire after this object is
329 // destroyed. 328 // destroyed.
330 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; 329 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_;
331 330
332 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); 331 DISALLOW_COPY_AND_ASSIGN(GuestViewBase);
333 }; 332 };
334 333
335 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 334 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/guest_view/extension_options/extension_options_guest.cc ('k') | chrome/browser/guest_view/guest_view_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698