Roll src/third_party/skia 0f881c6:b436ed6
[chromium-blink-merge.git] / ash / test / ash_test_views_delegate.cc
blobc47bdba5695ca6556a696d5daff29cd2a079d870
1 // Copyright 2014 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.
5 #include "ash/test/ash_test_views_delegate.h"
7 #include "ash/shell.h"
8 #include "content/public/test/web_contents_tester.h"
10 namespace ash {
11 namespace test {
13 AshTestViewsDelegate::AshTestViewsDelegate() {
16 AshTestViewsDelegate::~AshTestViewsDelegate() {
19 content::WebContents* AshTestViewsDelegate::CreateWebContents(
20 content::BrowserContext* browser_context,
21 content::SiteInstance* site_instance) {
22 return content::WebContentsTester::CreateTestWebContents(browser_context,
23 site_instance);
26 void AshTestViewsDelegate::OnBeforeWidgetInit(
27 views::Widget::InitParams* params,
28 views::internal::NativeWidgetDelegate* delegate) {
29 TestViewsDelegate::OnBeforeWidgetInit(params, delegate);
31 if (!params->parent && !params->context && ash::Shell::HasInstance()) {
32 // If the window has neither a parent nor a context add to the root.
33 params->parent = ash::Shell::GetInstance()->GetPrimaryRootWindow();
37 } // namespace test
38 } // namespace ash