Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: chrome/browser/cocoa/applescript/tab_applescript.mm

Issue 3180006: Cleaned up the SDEF... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/cocoa/applescript/tab_applescript.h" 5 #import "chrome/browser/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/scoped_nsobject.h" 9 #import "base/scoped_nsobject.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 11 matching lines...) Expand all
22 @interface TabAppleScript() 22 @interface TabAppleScript()
23 @property (nonatomic, copy) NSString* tempURL; 23 @property (nonatomic, copy) NSString* tempURL;
24 @end 24 @end
25 25
26 @implementation TabAppleScript 26 @implementation TabAppleScript
27 27
28 @synthesize tempURL = tempURL_; 28 @synthesize tempURL = tempURL_;
29 29
30 - (id)init { 30 - (id)init {
31 if ((self = [super init])) { 31 if ((self = [super init])) {
32 SessionID session;
33 SessionID::id_type futureSessionIDOfTab = session.id() + 1;
34 // Holds the SessionID that the new tab is going to get.
35 scoped_nsobject<NSNumber> numID(
36 [[NSNumber alloc]
37 initWithInt:futureSessionIDOfTab]);
38 [self setUniqueID:numID];
32 [self setTempURL:@""]; 39 [self setTempURL:@""];
33 } 40 }
34 return self; 41 return self;
35 } 42 }
36 43
37 - (void)dealloc { 44 - (void)dealloc {
38 [tempURL_ release]; 45 [tempURL_ release];
39 [super dealloc]; 46 [super dealloc];
40 } 47 }
41 48
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 271
265 272
266 - (void)handlesViewSourceScriptCommand:(NSScriptCommand*)command { 273 - (void)handlesViewSourceScriptCommand:(NSScriptCommand*)command {
267 NavigationEntry* entry = tabContents_->controller().GetLastCommittedEntry(); 274 NavigationEntry* entry = tabContents_->controller().GetLastCommittedEntry();
268 if (entry) { 275 if (entry) {
269 tabContents_->OpenURL(GURL(chrome::kViewSourceScheme + std::string(":") + 276 tabContents_->OpenURL(GURL(chrome::kViewSourceScheme + std::string(":") +
270 entry->url().spec()), GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); 277 entry->url().spec()), GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK);
271 } 278 }
272 } 279 }
273 280
281 - (id)handlesExecuteJavascriptScriptCommand:(NSScriptCommand*)command {
282 RenderViewHost* view = tabContents_->render_view_host();
283 if (!view) {
284 NOTREACHED();
285 return nil;
286 }
287
288 std::wstring script = base::SysNSStringToWide(
289 [[command evaluatedArguments] objectForKey:@"javascript"]);
290 view->ExecuteJavascriptInWebFrame(L"", script);
291
292 // TODO(Shreyas): Figure out a way to get the response back.
293 return nil;
294 }
295
274 @end 296 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/applescript/tab_applescript.h ('k') | chrome/browser/cocoa/applescript/window_applescript_test.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698