OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "ash/test/ash_test_views_delegate.h" | 5 #include "ash/test/ash_test_views_delegate.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "content/public/test/web_contents_tester.h" | |
9 | 8 |
10 namespace ash { | 9 namespace ash { |
11 namespace test { | 10 namespace test { |
12 | 11 |
13 AshTestViewsDelegate::AshTestViewsDelegate() {} | 12 AshTestViewsDelegate::AshTestViewsDelegate() {} |
14 | 13 |
15 AshTestViewsDelegate::~AshTestViewsDelegate() {} | 14 AshTestViewsDelegate::~AshTestViewsDelegate() {} |
16 | 15 |
17 content::WebContents* AshTestViewsDelegate::CreateWebContents( | |
18 content::BrowserContext* browser_context, | |
19 content::SiteInstance* site_instance) { | |
20 return content::WebContentsTester::CreateTestWebContents(browser_context, | |
21 site_instance); | |
22 } | |
23 | |
24 void AshTestViewsDelegate::OnBeforeWidgetInit( | 16 void AshTestViewsDelegate::OnBeforeWidgetInit( |
25 views::Widget::InitParams* params, | 17 views::Widget::InitParams* params, |
26 views::internal::NativeWidgetDelegate* delegate) { | 18 views::internal::NativeWidgetDelegate* delegate) { |
27 TestViewsDelegate::OnBeforeWidgetInit(params, delegate); | 19 TestViewsDelegate::OnBeforeWidgetInit(params, delegate); |
28 | 20 |
29 if (!params->parent && !params->context && ash::Shell::HasInstance()) { | 21 if (!params->parent && !params->context && ash::Shell::HasInstance()) { |
30 // If the window has neither a parent nor a context add to the root. | 22 // If the window has neither a parent nor a context add to the root. |
31 params->parent = ash::Shell::GetInstance()->GetPrimaryRootWindow(); | 23 params->parent = ash::Shell::GetInstance()->GetPrimaryRootWindow(); |
32 } | 24 } |
33 } | 25 } |
34 | 26 |
35 } // namespace test | 27 } // namespace test |
36 } // namespace ash | 28 } // namespace ash |
OLD | NEW |