| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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/scoped_nsobject.h" | 8 #import "base/scoped_nsobject.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 base::TimeTicks newTabStartTime = base::TimeTicks::Now(); | 173 base::TimeTicks newTabStartTime = base::TimeTicks::Now(); |
| 174 TabContentsWrapper* contents = | 174 TabContentsWrapper* contents = |
| 175 browser_->AddSelectedTabWithURL(GURL(chrome::kChromeUINewTabURL), | 175 browser_->AddSelectedTabWithURL(GURL(chrome::kChromeUINewTabURL), |
| 176 PageTransition::TYPED); | 176 PageTransition::TYPED); |
| 177 contents->tab_contents()->set_new_tab_start_time(newTabStartTime); | 177 contents->tab_contents()->set_new_tab_start_time(newTabStartTime); |
| 178 [aTab setTabContent:contents->tab_contents()]; | 178 [aTab setTabContent:contents->tab_contents()]; |
| 179 } | 179 } |
| 180 | 180 |
| 181 - (void)insertInTabs:(TabAppleScript*)aTab atIndex:(int)index { | 181 - (void)insertInTabs:(TabAppleScript*)aTab atIndex:(int)index { |
| 182 // This method gets called when a new tab is created so | 182 // This method gets called when a new tab is created so |
| 183 // This method gets called when a new tab is created so | |
| 184 // the container and property are set here. | 183 // the container and property are set here. |
| 185 [aTab setContainer:self | 184 [aTab setContainer:self |
| 186 property:AppleScript::kTabsProperty]; | 185 property:AppleScript::kTabsProperty]; |
| 187 | 186 |
| 188 // Set how long it takes a tab to be created. | 187 // Set how long it takes a tab to be created. |
| 189 base::TimeTicks newTabStartTime = base::TimeTicks::Now(); | 188 base::TimeTicks newTabStartTime = base::TimeTicks::Now(); |
| 190 browser::NavigateParams params(browser_, | 189 browser::NavigateParams params(browser_, |
| 191 GURL(chrome::kChromeUINewTabURL), | 190 GURL(chrome::kChromeUINewTabURL), |
| 192 PageTransition::TYPED); | 191 PageTransition::TYPED); |
| 193 params.disposition = NEW_FOREGROUND_TAB; | 192 params.disposition = NEW_FOREGROUND_TAB; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 [[self nativeHandle] setValue:(id)value forKey:key]; | 236 [[self nativeHandle] setValue:(id)value forKey:key]; |
| 238 } | 237 } |
| 239 | 238 |
| 240 - (void)handlesCloseScriptCommand:(NSCloseCommand*)command { | 239 - (void)handlesCloseScriptCommand:(NSCloseCommand*)command { |
| 241 // window() can be NULL during startup. | 240 // window() can be NULL during startup. |
| 242 if (browser_->window()) | 241 if (browser_->window()) |
| 243 browser_->window()->Close(); | 242 browser_->window()->Close(); |
| 244 } | 243 } |
| 245 | 244 |
| 246 @end | 245 @end |
| OLD | NEW |