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 EXTENSIONS_BROWSER_GUEST_VIEW_SURFACE_WORKER_SURFACE_WORKER_GUEST_H_
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_SURFACE_WORKER_SURFACE_WORKER_GUEST_H_
8 #include "components/guest_view/browser/guest_view.h"
10 namespace extensions
{
14 // An SurfaceWorkerGuest provides the browser-side implementation of the
15 // prototype <wtframe> API.
16 class SurfaceWorkerGuest
: public guest_view::GuestView
<SurfaceWorkerGuest
> {
18 static const char Type
[];
20 static guest_view::GuestViewBase
* Create(
21 content::WebContents
* owner_web_contents
);
23 // content::WebContentsDelegate implementation.
24 bool HandleContextMenu(const content::ContextMenuParams
& params
) override
;
26 // GuestViewBase implementation.
27 const char* GetAPINamespace() const override
;
28 int GetTaskPrefix() const override
;
29 void CreateWebContents(const base::DictionaryValue
& create_params
,
30 const WebContentsCreatedCallback
& callback
) override
;
31 void DidAttachToEmbedder() override
;
34 explicit SurfaceWorkerGuest(content::WebContents
* owner_web_contents
);
36 ~SurfaceWorkerGuest() override
;
40 // This is used to ensure pending tasks will not fire after this object is
42 base::WeakPtrFactory
<SurfaceWorkerGuest
> weak_ptr_factory_
;
44 DISALLOW_COPY_AND_ASSIGN(SurfaceWorkerGuest
);
47 } // namespace extensions
49 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_SURFACE_WORKER_SURFACE_WORKER_GUEST_H_