This repository has been archived by the owner on Jan 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Chrome.h
191 lines (151 loc) · 7.93 KB
/
Chrome.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*
* Chrome.h
*/
#import <AppKit/AppKit.h>
#import <ScriptingBridge/ScriptingBridge.h>
@class ChromeApplication, ChromeWindow, ChromeTab, ChromeBookmarkFolder, ChromeBookmarkItem;
/*
* Standard Suite
*/
// The application's top-level scripting object.
@interface ChromeApplication : SBApplication
- (SBElementArray *) windows;
@property (copy, readonly) NSString *name; // The name of the application.
@property (readonly) BOOL frontmost; // Is this the frontmost (active) application?
@property (copy, readonly) NSString *version; // The version of the application.
- (void) open:(NSArray *)x; // Open a document.
- (void) quit; // Quit the application.
- (BOOL) exists:(id)x; // Verify if an object exists.
@end
// A window.
@interface ChromeWindow : SBObject
- (SBElementArray *) tabs;
@property (copy, readonly) NSString *name; // The full title of the window.
- (NSInteger) id; // The unique identifier of the window.
@property NSInteger index; // The index of the window, ordered front to back.
@property NSRect bounds; // The bounding rectangle of the window.
@property (readonly) BOOL closeable; // Whether the window has a close box.
@property (readonly) BOOL minimizable; // Whether the window can be minimized.
@property BOOL minimized; // Whether the window is currently minimized.
@property (readonly) BOOL resizable; // Whether the window can be resized.
@property BOOL visible; // Whether the window is currently visible.
@property (readonly) BOOL zoomable; // Whether the window can be zoomed.
@property BOOL zoomed; // Whether the window is currently zoomed.
@property (copy, readonly) ChromeTab *activeTab; // Returns the currently selected tab
@property (copy) NSString *mode; // Represents the mode of the window which can be 'normal' or 'incognito', can be set only once during creation of the window.
@property NSInteger activeTabIndex; // The index of the active tab.
- (void) saveIn:(NSURL *)in_ as:(NSString *)as; // Save an object.
- (void) close; // Close a window.
- (void) delete; // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties; // Copy object(s) and put the copies at a new location.
- (SBObject *) moveTo:(SBObject *)to; // Move object(s) to a new location.
- (void) print; // Print an object.
- (void) reload; // Reload a tab.
- (void) goBack; // Go Back (If Possible).
- (void) goForward; // Go Forward (If Possible).
- (void) selectAll; // Select all.
- (void) cutSelection; // Cut selected text (If Possible).
- (void) copySelection; // Copy text.
- (void) pasteSelection; // Paste text (If Possible).
- (void) undo; // Undo the last change.
- (void) redo; // Redo the last change.
- (void) stop; // Stop the current tab from loading.
- (void) viewSource; // View the HTML source of the tab.
- (id) executeJavascript:(NSString *)javascript; // Execute a piece of javascript.
- (void) enterPresentationMode; // Enter presentation mode in window.
- (void) exitPresentationMode; // Exit presentation mode in window.
@end
/*
* Chromium Suite
*/
// The application's top-level scripting object.
@interface ChromeApplication (ChromiumSuite)
- (SBElementArray *) bookmarkFolders;
@property (copy, readonly) ChromeBookmarkFolder *bookmarksBar; // The bookmarks bar bookmark folder.
@property (copy, readonly) ChromeBookmarkFolder *otherBookmarks; // The other bookmarks bookmark folder.
@end
// A tab.
@interface ChromeTab : SBObject
- (NSInteger) id; // Unique ID of the tab.
@property (copy, readonly) NSString *title; // The title of the tab.
@property (copy) NSString *URL; // The url visible to the user.
@property (readonly) BOOL loading; // Is loading?
- (void) saveIn:(NSURL *)in_ as:(NSString *)as; // Save an object.
- (void) close; // Close a window.
- (void) delete; // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties; // Copy object(s) and put the copies at a new location.
- (SBObject *) moveTo:(SBObject *)to; // Move object(s) to a new location.
- (void) print; // Print an object.
- (void) reload; // Reload a tab.
- (void) goBack; // Go Back (If Possible).
- (void) goForward; // Go Forward (If Possible).
- (void) selectAll; // Select all.
- (void) cutSelection; // Cut selected text (If Possible).
- (void) copySelection; // Copy text.
- (void) pasteSelection; // Paste text (If Possible).
- (void) undo; // Undo the last change.
- (void) redo; // Redo the last change.
- (void) stop; // Stop the current tab from loading.
- (void) viewSource; // View the HTML source of the tab.
- (id) executeJavascript:(NSString *)javascript; // Execute a piece of javascript.
- (void) enterPresentationMode; // Enter presentation mode in window.
- (void) exitPresentationMode; // Exit presentation mode in window.
@end
// A bookmarks folder that contains other bookmarks folder and bookmark items.
@interface ChromeBookmarkFolder : SBObject
- (SBElementArray *) bookmarkFolders;
- (SBElementArray *) bookmarkItems;
- (NSNumber *) id; // Unique ID of the bookmark folder.
@property (copy) NSString *title; // The title of the folder.
@property (copy, readonly) NSNumber *index; // Returns the index with respect to its parent bookmark folder
- (void) saveIn:(NSURL *)in_ as:(NSString *)as; // Save an object.
- (void) close; // Close a window.
- (void) delete; // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties; // Copy object(s) and put the copies at a new location.
- (SBObject *) moveTo:(SBObject *)to; // Move object(s) to a new location.
- (void) print; // Print an object.
- (void) reload; // Reload a tab.
- (void) goBack; // Go Back (If Possible).
- (void) goForward; // Go Forward (If Possible).
- (void) selectAll; // Select all.
- (void) cutSelection; // Cut selected text (If Possible).
- (void) copySelection; // Copy text.
- (void) pasteSelection; // Paste text (If Possible).
- (void) undo; // Undo the last change.
- (void) redo; // Redo the last change.
- (void) stop; // Stop the current tab from loading.
- (void) viewSource; // View the HTML source of the tab.
- (id) executeJavascript:(NSString *)javascript; // Execute a piece of javascript.
- (void) enterPresentationMode; // Enter presentation mode in window.
- (void) exitPresentationMode; // Exit presentation mode in window.
@end
// An item consists of an URL and the title of a bookmark
@interface ChromeBookmarkItem : SBObject
- (NSInteger) id; // Unique ID of the bookmark item.
@property (copy) NSString *title; // The title of the bookmark item.
@property (copy) NSString *URL; // The URL of the bookmark.
@property (copy, readonly) NSNumber *index; // Returns the index with respect to its parent bookmark folder
- (void) saveIn:(NSURL *)in_ as:(NSString *)as; // Save an object.
- (void) close; // Close a window.
- (void) delete; // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties; // Copy object(s) and put the copies at a new location.
- (SBObject *) moveTo:(SBObject *)to; // Move object(s) to a new location.
- (void) print; // Print an object.
- (void) reload; // Reload a tab.
- (void) goBack; // Go Back (If Possible).
- (void) goForward; // Go Forward (If Possible).
- (void) selectAll; // Select all.
- (void) cutSelection; // Cut selected text (If Possible).
- (void) copySelection; // Copy text.
- (void) pasteSelection; // Paste text (If Possible).
- (void) undo; // Undo the last change.
- (void) redo; // Redo the last change.
- (void) stop; // Stop the current tab from loading.
- (void) viewSource; // View the HTML source of the tab.
- (id) executeJavascript:(NSString *)javascript; // Execute a piece of javascript.
- (void) enterPresentationMode; // Enter presentation mode in window.
- (void) exitPresentationMode; // Exit presentation mode in window.
@end
@interface ChromeWindow (ChromiumSuite)
@property (readonly) BOOL presenting; // Whether the window is in presentation mode.
@end