| OLD | NEW |
| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 - (void)insertInTabs:(TabAppleScript*)aTab atIndex:(int)index { | 193 - (void)insertInTabs:(TabAppleScript*)aTab atIndex:(int)index { |
| 194 // This method gets called when a new tab is created so | 194 // This method gets called when a new tab is created so |
| 195 // the container and property are set here. | 195 // the container and property are set here. |
| 196 [aTab setContainer:self | 196 [aTab setContainer:self |
| 197 property:AppleScript::kTabsProperty]; | 197 property:AppleScript::kTabsProperty]; |
| 198 | 198 |
| 199 // Set how long it takes a tab to be created. | 199 // Set how long it takes a tab to be created. |
| 200 base::TimeTicks newTabStartTime = base::TimeTicks::Now(); | 200 base::TimeTicks newTabStartTime = base::TimeTicks::Now(); |
| 201 chrome::NavigateParams params(browser_, GURL(chrome::kChromeUINewTabURL), | 201 chrome::NavigateParams params(browser_, GURL(chrome::kChromeUINewTabURL), |
| 202 ui::PAGE_TRANSITION_TYPED); | 202 ui::PAGE_TRANSITION_TYPED); |
| 203 params.disposition = NEW_FOREGROUND_TAB; | 203 params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; |
| 204 params.tabstrip_index = index; | 204 params.tabstrip_index = index; |
| 205 chrome::Navigate(¶ms); | 205 chrome::Navigate(¶ms); |
| 206 CoreTabHelper* core_tab_helper = | 206 CoreTabHelper* core_tab_helper = |
| 207 CoreTabHelper::FromWebContents(params.target_contents); | 207 CoreTabHelper::FromWebContents(params.target_contents); |
| 208 core_tab_helper->set_new_tab_start_time(newTabStartTime); | 208 core_tab_helper->set_new_tab_start_time(newTabStartTime); |
| 209 | 209 |
| 210 [aTab setWebContents:params.target_contents]; | 210 [aTab setWebContents:params.target_contents]; |
| 211 } | 211 } |
| 212 | 212 |
| 213 - (void)removeFromTabsAtIndex:(int)index { | 213 - (void)removeFromTabsAtIndex:(int)index { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 - (void)handlesCloseScriptCommand:(NSCloseCommand*)command { | 254 - (void)handlesCloseScriptCommand:(NSCloseCommand*)command { |
| 255 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::WINDOW_CLOSE); | 255 AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::WINDOW_CLOSE); |
| 256 | 256 |
| 257 // window() can be NULL during startup. | 257 // window() can be NULL during startup. |
| 258 if (browser_->window()) | 258 if (browser_->window()) |
| 259 browser_->window()->Close(); | 259 browser_->window()->Close(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 @end | 262 @end |
| OLD | NEW |