| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 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. | 
|  | 4 | 
|  | 5 #ifndef ANDROID_WEBVIEW_AW_BROWSER_DELEGATE_H_ | 
|  | 6 #define ANDROID_WEBVIEW_AW_BROWSER_DELEGATE_H_ | 
|  | 7 | 
|  | 8 #include "base/basictypes.h" | 
|  | 9 | 
|  | 10 namespace content { | 
|  | 11 class JavaScriptDialogCreator; | 
|  | 12 class WebContents; | 
|  | 13 } | 
|  | 14 | 
|  | 15 namespace android_webview { | 
|  | 16 | 
|  | 17 class AwContentsContainer; | 
|  | 18 | 
|  | 19 // The concrete class implementing this interface is the responsible for | 
|  | 20 // creating he browser component objects that the Android WebView depends on. | 
|  | 21 // The motivation for this abstraction is to keep code under | 
|  | 22 // android_webview/native from holding direct chrome/ layer dependencies. | 
|  | 23 // Note this is a distinct role to the Webview embedder proper: this class is | 
|  | 24 // about 'static' environmental decoupling, allowing dependency injection by the | 
|  | 25 // top-level lib, whereas runtime behavior is controlled by propagated back to | 
|  | 26 // the embedding application code via WebContentsDelegate and the like. | 
|  | 27 class AwBrowserDependencyFactory { | 
|  | 28  public: | 
|  | 29   virtual ~AwBrowserDependencyFactory(); | 
|  | 30 | 
|  | 31   // Allows the lib executive to inject the delegate instance. Ownership of | 
|  | 32   // |delegate| is NOT transferred, but the object must be long-lived. | 
|  | 33   static void SetInstance(AwBrowserDependencyFactory* delegate); | 
|  | 34 | 
|  | 35   // Returns the singleton instance. |SetInstance| must have been called. | 
|  | 36   static AwBrowserDependencyFactory* GetInstance(); | 
|  | 37 | 
|  | 38   // Constructs and returns ownership of a WebContents instance. | 
|  | 39   virtual content::WebContents* CreateWebContents(bool incognito) = 0; | 
|  | 40 | 
|  | 41   // Creates and returns ownership of a new content container instance. That | 
|  | 42   // instance will take ownership of the passed |contents|. | 
|  | 43   virtual AwContentsContainer* CreateContentsContainer( | 
|  | 44       content::WebContents* contents) = 0; | 
|  | 45 | 
|  | 46   // As per the WebContentsDelegate method of the same name. Ownership is NOT | 
|  | 47   // returned; the instance must be long-lived. | 
|  | 48   virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator() = 0; | 
|  | 49 | 
|  | 50  protected: | 
|  | 51   AwBrowserDependencyFactory(); | 
|  | 52 | 
|  | 53  private: | 
|  | 54   DISALLOW_COPY_AND_ASSIGN(AwBrowserDependencyFactory); | 
|  | 55 }; | 
|  | 56 | 
|  | 57 }  // namespace android_webview | 
|  | 58 | 
|  | 59 #endif  // ANDROID_WEBVIEW_AW_BROWSER_DELEGATE_H_ | 
|  | 60 | 
| OLD | NEW | 
|---|