| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <X11/Xlib.h> | 5 #include <X11/Xlib.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #include "blimp/client/app/blimp_startup.h" | 14 #include "blimp/client/app/blimp_startup.h" |
| 15 #include "blimp/client/app/linux/blimp_client_session_linux.h" | 15 #include "blimp/client/app/linux/blimp_client_session_linux.h" |
| 16 #include "blimp/client/feature/navigation_feature.h" | 16 #include "blimp/client/feature/navigation_feature.h" |
| 17 #include "blimp/client/feature/tab_control_feature.h" | 17 #include "blimp/client/feature/tab_control_feature.h" |
| 18 #include "blimp/client/session/assignment_source.h" | 18 #include "blimp/client/session/assignment_source.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 const char kDummyLoginToken[] = ""; |
| 21 const char kDefaultUrl[] = "https://www.google.com"; | 22 const char kDefaultUrl[] = "https://www.google.com"; |
| 22 const int kDummyTabId = 0; | 23 const int kDummyTabId = 0; |
| 23 } | 24 } |
| 24 | 25 |
| 25 int main(int argc, const char**argv) { | 26 int main(int argc, const char**argv) { |
| 26 base::AtExitManager at_exit; | 27 base::AtExitManager at_exit; |
| 27 base::CommandLine::Init(argc, argv); | 28 base::CommandLine::Init(argc, argv); |
| 28 | 29 |
| 29 XInitThreads(); | 30 XInitThreads(); |
| 30 | 31 |
| 31 blimp::client::InitializeLogging(); | 32 blimp::client::InitializeLogging(); |
| 32 blimp::client::InitializeMainMessageLoop(); | 33 blimp::client::InitializeMainMessageLoop(); |
| 33 | 34 |
| 34 scoped_ptr<blimp::client::AssignmentSource> assignment_source = | 35 blimp::client::BlimpClientSessionLinux session; |
| 35 make_scoped_ptr(new blimp::client::AssignmentSource( | |
| 36 base::ThreadTaskRunnerHandle::Get())); | |
| 37 blimp::client::BlimpClientSessionLinux session(std::move(assignment_source)); | |
| 38 session.GetTabControlFeature()->CreateTab(kDummyTabId); | 36 session.GetTabControlFeature()->CreateTab(kDummyTabId); |
| 39 session.Connect(); | 37 session.Connect(kDummyLoginToken); |
| 40 | 38 |
| 41 // If there is a non-switch argument to the command line, load that url. | 39 // If there is a non-switch argument to the command line, load that url. |
| 42 base::CommandLine::StringVector args = | 40 base::CommandLine::StringVector args = |
| 43 base::CommandLine::ForCurrentProcess()->GetArgs(); | 41 base::CommandLine::ForCurrentProcess()->GetArgs(); |
| 44 std::string url = args.size() > 0 ? args[0] : kDefaultUrl; | 42 std::string url = args.size() > 0 ? args[0] : kDefaultUrl; |
| 45 session.GetNavigationFeature()->NavigateToUrlText(kDummyTabId, url); | 43 session.GetNavigationFeature()->NavigateToUrlText(kDummyTabId, url); |
| 46 | 44 |
| 47 base::RunLoop().Run(); | 45 base::RunLoop().Run(); |
| 48 } | 46 } |
| OLD | NEW |