OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 WEBKIT_TOOLS_TEST_SHELL_SIMPLE_RESOURCE_LOADER_BRIDGE_H__ | 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_SIMPLE_RESOURCE_LOADER_BRIDGE_H__ |
6 #define WEBKIT_TOOLS_TEST_SHELL_SIMPLE_RESOURCE_LOADER_BRIDGE_H__ | 6 #define WEBKIT_TOOLS_TEST_SHELL_SIMPLE_RESOURCE_LOADER_BRIDGE_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
| 9 #include "base/message_loop_proxy.h" |
9 #include "base/file_path.h" | 10 #include "base/file_path.h" |
10 #include "net/http/http_cache.h" | 11 #include "net/http/http_cache.h" |
11 | 12 |
12 class GURL; | 13 class GURL; |
13 class TestShellRequestContext; | 14 class TestShellRequestContext; |
14 | 15 |
15 class SimpleResourceLoaderBridge { | 16 class SimpleResourceLoaderBridge { |
16 public: | 17 public: |
17 // Call this function to initialize the simple resource loader bridge. | 18 // Call this function to initialize the simple resource loader bridge. |
18 // It is safe to call this function multiple times. | 19 // It is safe to call this function multiple times. |
19 // | 20 // |
20 // NOTE: If this function is not called, then a default request context will | 21 // NOTE: If this function is not called, then a default request context will |
21 // be initialized lazily. | 22 // be initialized lazily. |
22 // | 23 // |
23 static void Init(const FilePath& cache_path, | 24 static void Init(const FilePath& cache_path, |
24 net::HttpCache::Mode cache_mode, | 25 net::HttpCache::Mode cache_mode, |
25 bool no_proxy); | 26 bool no_proxy); |
26 | 27 |
27 // Call this function to shutdown the simple resource loader bridge. | 28 // Call this function to shutdown the simple resource loader bridge. |
28 static void Shutdown(); | 29 static void Shutdown(); |
29 | 30 |
30 // May only be called after Init. | 31 // May only be called after Init. |
31 static void SetCookie(const GURL& url, | 32 static void SetCookie(const GURL& url, |
32 const GURL& first_party_for_cookies, | 33 const GURL& first_party_for_cookies, |
33 const std::string& cookie); | 34 const std::string& cookie); |
34 static std::string GetCookies(const GURL& url, | 35 static std::string GetCookies(const GURL& url, |
35 const GURL& first_party_for_cookies); | 36 const GURL& first_party_for_cookies); |
36 static bool EnsureIOThread(); | 37 static bool EnsureIOThread(); |
37 static void SetAcceptAllCookies(bool accept_all_cookies); | 38 static void SetAcceptAllCookies(bool accept_all_cookies); |
| 39 |
| 40 // This method should only be called after Init(), and before Shutdown(). |
| 41 static scoped_refptr<base::MessageLoopProxy> GetCacheThread(); |
38 }; | 42 }; |
39 | 43 |
40 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_RESOURCE_LOADER_BRIDGE_H__ | 44 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_RESOURCE_LOADER_BRIDGE_H__ |
OLD | NEW |