Chromium Code Reviews| Index: blimp/engine/browser/blimp_client_session_manager.cc |
| diff --git a/blimp/engine/browser/blimp_client_session_manager.cc b/blimp/engine/browser/blimp_client_session_manager.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..187b299d74775a4722612b51258de2146446f955 |
| --- /dev/null |
| +++ b/blimp/engine/browser/blimp_client_session_manager.cc |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "blimp/engine/browser/blimp_client_session_manager.h" |
| + |
| +#include "base/command_line.h" |
| +#include "blimp/engine/browser/blimp_client_session.h" |
| +#include "blimp/engine/browser/blimp_client_session_manager_delegate.h" |
| +#include "blimp/engine/ui/blimp_screen.h" |
| +#include "net/base/net_module.h" |
| +#include "net/log/net_log.h" |
| +#include "url/gurl.h" |
| + |
| +namespace blimp { |
| +namespace engine { |
|
Kevin M
2015/10/14 17:52:56
Since we decided on using the Blimp prefix for cla
haibinlu
2015/10/15 01:59:28
'engine' namespace is used through the engine fold
|
| + |
| +namespace { |
| + |
| +const char kDefaultURL[] = "https://www.google.com/"; |
| + |
| +GURL GetStartupURL() { |
|
Kevin M
2015/10/14 17:52:57
Command line parsing should be in or around the ma
haibinlu
2015/10/15 01:59:28
moved to main_parts. this is just for dev purpose
|
| + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| + const base::CommandLine::StringVector& args = command_line->GetArgs(); |
| + if (args.empty()) |
| + return GURL(kDefaultURL); |
| + |
| + GURL url(args[0]); |
| + if (url.is_valid() && url.has_scheme()) |
| + return url; |
| + |
| + return GURL(kDefaultURL); |
| +} |
| + |
| +} // namespace |
| + |
| +BlimpClientSessionManager::BlimpClientSessionManager( |
| + BlimpClientSessionManagerDelegate* delegate, |
| + net::NetLog* net_log) |
| + : delegate_(delegate), net_log_(net_log) {} |
| + |
| +BlimpClientSessionManager::~BlimpClientSessionManager() {} |
| + |
| +void BlimpClientSessionManager::AttachTestClientSession() { |
| + DCHECK(delegate_); |
|
Kevin M
2015/10/14 17:52:56
Test support code doesn't belong here. Factor out
haibinlu
2015/10/15 01:59:28
done per offline discussion
|
| + if (!active_session_) |
| + active_session_.reset( |
| + new BlimpClientSession(gfx::Size(BlimpScreen::kDefaultDisplayWidth, |
| + BlimpScreen::kDefaultDisplayHeight), |
| + GetStartupURL())); |
| + delegate_->AttachClientSession(active_session_.get()); |
| +} |
| + |
| +} // namespace engine |
| +} // namespace blimp |