Chromium Code Reviews| 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> | |
| 6 | |
| 5 #include <string> | 7 #include <string> |
| 6 | 8 |
| 7 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 9 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/threading/thread.h" | |
| 10 #include "blimp/client/blimp_startup.h" | 13 #include "blimp/client/blimp_startup.h" |
| 11 #include "blimp/client/session/blimp_client_session_linux.h" | 14 #include "blimp/client/session/blimp_client_session_linux.h" |
| 12 #include "blimp/client/session/navigation_feature.h" | 15 #include "blimp/client/session/navigation_feature.h" |
| 13 | 16 |
| 14 #include <X11/Xlib.h> | |
| 15 | |
| 16 namespace { | 17 namespace { |
| 17 const char kDefaultUrl[] = "https://www.google.com"; | 18 const char kDefaultUrl[] = "https://www.google.com"; |
| 18 const int kDummyTabId = 0; | 19 const int kDummyTabId = 0; |
| 19 } | 20 } |
| 20 | 21 |
| 21 int main(int argc, const char**argv) { | 22 int main(int argc, const char**argv) { |
| 22 base::AtExitManager at_exit; | 23 base::AtExitManager at_exit; |
| 23 | 24 |
| 24 base::CommandLine::Init(argc, argv); | 25 base::CommandLine::Init(argc, argv); |
| 25 | 26 |
| 26 XInitThreads(); | 27 XInitThreads(); |
| 27 | 28 |
| 28 blimp::InitializeLogging(); | 29 blimp::InitializeLogging(); |
| 29 blimp::InitializeMainMessageLoop(); | 30 blimp::InitializeMainMessageLoop(); |
| 30 | 31 |
| 31 blimp::BlimpClientSessionLinux session; | 32 blimp::BlimpClientSessionLinux session; |
| 32 | 33 |
| 34 // Create the IO thread and initiate a connection on it. | |
| 35 base::Thread::Options options; | |
| 36 options.message_loop_type = base::MessageLoop::TYPE_IO; | |
| 37 base::Thread io_thread("BlimpIOThread"); | |
| 38 io_thread.StartWithOptions(options); | |
| 39 io_thread.message_loop()->PostTask( | |
|
haibinlu
2015/12/29 00:51:45
it is a little strange to run BlimpClientSession::
Kevin M
2015/12/30 23:08:48
Done. Moved IO thread setup into ClientSession, ca
| |
| 40 FROM_HERE, base::Bind(&blimp::BlimpClientSession::Connect, | |
| 41 base::Unretained(&session))); | |
| 42 | |
| 33 // If there is a non-switch argument to the command line, load that url. | 43 // If there is a non-switch argument to the command line, load that url. |
| 34 base::CommandLine::StringVector args = | 44 base::CommandLine::StringVector args = |
| 35 base::CommandLine::ForCurrentProcess()->GetArgs(); | 45 base::CommandLine::ForCurrentProcess()->GetArgs(); |
| 36 std::string url = args.size() > 0 ? args[0] : kDefaultUrl; | 46 std::string url = args.size() > 0 ? args[0] : kDefaultUrl; |
| 37 | 47 |
| 38 session.GetNavigationFeature()->NavigateToUrlText(kDummyTabId, url); | 48 session.GetNavigationFeature()->NavigateToUrlText(kDummyTabId, url); |
| 39 | 49 |
| 40 base::RunLoop().Run(); | 50 base::RunLoop().Run(); |
| 41 } | 51 } |
| OLD | NEW |