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_AD_VIEW_AD_VIEW_GUEST_H_
6 #define CHROME_BROWSER_GUEST_VIEW_AD_VIEW_AD_VIEW_GUEST_H_
8 #include "base/values.h"
9 #include "chrome/browser/guest_view/guest_view.h"
10 #include "content/public/browser/web_contents_observer.h"
12 // An AdViewGuest is a WebContentsObserver on the guest WebContents of a
13 // <adview> tag. It provides the browser-side implementation of the <adview>
14 // API and manages the lifetime of <adview> extension events. AdViewGuest is
15 // created on attachment. When a guest WebContents is associated with
16 // a particular embedder WebContents, we call this "attachment".
17 // TODO(fsamuel): There might be an opportunity here to refactor and reuse code
18 // between AdViewGuest and WebViewGuest.
19 class AdViewGuest
: public GuestView
<AdViewGuest
>,
20 public content::WebContentsObserver
{
22 AdViewGuest(content::WebContents
* guest_web_contents
,
23 const std::string
& extension_id
);
25 static const char Type
[];
28 virtual ~AdViewGuest();
30 virtual void DidCommitProvisionalLoadForFrame(
32 const base::string16
& frame_unique_name
,
35 content::PageTransition transition_type
,
36 content::RenderViewHost
* render_view_host
) OVERRIDE
;
37 virtual void DidFailProvisionalLoad(
39 const base::string16
& frame_unique_name
,
41 const GURL
& validated_url
,
43 const base::string16
& error_description
,
44 content::RenderViewHost
* render_view_host
) OVERRIDE
;
46 DISALLOW_COPY_AND_ASSIGN(AdViewGuest
);
49 #endif // CHROME_BROWSER_GUEST_VIEW_AD_VIEW_AD_VIEW_GUEST_H_