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/tab_applescript.h" | 5 #import "chrome/browser/ui/cocoa/applescript/tab_applescript.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #import "base/memory/scoped_nsobject.h" | 9 #import "base/memory/scoped_nsobject.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 | 113 |
114 NavigationEntry* entry = tabContents_->controller().GetActiveEntry(); | 114 NavigationEntry* entry = tabContents_->controller().GetActiveEntry(); |
115 if (!entry) | 115 if (!entry) |
116 return; | 116 return; |
117 | 117 |
118 const GURL& previousURL = entry->virtual_url(); | 118 const GURL& previousURL = entry->virtual_url(); |
119 tabContents_->tab_contents()->OpenURL(url, | 119 tabContents_->tab_contents()->OpenURL(url, |
120 previousURL, | 120 previousURL, |
121 CURRENT_TAB, | 121 CURRENT_TAB, |
122 PageTransition::TYPED); | 122 content::PAGE_TRANSITION_TYPED); |
123 } | 123 } |
124 | 124 |
125 - (NSString*)title { | 125 - (NSString*)title { |
126 NavigationEntry* entry = tabContents_->controller().GetActiveEntry(); | 126 NavigationEntry* entry = tabContents_->controller().GetActiveEntry(); |
127 if (!entry) | 127 if (!entry) |
128 return nil; | 128 return nil; |
129 | 129 |
130 std::wstring title; | 130 std::wstring title; |
131 if (entry != NULL) { | 131 if (entry != NULL) { |
132 title = UTF16ToWideHack(entry->title()); | 132 title = UTF16ToWideHack(entry->title()); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 } | 281 } |
282 | 282 |
283 - (void)handlesViewSourceScriptCommand:(NSScriptCommand*)command { | 283 - (void)handlesViewSourceScriptCommand:(NSScriptCommand*)command { |
284 NavigationEntry* entry = tabContents_->controller().GetLastCommittedEntry(); | 284 NavigationEntry* entry = tabContents_->controller().GetLastCommittedEntry(); |
285 if (entry) { | 285 if (entry) { |
286 tabContents_->tab_contents()->OpenURL( | 286 tabContents_->tab_contents()->OpenURL( |
287 GURL(chrome::kViewSourceScheme + std::string(":") + | 287 GURL(chrome::kViewSourceScheme + std::string(":") + |
288 entry->url().spec()), | 288 entry->url().spec()), |
289 GURL(), | 289 GURL(), |
290 NEW_FOREGROUND_TAB, | 290 NEW_FOREGROUND_TAB, |
291 PageTransition::LINK); | 291 content::PAGE_TRANSITION_LINK); |
292 } | 292 } |
293 } | 293 } |
294 | 294 |
295 - (id)handlesExecuteJavascriptScriptCommand:(NSScriptCommand*)command { | 295 - (id)handlesExecuteJavascriptScriptCommand:(NSScriptCommand*)command { |
296 RenderViewHost* view = tabContents_->render_view_host(); | 296 RenderViewHost* view = tabContents_->render_view_host(); |
297 if (!view) { | 297 if (!view) { |
298 NOTREACHED(); | 298 NOTREACHED(); |
299 return nil; | 299 return nil; |
300 } | 300 } |
301 | 301 |
302 string16 script = base::SysNSStringToUTF16( | 302 string16 script = base::SysNSStringToUTF16( |
303 [[command evaluatedArguments] objectForKey:@"javascript"]); | 303 [[command evaluatedArguments] objectForKey:@"javascript"]); |
304 view->ExecuteJavascriptInWebFrame(string16(), script); | 304 view->ExecuteJavascriptInWebFrame(string16(), script); |
305 | 305 |
306 // TODO(Shreyas): Figure out a way to get the response back. | 306 // TODO(Shreyas): Figure out a way to get the response back. |
307 return nil; | 307 return nil; |
308 } | 308 } |
309 | 309 |
310 @end | 310 @end |
OLD | NEW |