OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 "test_shell_webview.h" | 5 #import "test_shell_webview.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 | 81 |
82 - (IBAction)takeURLStringValueFrom:(NSTextField *)sender { | 82 - (IBAction)takeURLStringValueFrom:(NSTextField *)sender { |
83 NSString *url = [sender stringValue]; | 83 NSString *url = [sender stringValue]; |
84 | 84 |
85 // if it doesn't already have a prefix, add http. If we can't parse it, | 85 // if it doesn't already have a prefix, add http. If we can't parse it, |
86 // just don't bother rather than making things worse. | 86 // just don't bother rather than making things worse. |
87 NSURL* tempUrl = [NSURL URLWithString:url]; | 87 NSURL* tempUrl = [NSURL URLWithString:url]; |
88 if (tempUrl && ![tempUrl scheme]) | 88 if (tempUrl && ![tempUrl scheme]) |
89 url = [@"http://" stringByAppendingString:url]; | 89 url = [@"http://" stringByAppendingString:url]; |
90 shell_->LoadURL(UTF8ToWide([url UTF8String]).c_str()); | 90 shell_->LoadURL(GURL(std::string([url UTF8String]))); |
91 } | 91 } |
92 | 92 |
93 - (void)mouseDown:(NSEvent *)theEvent { | 93 - (void)mouseDown:(NSEvent *)theEvent { |
94 if (shell_ && shell_->webView()) | 94 if (shell_ && shell_->webView()) |
95 shell_->webViewHost()->MouseEvent(theEvent); | 95 shell_->webViewHost()->MouseEvent(theEvent); |
96 } | 96 } |
97 | 97 |
98 - (void)rightMouseDown:(NSEvent *)theEvent { | 98 - (void)rightMouseDown:(NSEvent *)theEvent { |
99 if (shell_ && shell_->webView()) | 99 if (shell_ && shell_->webView()) |
100 shell_->webViewHost()->MouseEvent(theEvent); | 100 shell_->webViewHost()->MouseEvent(theEvent); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 } | 196 } |
197 | 197 |
198 - (void)setFrame:(NSRect)frameRect { | 198 - (void)setFrame:(NSRect)frameRect { |
199 [super setFrame:frameRect]; | 199 [super setFrame:frameRect]; |
200 if (shell_ && shell_->webView()) | 200 if (shell_ && shell_->webView()) |
201 shell_->webViewHost()->Resize(gfx::Rect(NSRectToCGRect(frameRect))); | 201 shell_->webViewHost()->Resize(gfx::Rect(NSRectToCGRect(frameRect))); |
202 [self setNeedsDisplay:YES]; | 202 [self setNeedsDisplay:YES]; |
203 } | 203 } |
204 | 204 |
205 @end | 205 @end |
OLD | NEW |