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

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

Powered by Google App Engine
This is Rietveld 408576698