| 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 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 // Returns a *ViewGuest if this GuestView is of the given view type. | 46 // Returns a *ViewGuest if this GuestView is of the given view type. |
| 47 template <typename T> | 47 template <typename T> |
| 48 T* As() { | 48 T* As() { |
| 49 if (IsViewType(T::Type)) | 49 if (IsViewType(T::Type)) |
| 50 return static_cast<T*>(this); | 50 return static_cast<T*>(this); |
| 51 | 51 |
| 52 return NULL; | 52 return NULL; |
| 53 } | 53 } |
| 54 | 54 |
| 55 static void RegisterGuestViewTypes(); |
| 56 |
| 57 typedef base::Callback<GuestViewBase*( |
| 58 content::BrowserContext*, int)> GuestCreationCallback; |
| 59 static void RegisterGuestViewType(const std::string& view_type, |
| 60 const GuestCreationCallback& callback); |
| 61 |
| 55 static GuestViewBase* Create(content::BrowserContext* browser_context, | 62 static GuestViewBase* Create(content::BrowserContext* browser_context, |
| 56 int guest_instance_id, | 63 int guest_instance_id, |
| 57 const std::string& view_type); | 64 const std::string& view_type); |
| 58 | 65 |
| 59 static GuestViewBase* FromWebContents(content::WebContents* web_contents); | 66 static GuestViewBase* FromWebContents(content::WebContents* web_contents); |
| 60 | 67 |
| 61 static GuestViewBase* From(int embedder_process_id, int instance_id); | 68 static GuestViewBase* From(int embedder_process_id, int instance_id); |
| 62 | 69 |
| 63 static bool IsGuest(content::WebContents* web_contents); | 70 static bool IsGuest(content::WebContents* web_contents); |
| 64 | 71 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; | 278 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; |
| 272 | 279 |
| 273 // This is used to ensure pending tasks will not fire after this object is | 280 // This is used to ensure pending tasks will not fire after this object is |
| 274 // destroyed. | 281 // destroyed. |
| 275 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; | 282 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; |
| 276 | 283 |
| 277 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); | 284 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); |
| 278 }; | 285 }; |
| 279 | 286 |
| 280 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 287 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
| OLD | NEW |