1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_COCOA_APPLESCRIPT_TAB_APPLESCRIPT_H_ 6 #define CHROME_BROWSER_UI_COCOA_APPLESCRIPT_TAB_APPLESCRIPT_H_ 7 8 #import <Cocoa/Cocoa.h> 9 10 #import "chrome/browser/ui/cocoa/applescript/element_applescript.h" 11 12 namespace content { 13 class WebContents; 14 } 15 16 // Represents a tab scriptable item in applescript. 17 @interface TabAppleScript : ElementAppleScript { 18 @private 19 content::WebContents* webContents_; // weak. 20 // Contains the temporary URL when a user creates a new folder/item with 21 // url specified like 22 // |make new tab with properties {url:"http://google.com"}|. 23 NSString* tempURL_; 24 } 25 26 // Doesn't actually create the tab here but just assigns the ID, tab is created 27 // when it calls insertInTabs: of a particular window, it is used in cases 28 // where user assigns a tab to a variable like |set var to make new tab|. 29 - (id)init; 30 31 // Does not create a new tab but uses an existing one. 32 - (id)initWithWebContents:(content::WebContents*)webContents; 33 34 // Assigns a tab, sets its unique ID and also copies temporary values. 35 - (void)setWebContents:(content::WebContents*)webContents; 36 37 // Return the URL currently visible to the user in the location bar. 38 - (NSString*)URL; 39 40 // Sets the URL, returns an error if it is invalid. 41 - (void)setURL:(NSString*)aURL; 42 43 // The title of the tab. 44 - (NSString*)title; 45 46 // Is the tab loading any resource? 47 - (NSNumber*)loading; 48 49 // Standard user commands. 50 - (void)handlesUndoScriptCommand:(NSScriptCommand*)command; 51 - (void)handlesRedoScriptCommand:(NSScriptCommand*)command; 52 53 // Edit operations on the page. 54 - (void)handlesCutScriptCommand:(NSScriptCommand*)command; 55 - (void)handlesCopyScriptCommand:(NSScriptCommand*)command; 56 - (void)handlesPasteScriptCommand:(NSScriptCommand*)command; 57 58 // Selects all contents on the page. 59 - (void)handlesSelectAllScriptCommand:(NSScriptCommand*)command; 60 61 // Navigation operations. 62 - (void)handlesGoBackScriptCommand:(NSScriptCommand*)command; 63 - (void)handlesGoForwardScriptCommand:(NSScriptCommand*)command; 64 - (void)handlesReloadScriptCommand:(NSScriptCommand*)command; 65 - (void)handlesStopScriptCommand:(NSScriptCommand*)command; 66 67 // Used to print a tab. 68 - (void)handlesPrintScriptCommand:(NSScriptCommand*)command; 69 70 // Used to save a tab, if no file is specified, prompts the user to enter it. 71 - (void)handlesSaveScriptCommand:(NSScriptCommand*)command; 72 73 // Used to close a tab. 74 - (void)handlesCloseScriptCommand:(NSScriptCommand*)command; 75 76 // Displays the HTML of the tab in a new tab. 77 - (void)handlesViewSourceScriptCommand:(NSScriptCommand*)command; 78 79 // Executes a piece of javascript in the tab. 80 - (id)handlesExecuteJavascriptScriptCommand:(NSScriptCommand*)command; 81 82 @end 83 84 #endif // CHROME_BROWSER_UI_COCOA_APPLESCRIPT_TAB_APPLESCRIPT_H_ 85