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

Side by Side Diff: ios/web/webui/crw_web_ui_page_builder.h

Issue 1110213002: Upstream most of the iOS WebUI support in ios/web/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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_WEBUI_CRW_WEB_UI_PAGE_BUILDER_H_
6 #define IOS_WEB_WEBUI_CRW_WEB_UI_PAGE_BUILDER_H_
7
8 #import <Foundation/Foundation.h>
9
10 #include "url/gurl.h"
11
12 namespace web {
13 // Block type for WebUI page build completion callback.
14 typedef void (^WebUIPageCompletion)(NSString*);
15 // Block type for WebUI page builder delegate completion callback.
16 typedef void (^WebUIDelegateCompletion)(NSString*, const GURL&);
17 } // namespace web
18
19 @class CRWWebUIPageBuilder;
20
21 // Delegate for CRWWebUIPageBuilder. Handles resource retrieval.
22 @protocol CRWWebUIPageBuilderDelegate<NSObject>
23 // Fetches resource for resourceURL and invokes completionHandler with the
24 // result.
25 - (void)webUIPageBuilder:(CRWWebUIPageBuilder*)webUIPageBuilder
26 fetchResourceWithURL:(const GURL&)resourceURL
27 completionHandler:(web::WebUIDelegateCompletion)completionHandler;
28 @end
29
30 // Class for requesting and building WebUI HTML pages. Due to limitations on
31 // custom network protocols for WKWebView, it is not possible to directly load
32 // WebUI in WKWebView via the network stack. Instead, WebUI resources are
33 // manually fetched from the network stack and then flattened and loaded into
34 // the web view.
35 //
36 // To flatten the WebUI resources, tags for JS and CSS resources are replaced
37 // with retrieved resources. For example, if a WebUI HTML resource looks like:
38 // <html>
39 // <script src='chrome://javascript.js></script>
40 // <link rel="stylesheet" href="chrome://stylesheet.css">
41 // </html>
42 // the flattened version would look like:
43 // <html>
44 // <script>[Content of chrome://javascript.js]</script>
45 // <style>[Content of chrome://stylesheet.css]</style>
46 // </html>
47 @interface CRWWebUIPageBuilder : NSObject
48
49 // Designated initializer.
50 - (instancetype)initWithDelegate:(id<CRWWebUIPageBuilderDelegate>)delegate;
51
52 // Builds and flattens page for webUIURL, and invokes completionHandler with the
53 // result.
54 - (void)buildWebUIPageForURL:(const GURL&)webUIURL
55 completionHandler:(web::WebUIPageCompletion)completionHandler;
56
57 @end
58
59 #endif // IOS_WEB_WEBUI_CRW_WEB_UI_PAGE_BUILDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698