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

Unified Diff: ios/web/web_state/js/crw_js_invoke_parameter_queue.h

Issue 1107083002: Upstream more leaf files in ios/web/web_state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web-resync
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ios/web/web_state/js/crw_js_invoke_parameter_queue.h
diff --git a/ios/web/web_state/js/crw_js_invoke_parameter_queue.h b/ios/web/web_state/js/crw_js_invoke_parameter_queue.h
new file mode 100644
index 0000000000000000000000000000000000000000..7a6811a8d1f286bd67d3c2aedda9677e73992463
--- /dev/null
+++ b/ios/web/web_state/js/crw_js_invoke_parameter_queue.h
@@ -0,0 +1,65 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_WEB_WEB_STATE_JS_CRW_JS_INVOKE_PARAMETER_QUEUE_H_
+#define IOS_WEB_WEB_STATE_JS_CRW_JS_INVOKE_PARAMETER_QUEUE_H_
+
+#import <UIKit/UIKit.h>
+
+class GURL;
+
+// Manages access to individual invoke parameters.
+@interface CRWJSInvokeParameters : NSObject
+
+// The designated initializer.
+- (id)initWithCommandString:(NSString*)commandString
+ userIsInteracting:(BOOL)userIsInteracting
+ originURL:(const GURL&)originURL
+ forWindowId:(NSString*)windowId;
+
+// An escaped string with commands requested by JavaScript.
+@property(nonatomic, readonly) NSString* commandString;
+
+// Whether the user was interacting when the command was issued.
+@property(nonatomic, readonly) BOOL userIsInteracting;
+
+// Returns window id of the originating window.
+@property(nonatomic, readonly) NSString* windowId;
+
+// Returns URL that was current when the crwebinvoke was issued.
+@property(nonatomic, readonly) const GURL& originURL;
+
+@end
+
+
+// Stores parameters passed from JavaScript for deferred processing.
+@interface CRWJSInvokeParameterQueue : NSObject
+
+// YES if there are no more queued messages.
+@property(nonatomic, readonly) BOOL isEmpty;
+
+// Adds a new item to the queue. |commandString| is the escaped command string,
+// |userIsInteracting| is true if the user was interacting with the page,
+// |originURL| is the URL the command came from, and |windowId| is the id of the
+// window that sent the command.
+- (void)addCommandString:(NSString*)commandString
+ userIsInteracting:(BOOL)userIsInteracting
+ originURL:(const GURL&)originURL
+ forWindowId:(NSString*)windowId;
+
+// Removes from |queue_| any CRWJSInvokeParameters whose command string contains
+// |commandString|.
+- (void)removeCommandString:(NSString*)commandString;
+
+// Removes the oldest item from the queue and returns it.
+- (CRWJSInvokeParameters*)popInvokeParameters;
+
+@end
+
+@interface CRWJSInvokeParameterQueue (Testing)
+// The number of items in the queue.
+@property(nonatomic, readonly) NSUInteger queueLength;
+@end
+
+#endif // IOS_WEB_WEB_STATE_JS_CRW_JS_INVOKE_PARAMETER_QUEUE_H_
« no previous file with comments | « ios/web/web_state/js/crw_js_injection_manager.mm ('k') | ios/web/web_state/js/crw_js_invoke_parameter_queue.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698