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 "base/logging.h" | 7 #include "base/logging.h" |
8 #import "base/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // This method gets called when a new tab is created so | 172 // This method gets called when a new tab is created so |
173 // the container and property are set here. | 173 // the container and property are set here. |
174 [aTab setContainer:self | 174 [aTab setContainer:self |
175 property:AppleScript::kTabsProperty]; | 175 property:AppleScript::kTabsProperty]; |
176 | 176 |
177 // Set how long it takes a tab to be created. | 177 // Set how long it takes a tab to be created. |
178 base::TimeTicks newTabStartTime = base::TimeTicks::Now(); | 178 base::TimeTicks newTabStartTime = base::TimeTicks::Now(); |
179 content::WebContents* contents = chrome::AddSelectedTabWithURL( | 179 content::WebContents* contents = chrome::AddSelectedTabWithURL( |
180 browser_, | 180 browser_, |
181 GURL(chrome::kChromeUINewTabURL), | 181 GURL(chrome::kChromeUINewTabURL), |
182 content::PAGE_TRANSITION_TYPED); | 182 ui::PAGE_TRANSITION_TYPED); |
183 CoreTabHelper* core_tab_helper = CoreTabHelper::FromWebContents(contents); | 183 CoreTabHelper* core_tab_helper = CoreTabHelper::FromWebContents(contents); |
184 core_tab_helper->set_new_tab_start_time(newTabStartTime); | 184 core_tab_helper->set_new_tab_start_time(newTabStartTime); |
185 [aTab setWebContents:contents]; | 185 [aTab setWebContents:contents]; |
186 } | 186 } |
187 | 187 |
188 - (void)insertInTabs:(TabAppleScript*)aTab atIndex:(int)index { | 188 - (void)insertInTabs:(TabAppleScript*)aTab atIndex:(int)index { |
189 // This method gets called when a new tab is created so | 189 // This method gets called when a new tab is created so |
190 // the container and property are set here. | 190 // the container and property are set here. |
191 [aTab setContainer:self | 191 [aTab setContainer:self |
192 property:AppleScript::kTabsProperty]; | 192 property:AppleScript::kTabsProperty]; |
193 | 193 |
194 // Set how long it takes a tab to be created. | 194 // Set how long it takes a tab to be created. |
195 base::TimeTicks newTabStartTime = base::TimeTicks::Now(); | 195 base::TimeTicks newTabStartTime = base::TimeTicks::Now(); |
196 chrome::NavigateParams params(browser_, GURL(chrome::kChromeUINewTabURL), | 196 chrome::NavigateParams params(browser_, GURL(chrome::kChromeUINewTabURL), |
197 content::PAGE_TRANSITION_TYPED); | 197 ui::PAGE_TRANSITION_TYPED); |
198 params.disposition = NEW_FOREGROUND_TAB; | 198 params.disposition = NEW_FOREGROUND_TAB; |
199 params.tabstrip_index = index; | 199 params.tabstrip_index = index; |
200 chrome::Navigate(¶ms); | 200 chrome::Navigate(¶ms); |
201 CoreTabHelper* core_tab_helper = | 201 CoreTabHelper* core_tab_helper = |
202 CoreTabHelper::FromWebContents(params.target_contents); | 202 CoreTabHelper::FromWebContents(params.target_contents); |
203 core_tab_helper->set_new_tab_start_time(newTabStartTime); | 203 core_tab_helper->set_new_tab_start_time(newTabStartTime); |
204 | 204 |
205 [aTab setWebContents:params.target_contents]; | 205 [aTab setWebContents:params.target_contents]; |
206 } | 206 } |
207 | 207 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 GURL(), FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION); | 265 GURL(), FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 - (void)handlesExitPresentationMode:(NSScriptCommand*)command { | 269 - (void)handlesExitPresentationMode:(NSScriptCommand*)command { |
270 if (browser_->window()) | 270 if (browser_->window()) |
271 browser_->window()->ExitFullscreen(); | 271 browser_->window()->ExitFullscreen(); |
272 } | 272 } |
273 | 273 |
274 @end | 274 @end |
OLD | NEW |