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 COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ | 5 #ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ |
6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ | 6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "components/guest_view/common/guest_view_constants.h" | 14 #include "components/guest_view/common/guest_view_constants.h" |
14 #include "components/ui/zoom/zoom_observer.h" | 15 #include "components/ui/zoom/zoom_observer.h" |
15 #include "content/public/browser/browser_plugin_guest_delegate.h" | 16 #include "content/public/browser/browser_plugin_guest_delegate.h" |
16 #include "content/public/browser/guest_host.h" | 17 #include "content/public/browser/guest_host.h" |
17 #include "content/public/browser/render_process_host_observer.h" | 18 #include "content/public/browser/render_process_host_observer.h" |
18 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
19 #include "content/public/browser/web_contents_delegate.h" | 20 #include "content/public/browser/web_contents_delegate.h" |
20 #include "content/public/browser/web_contents_observer.h" | 21 #include "content/public/browser/web_contents_observer.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // | 106 // |
106 // This should be the name of the API as it appears in the _api_features.json | 107 // This should be the name of the API as it appears in the _api_features.json |
107 // file. | 108 // file. |
108 virtual const char* GetAPINamespace() const = 0; | 109 virtual const char* GetAPINamespace() const = 0; |
109 | 110 |
110 // This method is the task prefix to show for a task produced by this | 111 // This method is the task prefix to show for a task produced by this |
111 // GuestViewBase's derived type. | 112 // GuestViewBase's derived type. |
112 virtual int GetTaskPrefix() const = 0; | 113 virtual int GetTaskPrefix() const = 0; |
113 | 114 |
114 // Dispatches an event to the guest proxy. | 115 // Dispatches an event to the guest proxy. |
115 void DispatchEventToGuestProxy(GuestViewEvent* event); | 116 void DispatchEventToGuestProxy(scoped_ptr<GuestViewEvent> event); |
116 | 117 |
117 // Dispatches an event to the view. | 118 // Dispatches an event to the view. |
118 void DispatchEventToView(GuestViewEvent* event); | 119 void DispatchEventToView(scoped_ptr<GuestViewEvent> event); |
119 | 120 |
120 // This creates a WebContents and initializes |this| GuestViewBase to use the | 121 // This creates a WebContents and initializes |this| GuestViewBase to use the |
121 // newly created WebContents. | 122 // newly created WebContents. |
122 using WebContentsCreatedCallback = | 123 using WebContentsCreatedCallback = |
123 base::Callback<void(content::WebContents*)>; | 124 base::Callback<void(content::WebContents*)>; |
124 void Init(const base::DictionaryValue& create_params, | 125 void Init(const base::DictionaryValue& create_params, |
125 const WebContentsCreatedCallback& callback); | 126 const WebContentsCreatedCallback& callback); |
126 | 127 |
127 void InitWithWebContents(const base::DictionaryValue& create_params, | 128 void InitWithWebContents(const base::DictionaryValue& create_params, |
128 content::WebContents* guest_web_contents); | 129 content::WebContents* guest_web_contents); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 425 |
425 // |initialized_| indicates whether GuestViewBase::Init has been called for | 426 // |initialized_| indicates whether GuestViewBase::Init has been called for |
426 // this object. | 427 // this object. |
427 bool initialized_; | 428 bool initialized_; |
428 | 429 |
429 // Indicates that this guest is in the process of being destroyed. | 430 // Indicates that this guest is in the process of being destroyed. |
430 bool is_being_destroyed_; | 431 bool is_being_destroyed_; |
431 | 432 |
432 // This is a queue of Events that are destined to be sent to the embedder once | 433 // This is a queue of Events that are destined to be sent to the embedder once |
433 // the guest is attached to a particular embedder. | 434 // the guest is attached to a particular embedder. |
434 std::deque<linked_ptr<GuestViewEvent> > pending_events_; | 435 std::deque<scoped_ptr<GuestViewEvent>> pending_events_; |
435 | 436 |
436 // The opener guest view. | 437 // The opener guest view. |
437 base::WeakPtr<GuestViewBase> opener_; | 438 base::WeakPtr<GuestViewBase> opener_; |
438 | 439 |
439 // The parameters associated with the element hosting this GuestView that | 440 // The parameters associated with the element hosting this GuestView that |
440 // are passed in from JavaScript. This will typically be the view instance ID, | 441 // are passed in from JavaScript. This will typically be the view instance ID, |
441 // and element-specific parameters. These parameters are passed along to new | 442 // and element-specific parameters. These parameters are passed along to new |
442 // guests that are created from this guest. | 443 // guests that are created from this guest. |
443 scoped_ptr<base::DictionaryValue> attach_params_; | 444 scoped_ptr<base::DictionaryValue> attach_params_; |
444 | 445 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 // This is used to ensure pending tasks will not fire after this object is | 479 // This is used to ensure pending tasks will not fire after this object is |
479 // destroyed. | 480 // destroyed. |
480 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; | 481 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; |
481 | 482 |
482 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); | 483 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); |
483 }; | 484 }; |
484 | 485 |
485 } // namespace guest_view | 486 } // namespace guest_view |
486 | 487 |
487 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ | 488 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ |
OLD | NEW |