| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ | |
| 6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ | |
| 7 | |
| 8 #include "chrome/browser/guest_view/guest_view_base.h" | |
| 9 | |
| 10 template <typename T> | |
| 11 class GuestView : public GuestViewBase { | |
| 12 public: | |
| 13 static T* From(int embedder_process_id, int guest_instance_id) { | |
| 14 GuestViewBase* guest = | |
| 15 GuestViewBase::From(embedder_process_id, guest_instance_id); | |
| 16 if (!guest) | |
| 17 return NULL; | |
| 18 return guest->As<T>(); | |
| 19 } | |
| 20 | |
| 21 static T* FromWebContents(content::WebContents* contents) { | |
| 22 GuestViewBase* guest = GuestViewBase::FromWebContents(contents); | |
| 23 return guest ? guest->As<T>() : NULL; | |
| 24 } | |
| 25 | |
| 26 // GuestViewBase implementation. | |
| 27 virtual const std::string& GetViewType() const OVERRIDE { return T::Type; } | |
| 28 | |
| 29 protected: | |
| 30 GuestView(content::WebContents* guest_web_contents, | |
| 31 const std::string& embedder_extension_id) | |
| 32 : GuestViewBase(guest_web_contents, embedder_extension_id) {} | |
| 33 | |
| 34 private: | |
| 35 DISALLOW_COPY_AND_ASSIGN(GuestView); | |
| 36 }; | |
| 37 | |
| 38 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ | |
| OLD | NEW |