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_WEB_WEB_STATE_JS_CRW_JS_INVOKE_PARAMETER_QUEUE_H_ |
| 6 #define IOS_WEB_WEB_STATE_JS_CRW_JS_INVOKE_PARAMETER_QUEUE_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 class GURL; |
| 11 |
| 12 // Manages access to individual invoke parameters. |
| 13 @interface CRWJSInvokeParameters : NSObject |
| 14 |
| 15 // The designated initializer. |
| 16 - (id)initWithCommandString:(NSString*)commandString |
| 17 userIsInteracting:(BOOL)userIsInteracting |
| 18 originURL:(const GURL&)originURL |
| 19 forWindowId:(NSString*)windowId; |
| 20 |
| 21 // An escaped string with commands requested by JavaScript. |
| 22 @property(nonatomic, readonly) NSString* commandString; |
| 23 |
| 24 // Whether the user was interacting when the command was issued. |
| 25 @property(nonatomic, readonly) BOOL userIsInteracting; |
| 26 |
| 27 // Returns window id of the originating window. |
| 28 @property(nonatomic, readonly) NSString* windowId; |
| 29 |
| 30 // Returns URL that was current when the crwebinvoke was issued. |
| 31 @property(nonatomic, readonly) const GURL& originURL; |
| 32 |
| 33 @end |
| 34 |
| 35 |
| 36 // Stores parameters passed from JavaScript for deferred processing. |
| 37 @interface CRWJSInvokeParameterQueue : NSObject |
| 38 |
| 39 // YES if there are no more queued messages. |
| 40 @property(nonatomic, readonly) BOOL isEmpty; |
| 41 |
| 42 // Adds a new item to the queue. |commandString| is the escaped command string, |
| 43 // |userIsInteracting| is true if the user was interacting with the page, |
| 44 // |originURL| is the URL the command came from, and |windowId| is the id of the |
| 45 // window that sent the command. |
| 46 - (void)addCommandString:(NSString*)commandString |
| 47 userIsInteracting:(BOOL)userIsInteracting |
| 48 originURL:(const GURL&)originURL |
| 49 forWindowId:(NSString*)windowId; |
| 50 |
| 51 // Removes from |queue_| any CRWJSInvokeParameters whose command string contains |
| 52 // |commandString|. |
| 53 - (void)removeCommandString:(NSString*)commandString; |
| 54 |
| 55 // Removes the oldest item from the queue and returns it. |
| 56 - (CRWJSInvokeParameters*)popInvokeParameters; |
| 57 |
| 58 @end |
| 59 |
| 60 @interface CRWJSInvokeParameterQueue (Testing) |
| 61 // The number of items in the queue. |
| 62 @property(nonatomic, readonly) NSUInteger queueLength; |
| 63 @end |
| 64 |
| 65 #endif // IOS_WEB_WEB_STATE_JS_CRW_JS_INVOKE_PARAMETER_QUEUE_H_ |
OLD | NEW |