OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 TabContentsWrapper* contents = |
177 browser_->AddSelectedTabWithURL(GURL(chrome::kChromeUINewTabURL), | 177 browser_->AddSelectedTabWithURL(GURL(chrome::kChromeUINewTabURL), |
178 PageTransition::TYPED); | 178 content::PAGE_TRANSITION_TYPED); |
179 contents->tab_contents()->set_new_tab_start_time(newTabStartTime); | 179 contents->tab_contents()->set_new_tab_start_time(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 |
187 property:AppleScript::kTabsProperty]; | 187 property:AppleScript::kTabsProperty]; |
188 | 188 |
189 // Set how long it takes a tab to be created. | 189 // Set how long it takes a tab to be created. |
190 base::TimeTicks newTabStartTime = base::TimeTicks::Now(); | 190 base::TimeTicks newTabStartTime = base::TimeTicks::Now(); |
191 browser::NavigateParams params(browser_, | 191 browser::NavigateParams params(browser_, |
192 GURL(chrome::kChromeUINewTabURL), | 192 GURL(chrome::kChromeUINewTabURL), |
193 PageTransition::TYPED); | 193 content::PAGE_TRANSITION_TYPED); |
194 params.disposition = NEW_FOREGROUND_TAB; | 194 params.disposition = NEW_FOREGROUND_TAB; |
195 params.tabstrip_index = index; | 195 params.tabstrip_index = index; |
196 browser::Navigate(¶ms); | 196 browser::Navigate(¶ms); |
197 params.target_contents->tab_contents()->set_new_tab_start_time( | 197 params.target_contents->tab_contents()->set_new_tab_start_time( |
198 newTabStartTime); | 198 newTabStartTime); |
199 | 199 |
200 [aTab setTabContent:params.target_contents]; | 200 [aTab setTabContent:params.target_contents]; |
201 } | 201 } |
202 | 202 |
203 - (void)removeFromTabsAtIndex:(int)index { | 203 - (void)removeFromTabsAtIndex:(int)index { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 [[self nativeHandle] setValue:(id)value forKey:key]; | 238 [[self nativeHandle] setValue:(id)value forKey:key]; |
239 } | 239 } |
240 | 240 |
241 - (void)handlesCloseScriptCommand:(NSCloseCommand*)command { | 241 - (void)handlesCloseScriptCommand:(NSCloseCommand*)command { |
242 // window() can be NULL during startup. | 242 // window() can be NULL during startup. |
243 if (browser_->window()) | 243 if (browser_->window()) |
244 browser_->window()->Close(); | 244 browser_->window()->Close(); |
245 } | 245 } |
246 | 246 |
247 @end | 247 @end |
OLD | NEW |