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

Side by Side Diff: webkit/tools/test_shell/webview_host_mac.mm

Issue 15028002: Delete test_shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add dummy test_shell build target. Created 7 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #import <Cocoa/Cocoa.h>
6
7 #include "webkit/tools/test_shell/webview_host.h"
8 #include "webkit/tools/test_shell/mac/test_shell_webview.h"
9
10 #include "skia/ext/platform_canvas.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
14 #include "ui/gfx/rect.h"
15 #include "ui/gfx/size.h"
16 #include "webkit/glue/webpreferences.h"
17 #include "webkit/tools/test_shell/test_shell.h"
18 #include "webkit/tools/test_shell/test_webview_delegate.h"
19
20 using WebKit::WebDevToolsAgentClient;
21 using WebKit::WebSize;
22 using WebKit::WebView;
23
24 // static
25 WebViewHost* WebViewHost::Create(NSView* parent_view,
26 TestWebViewDelegate* delegate,
27 WebDevToolsAgentClient* dev_tools_client,
28 const WebPreferences& prefs) {
29 WebViewHost* host = new WebViewHost();
30
31 NSRect content_rect = [parent_view frame];
32 // bump down the top of the view so that it doesn't overlap the buttons
33 // and URL field. 32 is an ad hoc constant.
34 // TODO(awalker): replace explicit view layout with a little nib file
35 // and use that for view geometry.
36 content_rect.size.height -= 32;
37 host->view_ = [[TestShellWebView alloc] initWithFrame:content_rect];
38 // make the height and width track the window size.
39 [host->view_ setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
40 [parent_view addSubview:host->view_];
41 [host->view_ release];
42
43 host->webwidget_ = WebView::create(delegate);
44 host->webview()->setDevToolsAgentClient(dev_tools_client);
45 webkit_glue::ApplyWebPreferences(prefs, host->webview());
46 host->webview()->settings()->setExperimentalCSSGridLayoutEnabled(true);
47 host->webview()->initializeMainFrame(delegate);
48 host->webwidget_->resize(WebSize(NSWidth(content_rect),
49 NSHeight(content_rect)));
50
51 return host;
52 }
53
54 WebView* WebViewHost::webview() const {
55 return static_cast<WebView*>(webwidget_);
56 }
57
58 void WebViewHost::SetIsActive(bool active) {
59 // Ignore calls in layout test mode so that tests don't mess with each other
60 // when running in parallel.
61 if (!TestShell::layout_test_mode())
62 webview()->setIsActive(active);
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698