Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 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" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "blimp/client/app/blimp_startup.h" | 12 #include "blimp/client/app/blimp_startup.h" |
| 13 #include "blimp/client/app/linux/blimp_client_session_linux.h" | 13 #include "blimp/client/app/linux/blimp_client_context_delegate_linux.h" |
| 14 #include "blimp/client/core/contents/navigation_feature.h" | 14 #include "blimp/client/app/linux/blimp_display_manager.h" |
| 15 #include "blimp/client/core/contents/tab_control_feature.h" | 15 #include "blimp/client/app/linux/blimp_display_manager_delegate_main.h" |
| 16 #include "blimp/client/core/session/assignment_source.h" | 16 #include "blimp/client/public/blimp_client_context.h" |
| 17 #include "blimp/client/public/contents/blimp_contents_view.h" | |
| 18 #include "blimp/client/public/contents/blimp_navigation_controller.h" | |
| 19 #include "blimp/client/support/compositor/blimp_embedder_compositor.h" | |
| 20 #include "blimp/client/support/compositor/compositor_dependencies_impl.h" | |
| 21 #include "blimp/common/get_client_auth_token.h" | |
| 22 #include "ui/events/platform/platform_event_source.h" | |
| 17 #include "ui/gfx/x/x11_connection.h" | 23 #include "ui/gfx/x/x11_connection.h" |
| 18 | 24 |
| 19 namespace { | 25 namespace { |
| 20 const char kDummyLoginToken[] = ""; | |
| 21 const char kDefaultUrl[] = "https://www.google.com"; | 26 const char kDefaultUrl[] = "https://www.google.com"; |
| 22 const int kDummyTabId = 0; | 27 const int kWindowWidth = 800; |
| 28 const int kWindowHeight = 600; | |
| 23 } | 29 } |
| 24 | 30 |
| 25 int main(int argc, const char**argv) { | 31 int main(int argc, const char**argv) { |
| 26 base::AtExitManager at_exit; | 32 base::AtExitManager at_exit; |
| 27 base::CommandLine::Init(argc, argv); | 33 base::CommandLine::Init(argc, argv); |
| 28 | 34 |
| 29 CHECK(gfx::InitializeThreadedX11()); | 35 CHECK(gfx::InitializeThreadedX11()); |
| 30 | 36 |
| 31 blimp::client::InitializeLogging(); | 37 blimp::client::InitializeLogging(); |
| 32 blimp::client::InitializeMainMessageLoop(); | 38 blimp::client::InitializeMainMessageLoop(); |
| 33 | 39 |
| 34 blimp::client::BlimpClientSessionLinux session; | 40 base::Thread io_thread("BlimpIOThread"); |
| 35 session.GetTabControlFeature()->CreateTab(kDummyTabId); | 41 base::Thread::Options options; |
| 36 session.Connect(kDummyLoginToken); | 42 options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 43 io_thread.StartWithOptions(options); | |
| 44 | |
| 45 blimp::client::CompositorDependencies* compositor_dependencies = | |
|
David Trainor- moved to gerrit
2016/09/27 17:40:37
Make this a std::unique_ptr<> and use MakeUnique.
steimel
2016/09/27 18:26:11
Discussed with you and added a comment describing
| |
| 46 new blimp::client::CompositorDependenciesImpl(); | |
| 47 | |
| 48 std::unique_ptr<blimp::client::BlimpClientContextDelegate> context_delegate = | |
| 49 base::MakeUnique<blimp::client::BlimpClientContextDelegateLinux>(); | |
| 50 | |
| 51 std::unique_ptr<blimp::client::BlimpClientContext> context = | |
| 52 base::WrapUnique<blimp::client::BlimpClientContext>( | |
| 53 blimp::client::BlimpClientContext::Create( | |
| 54 io_thread.task_runner(), io_thread.task_runner(), | |
| 55 base::WrapUnique(compositor_dependencies))); | |
| 56 | |
| 57 context->SetDelegate(context_delegate.get()); | |
| 58 | |
| 59 context->Connect(); | |
| 60 | |
| 61 std::unique_ptr<blimp::client::BlimpContents> contents = | |
| 62 context->CreateBlimpContents(nullptr); | |
| 37 | 63 |
| 38 // If there is a non-switch argument to the command line, load that url. | 64 // If there is a non-switch argument to the command line, load that url. |
| 39 base::CommandLine::StringVector args = | 65 base::CommandLine::StringVector args = |
| 40 base::CommandLine::ForCurrentProcess()->GetArgs(); | 66 base::CommandLine::ForCurrentProcess()->GetArgs(); |
| 41 std::string url = args.size() > 0 ? args[0] : kDefaultUrl; | 67 std::string url = args.size() > 0 ? args[0] : kDefaultUrl; |
| 42 session.GetNavigationFeature()->NavigateToUrlText(kDummyTabId, url); | 68 contents->GetNavigationController().LoadURL(GURL(url)); |
| 43 | 69 |
| 70 std::unique_ptr<ui::PlatformEventSource> event_source = | |
| 71 ui::PlatformEventSource::CreateDefault(); | |
| 72 | |
| 73 blimp::client::BlimpDisplayManager display_manager( | |
| 74 gfx::Size(kWindowWidth, kWindowHeight), | |
| 75 new blimp::client::BlimpDisplayManagerDelegateMain(), | |
| 76 compositor_dependencies, std::move(contents)); | |
| 44 base::RunLoop().Run(); | 77 base::RunLoop().Run(); |
| 45 } | 78 } |
| OLD | NEW |