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