OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef IOS_WEB_PUBLIC_WEB_CLIENT_H_ | |
6 #define IOS_WEB_PUBLIC_WEB_CLIENT_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/strings/string16.h" | |
12 #include "base/strings/string_piece.h" | |
13 #include "ui/base/layout.h" | |
14 | |
15 namespace base { | |
16 class RefCountedStaticMemory; | |
17 } | |
18 | |
19 class GURL; | |
20 | |
21 #ifdef __OBJC__ | |
22 @class UIWebView; | |
23 #else | |
24 class UIWebView; | |
25 #endif | |
26 | |
27 namespace web { | |
28 | |
29 class BrowserState; | |
30 class BrowserURLRewriter; | |
31 class WebClient; | |
32 class WebMainParts; | |
33 class WebViewFactory; | |
34 | |
35 // Setter and getter for the client. The client should be set early, before any | |
36 // web code is called. | |
37 void SetWebClient(WebClient* client); | |
38 | |
39 WebClient* GetWebClient(); | |
sdefresne
2015/01/30 10:29:46
Please document this method.
droger
2015/01/30 10:36:52
It's documented on line 35, I removed the blank li
| |
40 | |
41 // Interface that the embedder of the web layer implements. | |
42 class WebClient { | |
43 public: | |
44 WebClient(); | |
45 virtual ~WebClient(); | |
46 | |
47 // Allows the embedder to set a custom WebMainParts implementation for the | |
48 // browser startup code. | |
49 virtual WebMainParts* CreateWebMainParts(); | |
50 | |
51 // Gives the embedder a chance to perform tasks before a web view is created. | |
52 virtual void PreWebViewCreation() const {}; | |
sdefresne
2015/01/30 10:29:46
style: remove ";" after "{}" (here and everywhere
droger
2015/01/30 10:36:52
Done.
| |
53 | |
54 // Gives the embedder a chance to set up the given web view before presenting | |
55 // it in the UI. | |
56 virtual void PostWebViewCreation(UIWebView* web_view) const {}; | |
57 | |
58 // Returns a factory that vends WebViews. | |
59 virtual WebViewFactory* GetWebViewFactory() const; | |
60 | |
61 // Returns the languages used in the Accept-Languages HTTP header. | |
62 // Used to decide URL formating. | |
63 virtual std::string GetAcceptLangs(BrowserState* state) const; | |
64 | |
65 // Returns true if URL has application specific schema. Embedder must return | |
66 // true for every custom app specific schema it supports. For example Chromium | |
67 // browser would return true for "chrome://about" URL. | |
68 virtual bool IsAppSpecificURL(const GURL& url) const; | |
69 | |
70 // Returns text to be displayed for an unsupported plug-in. | |
71 virtual base::string16 GetPluginNotSupportedText() const; | |
72 | |
73 // Returns a string describing the embedder product name and version, of the | |
74 // form "productname/version". Used as part of the user agent string. | |
75 virtual std::string GetProduct() const; | |
76 | |
77 // Returns the user agent. |desktop_user_agent| is true if desktop user agent | |
78 // is requested. | |
79 virtual std::string GetUserAgent(bool desktop_user_agent) const; | |
80 | |
81 // Returns a string resource given its id. | |
82 virtual base::string16 GetLocalizedString(int message_id) const; | |
83 | |
84 // Return the contents of a resource in a StringPiece given the resource id. | |
sdefresne
2015/01/30 10:29:46
nit: Returns
| |
85 virtual base::StringPiece GetDataResource(int resource_id, | |
86 ui::ScaleFactor scale_factor) const; | |
87 | |
88 // Returns the raw bytes of a scale independent data resource. | |
89 virtual base::RefCountedStaticMemory* GetDataResourceBytes( | |
90 int resource_id) const; | |
91 | |
92 // Returns a list of additional WebUI schemes, if any. These additional | |
93 // schemes act as aliases to the about: scheme. The additional schemes may or | |
94 // may not serve specific WebUI pages depending on the particular | |
95 // URLDataSourceIOS and its override of | |
96 // URLDataSourceIOS::ShouldServiceRequest. For all schemes returned here, | |
97 // view-source is allowed. | |
98 virtual void GetAdditionalWebUISchemes( | |
99 std::vector<std::string>* additional_schemes) {} | |
100 | |
101 // Gives the embedder a chance to add url rewriters to the BrowserURLRewriter | |
102 // singeleton. | |
sdefresne
2015/01/30 10:29:46
nit: singleton
| |
103 virtual void PostBrowserURLRewriterCreation(BrowserURLRewriter* rewriter) {} | |
104 }; | |
105 | |
106 } // namespace web | |
107 | |
108 #endif // IOS_WEB_PUBLIC_WEB_CLIENT_H_ | |
OLD | NEW |