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

Side by Side Diff: webkit/tools/test_shell/mac/test_webview_delegate.mm

Issue 212053: Fake main window resizing in the test shell.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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) 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 #include "webkit/tools/test_shell/test_webview_delegate.h" 5 #include "webkit/tools/test_shell/test_webview_delegate.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "webkit/api/public/WebCursorInfo.h" 10 #include "webkit/api/public/WebCursorInfo.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 WebRect TestWebViewDelegate::windowRect() { 105 WebRect TestWebViewDelegate::windowRect() {
106 if (WebWidgetHost* host = GetWidgetHost()) { 106 if (WebWidgetHost* host = GetWidgetHost()) {
107 NSView *view = host->view_handle(); 107 NSView *view = host->view_handle();
108 NSRect rect = [view frame]; 108 NSRect rect = [view frame];
109 return gfx::Rect(NSRectToCGRect(rect)); 109 return gfx::Rect(NSRectToCGRect(rect));
110 } 110 }
111 return WebRect(); 111 return WebRect();
112 } 112 }
113 113
114 void TestWebViewDelegate::setWindowRect(const WebRect& rect) { 114 void TestWebViewDelegate::setWindowRect(const WebRect& rect) {
115 // TODO: Mac window movement
116 if (this == shell_->delegate()) { 115 if (this == shell_->delegate()) {
117 // ignored 116 setFakeWindowRect(rect);
118 } else if (this == shell_->popup_delegate()) { 117 } else if (this == shell_->popup_delegate()) {
119 popup_bounds_ = rect; // The initial position of the popup. 118 popup_bounds_ = rect; // The initial position of the popup.
120 } 119 }
121 } 120 }
122 121
123 WebRect TestWebViewDelegate::rootWindowRect() { 122 WebRect TestWebViewDelegate::rootWindowRect() {
124 if (WebWidgetHost* host = GetWidgetHost()) { 123 if (using_fake_rect_) {
124 return getFakeWindowRect();
125 } else if (WebWidgetHost* host = GetWidgetHost()) {
dglazkov 2009/09/23 18:17:14 Early return, no need to use else if, right?
125 NSView *view = host->view_handle(); 126 NSView *view = host->view_handle();
126 NSRect rect = [[[view window] contentView] frame]; 127 NSRect rect = [[[view window] contentView] frame];
127 return gfx::Rect(NSRectToCGRect(rect)); 128 return gfx::Rect(NSRectToCGRect(rect));
128 } 129 }
129 return WebRect(); 130 return WebRect();
130 } 131 }
131 132
132 @interface NSWindow(OSInternals) 133 @interface NSWindow(OSInternals)
133 - (NSRect)_growBoxRect; 134 - (NSRect)_growBoxRect;
134 @end 135 @end
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) { 220 void TestWebViewDelegate::SetPageTitle(const std::wstring& title) {
220 [[shell_->webViewHost()->view_handle() window] 221 [[shell_->webViewHost()->view_handle() window]
221 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]]; 222 setTitle:[NSString stringWithUTF8String:WideToUTF8(title).c_str()]];
222 } 223 }
223 224
224 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { 225 void TestWebViewDelegate::SetAddressBarURL(const GURL& url) {
225 const char* frameURL = url.spec().c_str(); 226 const char* frameURL = url.spec().c_str();
226 NSString *address = [NSString stringWithUTF8String:frameURL]; 227 NSString *address = [NSString stringWithUTF8String:frameURL];
227 [shell_->editWnd() setStringValue:address]; 228 [shell_->editWnd() setStringValue:address];
228 } 229 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698