| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_WEB_PUBLIC_WEB_CLIENT_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEB_CLIENT_H_ |
| 6 #define IOS_WEB_PUBLIC_WEB_CLIENT_H_ | 6 #define IOS_WEB_PUBLIC_WEB_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class UIWebView; | 26 class UIWebView; |
| 27 class NSString; | 27 class NSString; |
| 28 #endif | 28 #endif |
| 29 | 29 |
| 30 namespace web { | 30 namespace web { |
| 31 | 31 |
| 32 class BrowserState; | 32 class BrowserState; |
| 33 class BrowserURLRewriter; | 33 class BrowserURLRewriter; |
| 34 class WebClient; | 34 class WebClient; |
| 35 class WebMainParts; | 35 class WebMainParts; |
| 36 class WebViewFactory; | |
| 37 | 36 |
| 38 // Setter and getter for the client. The client should be set early, before any | 37 // Setter and getter for the client. The client should be set early, before any |
| 39 // web code is called. | 38 // web code is called. |
| 40 void SetWebClient(WebClient* client); | 39 void SetWebClient(WebClient* client); |
| 41 WebClient* GetWebClient(); | 40 WebClient* GetWebClient(); |
| 42 | 41 |
| 43 // Interface that the embedder of the web layer implements. | 42 // Interface that the embedder of the web layer implements. |
| 44 class WebClient { | 43 class WebClient { |
| 45 public: | 44 public: |
| 46 WebClient(); | 45 WebClient(); |
| 47 virtual ~WebClient(); | 46 virtual ~WebClient(); |
| 48 | 47 |
| 49 // Allows the embedder to set a custom WebMainParts implementation for the | 48 // Allows the embedder to set a custom WebMainParts implementation for the |
| 50 // browser startup code. | 49 // browser startup code. |
| 51 virtual WebMainParts* CreateWebMainParts(); | 50 virtual WebMainParts* CreateWebMainParts(); |
| 52 | 51 |
| 53 // Gives the embedder a chance to perform tasks before a web view is created. | 52 // Gives the embedder a chance to perform tasks before a web view is created. |
| 54 virtual void PreWebViewCreation() const {} | 53 virtual void PreWebViewCreation() const {} |
| 55 | 54 |
| 56 // Gives the embedder a chance to set up the given web view before presenting | 55 // Gives the embedder a chance to set up the given web view before presenting |
| 57 // it in the UI. | 56 // it in the UI. |
| 58 virtual void PostWebViewCreation(UIWebView* web_view) const {} | 57 virtual void PostWebViewCreation(UIWebView* web_view) const {} |
| 59 | 58 |
| 60 // Returns a factory that vends WebViews. | |
| 61 virtual WebViewFactory* GetWebViewFactory() const; | |
| 62 | |
| 63 // Returns the languages used in the Accept-Languages HTTP header. | 59 // Returns the languages used in the Accept-Languages HTTP header. |
| 64 // Used to decide URL formating. | 60 // Used to decide URL formating. |
| 65 virtual std::string GetAcceptLangs(BrowserState* state) const; | 61 virtual std::string GetAcceptLangs(BrowserState* state) const; |
| 66 | 62 |
| 67 // Returns the embedding application locale string. | 63 // Returns the embedding application locale string. |
| 68 virtual std::string GetApplicationLocale() const; | 64 virtual std::string GetApplicationLocale() const; |
| 69 | 65 |
| 70 // Returns true if URL has application specific schema. Embedder must return | 66 // Returns true if URL has application specific schema. Embedder must return |
| 71 // true for every custom app specific schema it supports. For example Chromium | 67 // true for every custom app specific schema it supports. For example Chromium |
| 72 // browser would return true for "chrome://about" URL. | 68 // browser would return true for "chrome://about" URL. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // Gives the embedder a chance to provide the JavaScript to be injected into | 106 // Gives the embedder a chance to provide the JavaScript to be injected into |
| 111 // the web view as early as possible. Result must not be nil. | 107 // the web view as early as possible. Result must not be nil. |
| 112 virtual NSString* GetEarlyPageScript(WebViewType web_view_type) const; | 108 virtual NSString* GetEarlyPageScript(WebViewType web_view_type) const; |
| 113 | 109 |
| 114 virtual bool IsExternalURLBlockingEnabled() const; | 110 virtual bool IsExternalURLBlockingEnabled() const; |
| 115 }; | 111 }; |
| 116 | 112 |
| 117 } // namespace web | 113 } // namespace web |
| 118 | 114 |
| 119 #endif // IOS_WEB_PUBLIC_WEB_CLIENT_H_ | 115 #endif // IOS_WEB_PUBLIC_WEB_CLIENT_H_ |
| OLD | NEW |