1 // Copyright 2015 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_API_EXTENSION_VIEW_EXTENSION_VIEW_INTERNAL_API_H_
6 #define EXTENSIONS_BROWSER_API_EXTENSION_VIEW_EXTENSION_VIEW_INTERNAL_API_H_
8 #include "extensions/browser/api/capture_web_contents_function.h"
9 #include "extensions/browser/api/execute_code_function.h"
10 #include "extensions/browser/extension_function.h"
11 #include "extensions/browser/guest_view/extension_view/extension_view_guest.h"
13 namespace extensions
{
15 // An abstract base class for async extensionview APIs. It does a process ID
16 // check in RunAsync, and then calls RunAsyncSafe which must be overriden by
18 class ExtensionViewInternalExtensionFunction
: public AsyncExtensionFunction
{
20 ExtensionViewInternalExtensionFunction() {}
23 ~ExtensionViewInternalExtensionFunction() override
{}
25 // ExtensionFunction implementation.
26 bool RunAsync() final
;
29 virtual bool RunAsyncSafe(ExtensionViewGuest
* guest
) = 0;
32 // Attempts to load a src into the extensionview.
33 class ExtensionViewInternalLoadSrcFunction
34 : public ExtensionViewInternalExtensionFunction
{
36 DECLARE_EXTENSION_FUNCTION("extensionViewInternal.loadSrc",
37 EXTENSIONVIEWINTERNAL_LOADSRC
);
38 ExtensionViewInternalLoadSrcFunction() {}
41 ~ExtensionViewInternalLoadSrcFunction() override
{}
44 // ExtensionViewInternalLoadSrcFunction implementation.
45 bool RunAsyncSafe(ExtensionViewGuest
* guest
) override
;
47 DISALLOW_COPY_AND_ASSIGN(ExtensionViewInternalLoadSrcFunction
);
50 // Parses a src and determines whether or not it is valid.
51 class ExtensionViewInternalParseSrcFunction
: public AsyncExtensionFunction
{
53 DECLARE_EXTENSION_FUNCTION("extensionViewInternal.parseSrc",
54 EXTENSIONVIEWINTERNAL_PARSESRC
);
55 ExtensionViewInternalParseSrcFunction() {}
58 ~ExtensionViewInternalParseSrcFunction() override
{}
61 // ExtensionViewInternalParseSrcFunction implementation.
62 bool RunAsync() final
;
64 DISALLOW_COPY_AND_ASSIGN(ExtensionViewInternalParseSrcFunction
);
67 } // namespace extensions
69 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_VIEW_EXTENSION_VIEW_INTERNAL_API_H_