Index: chrome/browser/guest_view/guest_view.h |
diff --git a/chrome/browser/guest_view/guest_view.h b/chrome/browser/guest_view/guest_view.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..351930541b93ca39a0a3df05b85173790995fbdf |
--- /dev/null |
+++ b/chrome/browser/guest_view/guest_view.h |
@@ -0,0 +1,41 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ |
+#define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ |
+ |
+#include "chrome/browser/guest_view/guest_view_base.h" |
+ |
+template <typename T> |
+class GuestView : public GuestViewBase { |
+ public: |
+ static T* From(int embedder_process_id, int guest_instance_id) { |
+ GuestViewBase* guest = |
+ GuestViewBase::From(embedder_process_id, guest_instance_id); |
+ if (!guest) |
+ return NULL; |
+ return guest->As<T>(); |
+ } |
+ |
+ static T* FromWebContents(content::WebContents* contents) { |
+ GuestViewBase* guest = GuestViewBase::FromWebContents(contents); |
+ return guest ? guest->As<T>() : NULL; |
+ } |
+ |
+ // GuestViewBase implementation. |
+ virtual const std::string& GetViewType() const OVERRIDE { return type_; } |
+ |
+ protected: |
+ GuestView(content::WebContents* guest_web_contents, |
+ const std::string& embedder_extension_id) |
+ : GuestViewBase(guest_web_contents, embedder_extension_id), |
+ type_(T::Type) {} |
+ |
+ private: |
+ std::string type_; |
Dan Beam
2014/04/26 03:31:54
and this
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(GuestView); |
+}; |
+ |
+#endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ |