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