| OLD | NEW |
| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 234 |
| 235 // Returns the instance ID of the <*view> element. | 235 // Returns the instance ID of the <*view> element. |
| 236 int view_instance_id() const { return view_instance_id_; } | 236 int view_instance_id() const { return view_instance_id_; } |
| 237 | 237 |
| 238 // Returns the instance ID of this GuestViewBase. | 238 // Returns the instance ID of this GuestViewBase. |
| 239 int guest_instance_id() const { return guest_instance_id_; } | 239 int guest_instance_id() const { return guest_instance_id_; } |
| 240 | 240 |
| 241 // Returns the instance ID of the GuestViewBase's element. | 241 // Returns the instance ID of the GuestViewBase's element. |
| 242 int element_instance_id() const { return element_instance_id_; } | 242 int element_instance_id() const { return element_instance_id_; } |
| 243 | 243 |
| 244 // Returns the extension ID of the embedder. | |
| 245 const std::string& owner_extension_id() const { | |
| 246 return owner_extension_id_; | |
| 247 } | |
| 248 | |
| 249 // Returns whether this GuestView is embedded in an extension/app. | |
| 250 bool in_extension() const { return !owner_extension_id_.empty(); } | |
| 251 | |
| 252 bool can_owner_receive_events() const { return !!view_instance_id_; } | 244 bool can_owner_receive_events() const { return !!view_instance_id_; } |
| 253 | 245 |
| 254 // Returns the user browser context of the embedder. | 246 // Returns the user browser context of the embedder. |
| 255 content::BrowserContext* browser_context() const { return browser_context_; } | 247 content::BrowserContext* browser_context() const { return browser_context_; } |
| 256 | 248 |
| 257 GuestViewBase* GetOpener() const { | 249 GuestViewBase* GetOpener() const { |
| 258 return opener_.get(); | 250 return opener_.get(); |
| 259 } | 251 } |
| 260 | 252 |
| 261 // Returns the URL of the owner WebContents. | 253 // Returns the URL of the owner WebContents. |
| 262 const GURL& GetOwnerSiteURL() const; | 254 const GURL& GetOwnerSiteURL() const; |
| 263 | 255 |
| 256 // Returns the host of the owner WebContents. For extensions, this is the |
| 257 // extension ID. |
| 258 std::string owner_host() const { return owner_host_; } |
| 259 |
| 264 // Whether the guest view is inside a plugin document. | 260 // Whether the guest view is inside a plugin document. |
| 265 bool is_full_page_plugin() const { return is_full_page_plugin_; } | 261 bool is_full_page_plugin() const { return is_full_page_plugin_; } |
| 266 | 262 |
| 267 // Returns the routing ID of the guest proxy in the owner's renderer process. | 263 // Returns the routing ID of the guest proxy in the owner's renderer process. |
| 268 // This value is only valid after attachment or first navigation. | 264 // This value is only valid after attachment or first navigation. |
| 269 int proxy_routing_id() const { return guest_proxy_routing_id_; } | 265 int proxy_routing_id() const { return guest_proxy_routing_id_; } |
| 270 | 266 |
| 271 // Destroy this guest. | 267 // Destroy this guest. |
| 272 void Destroy(); | 268 void Destroy(); |
| 273 | 269 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 370 |
| 375 void SetUpSizing(const base::DictionaryValue& params); | 371 void SetUpSizing(const base::DictionaryValue& params); |
| 376 | 372 |
| 377 void StartTrackingEmbedderZoomLevel(); | 373 void StartTrackingEmbedderZoomLevel(); |
| 378 void StopTrackingEmbedderZoomLevel(); | 374 void StopTrackingEmbedderZoomLevel(); |
| 379 | 375 |
| 380 // This guest tracks the lifetime of the WebContents specified by | 376 // This guest tracks the lifetime of the WebContents specified by |
| 381 // |owner_web_contents_|. If |owner_web_contents_| is destroyed then this | 377 // |owner_web_contents_|. If |owner_web_contents_| is destroyed then this |
| 382 // guest will also self-destruct. | 378 // guest will also self-destruct. |
| 383 content::WebContents* owner_web_contents_; | 379 content::WebContents* owner_web_contents_; |
| 384 std::string owner_extension_id_; | 380 std::string owner_host_; |
| 385 content::BrowserContext* const browser_context_; | 381 content::BrowserContext* const browser_context_; |
| 386 | 382 |
| 387 // |guest_instance_id_| is a profile-wide unique identifier for a guest | 383 // |guest_instance_id_| is a profile-wide unique identifier for a guest |
| 388 // WebContents. | 384 // WebContents. |
| 389 const int guest_instance_id_; | 385 const int guest_instance_id_; |
| 390 | 386 |
| 391 // |view_instance_id_| is an identifier that's unique within a particular | 387 // |view_instance_id_| is an identifier that's unique within a particular |
| 392 // embedder RenderViewHost for a particular <*view> instance. | 388 // embedder RenderViewHost for a particular <*view> instance. |
| 393 int view_instance_id_; | 389 int view_instance_id_; |
| 394 | 390 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 // This is used to ensure pending tasks will not fire after this object is | 448 // This is used to ensure pending tasks will not fire after this object is |
| 453 // destroyed. | 449 // destroyed. |
| 454 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; | 450 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; |
| 455 | 451 |
| 456 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); | 452 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); |
| 457 }; | 453 }; |
| 458 | 454 |
| 459 } // namespace extensions | 455 } // namespace extensions |
| 460 | 456 |
| 461 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 457 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
| OLD | NEW |