Chromium Code Reviews| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 | 40 |
| 41 // Creating this using "new" and passing to context using "WrapUnique" as | 41 // Creating this using "new" and passing to context using "WrapUnique" as |
| 42 // opposed to "MakeUnique" because we'll need to pass the compositor | 42 // opposed to "MakeUnique" because we'll need to pass the compositor |
| 43 // dependencies to the display manager as well. | 43 // dependencies to the display manager as well. |
| 44 blimp::client::CompositorDependencies* compositor_dependencies = | 44 blimp::client::CompositorDependencies* compositor_dependencies = |
| 45 new blimp::client::CompositorDependenciesImpl(); | 45 new blimp::client::CompositorDependenciesImpl(); |
| 46 // Creating the context delegate before the context so that the context is | 46 // Creating the context delegate before the context so that the context is |
| 47 // destroyed before the delegate. | 47 // destroyed before the delegate. |
| 48 std::unique_ptr<blimp::client::BlimpClientContextDelegate> context_delegate = | 48 std::unique_ptr<blimp::client::BlimpClientContextDelegate> context_delegate = |
| 49 base::MakeUnique<blimp::client::BlimpClientContextDelegateLinux>(); | 49 base::MakeUnique<blimp::client::BlimpClientContextDelegateLinux>(); |
| 50 std::unique_ptr<blimp::client::BlimpClientContext> context = | 50 std::unique_ptr<blimp::client::BlimpClientContext> context = |
|
Bernhard Bauer
2016/10/25 14:30:50
FWIW, I would consider using auto here, as you alr
Menglin
2016/10/25 18:32:52
Done.
| |
| 51 base::WrapUnique<blimp::client::BlimpClientContext>( | 51 base::WrapUnique<blimp::client::BlimpClientContext>( |
| 52 blimp::client::BlimpClientContext::Create( | 52 blimp::client::BlimpClientContext::Create( |
| 53 io_thread.task_runner(), io_thread.task_runner(), | 53 io_thread.task_runner(), io_thread.task_runner(), |
| 54 base::WrapUnique(compositor_dependencies))); | 54 base::WrapUnique(compositor_dependencies), |
| 55 static_cast<blimp::client::BlimpClientContextDelegateLinux*> | |
| 56 (context_delegate.get())->pref_service())); | |
|
Bernhard Bauer
2016/10/25 14:30:50
Is this indented correctly?
Menglin
2016/10/25 18:32:52
Done.
| |
| 55 context->SetDelegate(context_delegate.get()); | 57 context->SetDelegate(context_delegate.get()); |
| 56 | 58 |
| 57 context->Connect(); | 59 context->Connect(); |
| 58 | 60 |
| 59 // If there is a non-switch argument to the command line, load that url. | 61 // If there is a non-switch argument to the command line, load that url. |
| 60 base::CommandLine::StringVector args = | 62 base::CommandLine::StringVector args = |
| 61 base::CommandLine::ForCurrentProcess()->GetArgs(); | 63 base::CommandLine::ForCurrentProcess()->GetArgs(); |
| 62 std::string url = args.size() > 0 ? args[0] : kDefaultUrl; | 64 std::string url = args.size() > 0 ? args[0] : kDefaultUrl; |
| 63 std::unique_ptr<blimp::client::BlimpContents> contents = | 65 std::unique_ptr<blimp::client::BlimpContents> contents = |
| 64 context->CreateBlimpContents(nullptr); | 66 context->CreateBlimpContents(nullptr); |
| 65 contents->GetNavigationController().LoadURL(GURL(url)); | 67 contents->GetNavigationController().LoadURL(GURL(url)); |
| 66 | 68 |
| 67 std::unique_ptr<blimp::client::BlimpDisplayManagerDelegate> | 69 std::unique_ptr<blimp::client::BlimpDisplayManagerDelegate> |
| 68 display_manager_delegate = | 70 display_manager_delegate = |
| 69 base::MakeUnique<blimp::client::BlimpDisplayManagerDelegateMain>(); | 71 base::MakeUnique<blimp::client::BlimpDisplayManagerDelegateMain>(); |
| 70 blimp::client::BlimpDisplayManager display_manager( | 72 blimp::client::BlimpDisplayManager display_manager( |
| 71 display_manager_delegate.get(), compositor_dependencies); | 73 display_manager_delegate.get(), compositor_dependencies); |
| 72 display_manager.SetWindowSize(gfx::Size(kWindowWidth, kWindowHeight)); | 74 display_manager.SetWindowSize(gfx::Size(kWindowWidth, kWindowHeight)); |
| 73 display_manager.SetBlimpContents(std::move(contents)); | 75 display_manager.SetBlimpContents(std::move(contents)); |
| 74 | 76 |
| 75 base::RunLoop().Run(); | 77 base::RunLoop().Run(); |
| 76 } | 78 } |
| OLD | NEW |