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.
5 #ifndef CHROME_BROWSER_UI_COCOA_APPLESCRIPT_TAB_APPLESCRIPT_H_
6 #define CHROME_BROWSER_UI_COCOA_APPLESCRIPT_TAB_APPLESCRIPT_H_
8 #import <Cocoa/Cocoa.h>
10 #import "chrome/browser/ui/cocoa/applescript/element_applescript.h"
16 // Represents a tab scriptable item in applescript.
17 @interface TabAppleScript
: ElementAppleScript
{
19 content::WebContents
* webContents_
; // weak.
20 // Contains the temporary URL when a user creates a new folder/item with
22 // |make new tab with properties {url:"http://google.com"}|.
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|.
31 // Does not create a new tab but uses an existing one.
32 - (id
)initWithWebContents
:(content::WebContents
*)webContents
;
34 // Assigns a tab, sets its unique ID and also copies temporary values.
35 - (void)setWebContents
:(content::WebContents
*)webContents
;
37 // Return the URL currently visible to the user in the location bar.
40 // Sets the URL, returns an error if it is invalid.
41 - (void)setURL
:(NSString
*)aURL
;
43 // The title of the tab.
46 // Is the tab loading any resource?
49 // Standard user commands.
50 - (void)handlesUndoScriptCommand
:(NSScriptCommand
*)command
;
51 - (void)handlesRedoScriptCommand
:(NSScriptCommand
*)command
;
53 // Edit operations on the page.
54 - (void)handlesCutScriptCommand
:(NSScriptCommand
*)command
;
55 - (void)handlesCopyScriptCommand
:(NSScriptCommand
*)command
;
56 - (void)handlesPasteScriptCommand
:(NSScriptCommand
*)command
;
58 // Selects all contents on the page.
59 - (void)handlesSelectAllScriptCommand
:(NSScriptCommand
*)command
;
61 // Navigation operations.
62 - (void)handlesGoBackScriptCommand
:(NSScriptCommand
*)command
;
63 - (void)handlesGoForwardScriptCommand
:(NSScriptCommand
*)command
;
64 - (void)handlesReloadScriptCommand
:(NSScriptCommand
*)command
;
65 - (void)handlesStopScriptCommand
:(NSScriptCommand
*)command
;
67 // Used to print a tab.
68 - (void)handlesPrintScriptCommand
:(NSScriptCommand
*)command
;
70 // Used to save a tab, if no file is specified, prompts the user to enter it.
71 - (void)handlesSaveScriptCommand
:(NSScriptCommand
*)command
;
73 // Used to close a tab.
74 - (void)handlesCloseScriptCommand
:(NSScriptCommand
*)command
;
76 // Displays the HTML of the tab in a new tab.
77 - (void)handlesViewSourceScriptCommand
:(NSScriptCommand
*)command
;
79 // Executes a piece of javascript in the tab.
80 - (id
)handlesExecuteJavascriptScriptCommand
:(NSScriptCommand
*)command
;
84 #endif // CHROME_BROWSER_UI_COCOA_APPLESCRIPT_TAB_APPLESCRIPT_H_