Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into glenn/real-path
Browse files Browse the repository at this point in the history
  • Loading branch information
gruehle committed Nov 22, 2013
2 parents d8899b1 + 59006d5 commit 28fed72
Show file tree
Hide file tree
Showing 4 changed files with 551 additions and 77 deletions.
6 changes: 5 additions & 1 deletion appshell.gyp
@@ -1,4 +1,4 @@
# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.

Expand Down Expand Up @@ -204,6 +204,8 @@
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
'$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
'$(SDKROOT)/System/Library/Frameworks/ScriptingBridge.framework',
'$(CONFIGURATION)/libcef.dylib',
],
},
Expand Down Expand Up @@ -359,6 +361,8 @@
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
'$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
'$(SDKROOT)/System/Library/Frameworks/ScriptingBridge.framework',
'$(CONFIGURATION)/libcef.dylib',
],
},
Expand Down
191 changes: 191 additions & 0 deletions appshell/GoogleChrome.h
@@ -0,0 +1,191 @@
/*
* GoogleChrome.h
*/

#import <AppKit/AppKit.h>
#import <ScriptingBridge/ScriptingBridge.h>


@class GoogleChromeApplication, GoogleChromeWindow, GoogleChromeTab, GoogleChromeBookmarkFolder, GoogleChromeBookmarkItem;



/*
* Standard Suite
*/

// The application's top-level scripting object.
@interface GoogleChromeApplication : 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 GoogleChromeWindow : 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) GoogleChromeTab *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 GoogleChromeApplication (ChromiumSuite)

- (SBElementArray *) bookmarkFolders;

@property (copy, readonly) GoogleChromeBookmarkFolder *bookmarksBar; // The bookmarks bar bookmark folder.
@property (copy, readonly) GoogleChromeBookmarkFolder *otherBookmarks; // The other bookmarks bookmark folder.

@end

// A tab.
@interface GoogleChromeTab : 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 GoogleChromeBookmarkFolder : 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 GoogleChromeBookmarkItem : 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 GoogleChromeWindow (ChromiumSuite)

@property (readonly) BOOL presenting; // Whether the window is in presentation mode.

@end

0 comments on commit 28fed72

Please sign in to comment.