Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "blimp/engine/browser/blimp_client_session_manager.h" | |
| 6 | |
| 7 #include "base/command_line.h" | |
| 8 #include "blimp/engine/browser/blimp_client_session.h" | |
| 9 #include "blimp/engine/browser/blimp_client_session_manager_delegate.h" | |
| 10 #include "blimp/engine/ui/blimp_screen.h" | |
| 11 #include "net/base/net_module.h" | |
| 12 #include "net/log/net_log.h" | |
| 13 #include "url/gurl.h" | |
| 14 | |
| 15 namespace blimp { | |
| 16 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
| |
| 17 | |
| 18 namespace { | |
| 19 | |
| 20 const char kDefaultURL[] = "https://www.google.com/"; | |
| 21 | |
| 22 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
| |
| 23 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 24 const base::CommandLine::StringVector& args = command_line->GetArgs(); | |
| 25 if (args.empty()) | |
| 26 return GURL(kDefaultURL); | |
| 27 | |
| 28 GURL url(args[0]); | |
| 29 if (url.is_valid() && url.has_scheme()) | |
| 30 return url; | |
| 31 | |
| 32 return GURL(kDefaultURL); | |
| 33 } | |
| 34 | |
| 35 } // namespace | |
| 36 | |
| 37 BlimpClientSessionManager::BlimpClientSessionManager( | |
| 38 BlimpClientSessionManagerDelegate* delegate, | |
| 39 net::NetLog* net_log) | |
| 40 : delegate_(delegate), net_log_(net_log) {} | |
| 41 | |
| 42 BlimpClientSessionManager::~BlimpClientSessionManager() {} | |
| 43 | |
| 44 void BlimpClientSessionManager::AttachTestClientSession() { | |
| 45 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
| |
| 46 if (!active_session_) | |
| 47 active_session_.reset( | |
| 48 new BlimpClientSession(gfx::Size(BlimpScreen::kDefaultDisplayWidth, | |
| 49 BlimpScreen::kDefaultDisplayHeight), | |
| 50 GetStartupURL())); | |
| 51 delegate_->AttachClientSession(active_session_.get()); | |
| 52 } | |
| 53 | |
| 54 } // namespace engine | |
| 55 } // namespace blimp | |
| OLD | NEW |