OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 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_CHROME_BROWSER_UI_CHROME_WEB_VIEW_FACTORY_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_CHROME_WEB_VIEW_FACTORY_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 #include <string> |
| 10 |
| 11 #include "base/files/file_path.h" |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/time/time.h" |
| 14 #import "ios/public/provider/chrome/browser/ui/default_ios_web_view_factory.h" |
| 15 |
| 16 class ChromeBrowserStateIOData; |
| 17 |
| 18 namespace ios { |
| 19 class ChromeBrowserState; |
| 20 } |
| 21 |
| 22 namespace ChromeWebView { |
| 23 // Shared desktop user agent used to mimic Safari on a mac. |
| 24 extern NSString* const kDesktopUserAgent; |
| 25 |
| 26 // RequestGroupID for external library, used by tests. |
| 27 extern NSString* const kExternalRequestGroupID; |
| 28 |
| 29 // Gets the external service name, used in tests. |
| 30 const std::string GetExternalServiceName( |
| 31 IOSWebViewFactoryExternalService service); |
| 32 } // namespace ChromeWebView |
| 33 |
| 34 namespace net { |
| 35 class URLRequestContextGetter; |
| 36 } |
| 37 |
| 38 @interface ChromeWebViewFactory : NSObject<IOSWebViewFactory> |
| 39 |
| 40 // Sets the browser state that will be used when creating UIWebView's for |
| 41 // external libraries. Should be called before each external session. |
| 42 + (void)setBrowserStateToUseForExternal:(ios::ChromeBrowserState*)browserState; |
| 43 |
| 44 // Should be called whenever a external session finishes. |
| 45 + (void)externalSessionFinished; |
| 46 |
| 47 // Returns the request context from the browser state currently set for external |
| 48 // library that the given external service should use for any requests that it |
| 49 // makes. |
| 50 + (net::URLRequestContextGetter*)requestContextForExternalService: |
| 51 (IOSWebViewFactoryExternalService)externalService; |
| 52 |
| 53 // Gets the partition path associated with an external service. |
| 54 + (base::FilePath)partitionPathForExternalService: |
| 55 (IOSWebViewFactoryExternalService)externalService; |
| 56 |
| 57 // Gets the ChromeBrowserStateIOData associated with external web views. |
| 58 + (ChromeBrowserStateIOData*)ioDataForExternalWebViews; |
| 59 |
| 60 // Clears the cookies for the |contextGetter| and the time interval between |
| 61 // |deleteBegin| and |deleteEnd|. |
| 62 + (void)clearCookiesForContextGetter: |
| 63 (scoped_refptr<net::URLRequestContextGetter>)contextGetter |
| 64 fromTime:(base::Time)deleteBegin |
| 65 toTime:(base::Time)deleteEnd; |
| 66 |
| 67 // Clears the cookies from the external request context for the given browser |
| 68 // state and the time interval between |deleteBegin| and |deleteEnd|. |
| 69 + (void)clearExternalCookies:(IOSWebViewFactoryExternalService)externalService |
| 70 browserState:(ios::ChromeBrowserState*)browserState |
| 71 fromTime:(base::Time)deleteBegin |
| 72 toTime:(base::Time)deleteEnd; |
| 73 |
| 74 // Clears the cookies in the external request contexts for the given |
| 75 // browser state and the time interval between |deleteBegin| and |deleteEnd|. |
| 76 + (void)clearExternalCookies:(ios::ChromeBrowserState*)browserState |
| 77 fromTime:(base::Time)deleteBegin |
| 78 toTime:(base::Time)deleteEnd; |
| 79 |
| 80 @end |
| 81 |
| 82 #endif // IOS_CHROME_BROWSER_UI_CHROME_WEB_VIEW_FACTORY_H_ |
OLD | NEW |