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