Update {virtual,override,final} for content/ to follow C++11 style.
[chromium-blink-merge.git] / android_webview / native / aw_browser_dependency_factory.h
blob08243029159fab23dfd0f41d7a8762c52bc57d58
1 // Copyright (c) 2012 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 ANDROID_WEBVIEW_AW_BROWSER_DELEGATE_H_
6 #define ANDROID_WEBVIEW_AW_BROWSER_DELEGATE_H_
8 #include "base/basictypes.h"
10 namespace content {
11 class BrowserContext;
12 class JavaScriptDialogManager;
13 class WebContents;
16 namespace android_webview {
18 class AwContentsContainer;
20 // The concrete class implementing this interface is the responsible for
21 // creating he browser component objects that the Android WebView depends on.
22 // The motivation for this abstraction is to keep code under
23 // android_webview/native from holding direct chrome/ layer dependencies.
24 // Note this is a distinct role to the Webview embedder proper: this class is
25 // about 'static' environmental decoupling, allowing dependency injection by the
26 // top-level lib, whereas runtime behavior is controlled by propagated back to
27 // the embedding application code via WebContentsDelegate and the like.
28 class AwBrowserDependencyFactory {
29 public:
30 virtual ~AwBrowserDependencyFactory();
32 // Allows the lib executive to inject the delegate instance. Ownership of
33 // |delegate| is NOT transferred, but the object must be long-lived.
34 static void SetInstance(AwBrowserDependencyFactory* delegate);
36 // Returns the singleton instance. |SetInstance| must have been called.
37 static AwBrowserDependencyFactory* GetInstance();
39 // Returns the current browser context based on the specified mode.
40 virtual content::BrowserContext* GetBrowserContext() = 0;
42 // Constructs and returns ownership of a WebContents instance.
43 virtual content::WebContents* CreateWebContents() = 0;
45 protected:
46 AwBrowserDependencyFactory();
48 private:
49 DISALLOW_COPY_AND_ASSIGN(AwBrowserDependencyFactory);
52 } // namespace android_webview
54 #endif // ANDROID_WEBVIEW_AW_BROWSER_DELEGATE_H_