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.
5 #ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_
6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_
8 #include "chrome/browser/guest_view/guest_view_base.h"
10 // A GuestView is the templated base class for out-of-process frames in the
11 // chrome layer. GuestView is templated on its derived type to allow for type-
12 // safe access. See GuestViewBase for more information.
14 class GuestView
: public GuestViewBase
{
16 static T
* From(int embedder_process_id
, int guest_instance_id
) {
17 GuestViewBase
* guest
=
18 GuestViewBase::From(embedder_process_id
, guest_instance_id
);
21 return guest
->As
<T
>();
24 static T
* FromWebContents(content::WebContents
* contents
) {
25 GuestViewBase
* guest
= GuestViewBase::FromWebContents(contents
);
26 return guest
? guest
->As
<T
>() : NULL
;
29 T
* GetOpener() const {
30 GuestViewBase
* guest
= GuestViewBase::GetOpener();
33 return guest
->As
<T
>();
36 void SetOpener(T
* opener
) {
37 GuestViewBase::SetOpener(opener
);
40 // GuestViewBase implementation.
41 virtual const char* GetViewType() const OVERRIDE
{
46 GuestView(int guest_instance_id
,
47 content::WebContents
* guest_web_contents
,
48 const std::string
& embedder_extension_id
)
49 : GuestViewBase(guest_instance_id
,
51 embedder_extension_id
) {}
52 virtual ~GuestView() {}
55 DISALLOW_COPY_AND_ASSIGN(GuestView
);
58 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_