Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Side by Side Diff: chrome/browser/ui/cocoa/applescript/window_applescript.mm

Issue 10534093: TabContentsWrapper -> TabContents, part 37. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h" 5 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/memory/scoped_nsobject.h" 8 #import "base/memory/scoped_nsobject.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #import "chrome/browser/app_controller_mac.h" 11 #import "chrome/browser/app_controller_mac.h"
12 #import "chrome/browser/chrome_browser_application_mac.h" 12 #import "chrome/browser/chrome_browser_application_mac.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_list.h" 15 #include "chrome/browser/ui/browser_list.h"
16 #include "chrome/browser/ui/browser_navigator.h" 16 #include "chrome/browser/ui/browser_navigator.h"
17 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/cocoa/applescript/constants_applescript.h" 18 #include "chrome/browser/ui/cocoa/applescript/constants_applescript.h"
19 #include "chrome/browser/ui/cocoa/applescript/error_applescript.h" 19 #include "chrome/browser/ui/cocoa/applescript/error_applescript.h"
20 #import "chrome/browser/ui/cocoa/applescript/tab_applescript.h" 20 #import "chrome/browser/ui/cocoa/applescript/tab_applescript.h"
21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 21 #include "chrome/browser/ui/tab_contents/tab_contents.h"
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" 22 #include "chrome/browser/ui/tabs/tab_strip_model.h"
23 #include "chrome/common/url_constants.h" 23 #include "chrome/common/url_constants.h"
24 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
25 25
26 @interface WindowAppleScript(WindowAppleScriptPrivateMethods) 26 @interface WindowAppleScript(WindowAppleScriptPrivateMethods)
27 // The NSWindow that corresponds to this window. 27 // The NSWindow that corresponds to this window.
28 - (NSWindow*)nativeHandle; 28 - (NSWindow*)nativeHandle;
29 @end 29 @end
30 30
31 @implementation WindowAppleScript 31 @implementation WindowAppleScript
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 - (void)setMode:(NSString*)theMode { 131 - (void)setMode:(NSString*)theMode {
132 // cannot set mode after window is created. 132 // cannot set mode after window is created.
133 if (theMode) { 133 if (theMode) {
134 AppleScript::SetError(AppleScript::errSetMode); 134 AppleScript::SetError(AppleScript::errSetMode);
135 } 135 }
136 } 136 }
137 137
138 - (TabAppleScript*)activeTab { 138 - (TabAppleScript*)activeTab {
139 TabAppleScript* currentTab = 139 TabAppleScript* currentTab =
140 [[[TabAppleScript alloc] 140 [[[TabAppleScript alloc]
141 initWithTabContent:browser_->GetSelectedTabContentsWrapper()] 141 initWithTabContent:browser_->GetActiveTabContents()]
142 autorelease]; 142 autorelease];
143 [currentTab setContainer:self 143 [currentTab setContainer:self
144 property:AppleScript::kTabsProperty]; 144 property:AppleScript::kTabsProperty];
145 return currentTab; 145 return currentTab;
146 } 146 }
147 147
148 - (NSArray*)tabs { 148 - (NSArray*)tabs {
149 NSMutableArray* tabs = [NSMutableArray 149 NSMutableArray* tabs = [NSMutableArray
150 arrayWithCapacity:browser_->tab_count()]; 150 arrayWithCapacity:browser_->tab_count()];
151 151
152 for (int i = 0; i < browser_->tab_count(); ++i) { 152 for (int i = 0; i < browser_->tab_count(); ++i) {
153 // Check to see if tab is closing. 153 // Check to see if tab is closing.
154 TabContentsWrapper* tab_contents = browser_->GetTabContentsWrapperAt(i); 154 TabContents* tab_contents = browser_->GetTabContentsAt(i);
155 if (tab_contents->in_destructor()) { 155 if (tab_contents->in_destructor()) {
156 continue; 156 continue;
157 } 157 }
158 158
159 scoped_nsobject<TabAppleScript> tab( 159 scoped_nsobject<TabAppleScript> tab(
160 [[TabAppleScript alloc] initWithTabContent:tab_contents]); 160 [[TabAppleScript alloc] initWithTabContent:tab_contents]);
161 [tab setContainer:self 161 [tab setContainer:self
162 property:AppleScript::kTabsProperty]; 162 property:AppleScript::kTabsProperty];
163 [tabs addObject:tab]; 163 [tabs addObject:tab];
164 } 164 }
165 return tabs; 165 return tabs;
166 } 166 }
167 167
168 - (void)insertInTabs:(TabAppleScript*)aTab { 168 - (void)insertInTabs:(TabAppleScript*)aTab {
169 // This method gets called when a new tab is created so 169 // This method gets called when a new tab is created so
170 // the container and property are set here. 170 // the container and property are set here.
171 [aTab setContainer:self 171 [aTab setContainer:self
172 property:AppleScript::kTabsProperty]; 172 property:AppleScript::kTabsProperty];
173 173
174 // Set how long it takes a tab to be created. 174 // Set how long it takes a tab to be created.
175 base::TimeTicks newTabStartTime = base::TimeTicks::Now(); 175 base::TimeTicks newTabStartTime = base::TimeTicks::Now();
176 TabContentsWrapper* contents = 176 TabContents* contents =
177 browser_->AddSelectedTabWithURL(GURL(chrome::kChromeUINewTabURL), 177 browser_->AddSelectedTabWithURL(GURL(chrome::kChromeUINewTabURL),
178 content::PAGE_TRANSITION_TYPED); 178 content::PAGE_TRANSITION_TYPED);
179 contents->web_contents()->SetNewTabStartTime(newTabStartTime); 179 contents->web_contents()->SetNewTabStartTime(newTabStartTime);
180 [aTab setTabContent:contents]; 180 [aTab setTabContent:contents];
181 } 181 }
182 182
183 - (void)insertInTabs:(TabAppleScript*)aTab atIndex:(int)index { 183 - (void)insertInTabs:(TabAppleScript*)aTab atIndex:(int)index {
184 // This method gets called when a new tab is created so 184 // This method gets called when a new tab is created so
185 // the container and property are set here. 185 // the container and property are set here.
186 [aTab setContainer:self 186 [aTab setContainer:self
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 GURL(), FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION); 257 GURL(), FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION);
258 } 258 }
259 } 259 }
260 260
261 - (void)handlesExitPresentationMode:(NSScriptCommand*)command { 261 - (void)handlesExitPresentationMode:(NSScriptCommand*)command {
262 if (browser_->window()) 262 if (browser_->window())
263 browser_->window()->ExitPresentationMode(); 263 browser_->window()->ExitPresentationMode();
264 } 264 }
265 265
266 @end 266 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/applescript/tab_applescript.mm ('k') | chrome/browser/ui/cocoa/base_bubble_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698