OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/navigation/content_client/browser_main_parts.h" | 5 #include "services/navigation/content_client/browser_main_parts.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "content/public/common/mojo_shell_connection.h" |
8 #include "content/shell/browser/shell_browser_context.h" | 9 #include "content/shell/browser/shell_browser_context.h" |
9 #include "content/shell/browser/shell_net_log.h" | 10 #include "content/shell/browser/shell_net_log.h" |
10 #include "services/navigation/navigation.h" | 11 #include "services/navigation/navigation.h" |
11 #include "ui/views/test/test_views_delegate.h" | 12 #include "ui/views/test/test_views_delegate.h" |
12 | 13 |
13 namespace navigation { | 14 namespace navigation { |
14 | 15 |
15 BrowserMainParts::BrowserMainParts( | 16 BrowserMainParts::BrowserMainParts( |
16 const content::MainFunctionParams& parameters) {} | 17 const content::MainFunctionParams& parameters) {} |
17 BrowserMainParts::~BrowserMainParts() {} | 18 BrowserMainParts::~BrowserMainParts() {} |
18 | 19 |
19 void BrowserMainParts::ToolkitInitialized() { | 20 void BrowserMainParts::ToolkitInitialized() { |
20 if (!views::ViewsDelegate::GetInstance()) | 21 if (!views::ViewsDelegate::GetInstance()) |
21 views_delegate_.reset(new views::TestViewsDelegate); | 22 views_delegate_.reset(new views::TestViewsDelegate); |
22 } | 23 } |
23 | 24 |
24 void BrowserMainParts::PreMainMessageLoopRun() { | 25 void BrowserMainParts::PreMainMessageLoopRun() { |
25 net_log_.reset(new content::ShellNetLog("ash_shell")); | 26 net_log_.reset(new content::ShellNetLog("ash_shell")); |
26 browser_context_.reset( | 27 browser_context_.reset( |
27 new content::ShellBrowserContext(false, net_log_.get())); | 28 new content::ShellBrowserContext(false, net_log_.get())); |
28 navigation_->SetBrowserContext(browser_context()); | 29 navigation_->Init(content::MojoShellConnection::Get()->GetConnector(), |
| 30 browser_context()); |
29 } | 31 } |
30 | 32 |
31 void BrowserMainParts::PostMainMessageLoopRun() { | 33 void BrowserMainParts::PostMainMessageLoopRun() { |
32 views_delegate_.reset(); | 34 views_delegate_.reset(); |
33 browser_context_.reset(); | 35 browser_context_.reset(); |
34 } | 36 } |
35 | 37 |
36 bool BrowserMainParts::MainMessageLoopRun(int* result_code) { | 38 bool BrowserMainParts::MainMessageLoopRun(int* result_code) { |
37 base::MessageLoop::current()->Run(); | 39 base::MessageLoop::current()->Run(); |
38 return true; | 40 return true; |
39 } | 41 } |
40 | 42 |
41 } // namespace navigation | 43 } // namespace navigation |
OLD | NEW |