| 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "webkit/tools/test_shell/webview_host.h" | 7 #include "webkit/tools/test_shell/webview_host.h" |
| 8 #include "webkit/tools/test_shell/mac/test_shell_webview.h" | 8 #include "webkit/tools/test_shell/mac/test_shell_webview.h" |
| 9 | 9 |
| 10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 host->view_ = [[TestShellWebView alloc] initWithFrame:content_rect]; | 36 host->view_ = [[TestShellWebView alloc] initWithFrame:content_rect]; |
| 37 // make the height and width track the window size. | 37 // make the height and width track the window size. |
| 38 [host->view_ setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; | 38 [host->view_ setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; |
| 39 [parent_view addSubview:host->view_]; | 39 [parent_view addSubview:host->view_]; |
| 40 [host->view_ release]; | 40 [host->view_ release]; |
| 41 | 41 |
| 42 host->webwidget_ = WebView::create(delegate); | 42 host->webwidget_ = WebView::create(delegate); |
| 43 host->webview()->setDevToolsAgentClient(dev_tools_client); | 43 host->webview()->setDevToolsAgentClient(dev_tools_client); |
| 44 prefs.Apply(host->webview()); | 44 prefs.Apply(host->webview()); |
| 45 host->webview()->initializeMainFrame(delegate); | 45 host->webview()->initializeMainFrame(delegate); |
| 46 host->webwidget_->resize(WebSize(content_rect.size.width, | 46 host->webwidget_->resize(WebSize(NSWidth(content_rect), |
| 47 content_rect.size.height)); | 47 NSHeight(content_rect))); |
| 48 | 48 |
| 49 return host; | 49 return host; |
| 50 } | 50 } |
| 51 | 51 |
| 52 WebView* WebViewHost::webview() const { | 52 WebView* WebViewHost::webview() const { |
| 53 return static_cast<WebView*>(webwidget_); | 53 return static_cast<WebView*>(webwidget_); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void WebViewHost::SetIsActive(bool active) { | 56 void WebViewHost::SetIsActive(bool active) { |
| 57 // Ignore calls in layout test mode so that tests don't mess with each other | 57 // Ignore calls in layout test mode so that tests don't mess with each other |
| 58 // when running in parallel. | 58 // when running in parallel. |
| 59 if (!TestShell::layout_test_mode()) | 59 if (!TestShell::layout_test_mode()) |
| 60 webview()->setIsActive(active); | 60 webview()->setIsActive(active); |
| 61 } | 61 } |
| OLD | NEW |