Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1185)

Unified Diff: ios/web/public/web_client.h

Issue 889663002: Upstream the iOS WebClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/ios_web.gyp ('k') | ios/web/public/web_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/web_client.h
diff --git a/ios/web/public/web_client.h b/ios/web/public/web_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..41ee68089ddf442d3994466d2eede74eb62cd85a
--- /dev/null
+++ b/ios/web/public/web_client.h
@@ -0,0 +1,107 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_WEB_PUBLIC_WEB_CLIENT_H_
+#define IOS_WEB_PUBLIC_WEB_CLIENT_H_
+
+#include <string>
+#include <vector>
+
+#include "base/strings/string16.h"
+#include "base/strings/string_piece.h"
+#include "ui/base/layout.h"
+
+namespace base {
+class RefCountedStaticMemory;
+}
+
+class GURL;
+
+#ifdef __OBJC__
+@class UIWebView;
+#else
+class UIWebView;
+#endif
+
+namespace web {
+
+class BrowserState;
+class BrowserURLRewriter;
+class WebClient;
+class WebMainParts;
+class WebViewFactory;
+
+// Setter and getter for the client. The client should be set early, before any
+// web code is called.
+void SetWebClient(WebClient* client);
+WebClient* GetWebClient();
+
+// Interface that the embedder of the web layer implements.
+class WebClient {
+ public:
+ WebClient();
+ virtual ~WebClient();
+
+ // Allows the embedder to set a custom WebMainParts implementation for the
+ // browser startup code.
+ virtual WebMainParts* CreateWebMainParts();
+
+ // Gives the embedder a chance to perform tasks before a web view is created.
+ virtual void PreWebViewCreation() const {}
+
+ // Gives the embedder a chance to set up the given web view before presenting
+ // it in the UI.
+ virtual void PostWebViewCreation(UIWebView* web_view) const {}
+
+ // Returns a factory that vends WebViews.
+ virtual WebViewFactory* GetWebViewFactory() const;
+
+ // Returns the languages used in the Accept-Languages HTTP header.
+ // Used to decide URL formating.
+ virtual std::string GetAcceptLangs(BrowserState* state) const;
+
+ // Returns true if URL has application specific schema. Embedder must return
+ // true for every custom app specific schema it supports. For example Chromium
+ // browser would return true for "chrome://about" URL.
+ virtual bool IsAppSpecificURL(const GURL& url) const;
+
+ // Returns text to be displayed for an unsupported plug-in.
+ virtual base::string16 GetPluginNotSupportedText() const;
+
+ // Returns a string describing the embedder product name and version, of the
+ // form "productname/version". Used as part of the user agent string.
+ virtual std::string GetProduct() const;
+
+ // Returns the user agent. |desktop_user_agent| is true if desktop user agent
+ // is requested.
+ virtual std::string GetUserAgent(bool desktop_user_agent) const;
+
+ // Returns a string resource given its id.
+ virtual base::string16 GetLocalizedString(int message_id) const;
+
+ // Returns the contents of a resource in a StringPiece given the resource id.
+ virtual base::StringPiece GetDataResource(int resource_id,
+ ui::ScaleFactor scale_factor) const;
+
+ // Returns the raw bytes of a scale independent data resource.
+ virtual base::RefCountedStaticMemory* GetDataResourceBytes(
+ int resource_id) const;
+
+ // Returns a list of additional WebUI schemes, if any. These additional
+ // schemes act as aliases to the about: scheme. The additional schemes may or
+ // may not serve specific WebUI pages depending on the particular
+ // URLDataSourceIOS and its override of
+ // URLDataSourceIOS::ShouldServiceRequest. For all schemes returned here,
+ // view-source is allowed.
+ virtual void GetAdditionalWebUISchemes(
+ std::vector<std::string>* additional_schemes) {}
+
+ // Gives the embedder a chance to add url rewriters to the BrowserURLRewriter
+ // singleton.
+ virtual void PostBrowserURLRewriterCreation(BrowserURLRewriter* rewriter) {}
+};
+
+} // namespace web
+
+#endif // IOS_WEB_PUBLIC_WEB_CLIENT_H_
« no previous file with comments | « ios/web/ios_web.gyp ('k') | ios/web/public/web_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698