| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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 WEBKIT_SUPPORT_SIMPLE_RESOURCE_LOADER_BRIDGE_H__ | |
| 6 #define WEBKIT_SUPPORT_SIMPLE_RESOURCE_LOADER_BRIDGE_H__ | |
| 7 | |
| 8 #include <string> | |
| 9 #include "base/message_loop/message_loop_proxy.h" | |
| 10 #include "net/http/http_cache.h" | |
| 11 #include "webkit/glue/resource_loader_bridge.h" | |
| 12 | |
| 13 class GURL; | |
| 14 | |
| 15 namespace base { | |
| 16 class FilePath; | |
| 17 } | |
| 18 | |
| 19 class SimpleResourceLoaderBridge { | |
| 20 public: | |
| 21 // Call this function to initialize the simple resource loader bridge. | |
| 22 // It is safe to call this function multiple times. | |
| 23 // | |
| 24 // NOTE: If this function is not called, then a default request context will | |
| 25 // be initialized lazily. | |
| 26 // | |
| 27 static void Init(const base::FilePath& cache_path, | |
| 28 net::HttpCache::Mode cache_mode, | |
| 29 bool no_proxy); | |
| 30 | |
| 31 // Call this function to shutdown the simple resource loader bridge. | |
| 32 static void Shutdown(); | |
| 33 | |
| 34 // May only be called after Init. | |
| 35 static void SetCookie(const GURL& url, | |
| 36 const GURL& first_party_for_cookies, | |
| 37 const std::string& cookie); | |
| 38 static std::string GetCookies(const GURL& url, | |
| 39 const GURL& first_party_for_cookies); | |
| 40 static bool EnsureIOThread(); | |
| 41 static void SetAcceptAllCookies(bool accept_all_cookies); | |
| 42 | |
| 43 // These methods should only be called after Init(), and before | |
| 44 // Shutdown(). The MessageLoops get replaced upon each call to | |
| 45 // Init(), and destroyed upon a call to ShutDown(). | |
| 46 static scoped_refptr<base::MessageLoopProxy> GetCacheThread(); | |
| 47 static scoped_refptr<base::MessageLoopProxy> GetIoThread(); | |
| 48 | |
| 49 // Call this function to set up a redirection using the file-over-http | |
| 50 // feature. If redirections are set up, request using the file scheme which | |
| 51 // match |file_path_template| will be rewritten to the |http_prefix| plus | |
| 52 // the path that follows after the |file_path_template| in the request. | |
| 53 static void AllowFileOverHTTP(const std::string& file_path_template, | |
| 54 const GURL& http_prefix); | |
| 55 | |
| 56 // Creates a ResourceLoaderBridge instance. | |
| 57 static webkit_glue::ResourceLoaderBridge* Create( | |
| 58 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info); | |
| 59 }; | |
| 60 | |
| 61 #endif // WEBKIT_SUPPORT_SIMPLE_RESOURCE_LOADER_BRIDGE_H__ | |
| OLD | NEW |