Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Unified Diff: blimp/engine/session/blimp_engine_session.cc

Issue 2292563003: Add command line flag to allow testing clients not connected to localhost. Otherwise, restrict conn… (Closed)
Patch Set: Address review comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/engine/app/switches.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/engine/session/blimp_engine_session.cc
diff --git a/blimp/engine/session/blimp_engine_session.cc b/blimp/engine/session/blimp_engine_session.cc
index 9029e8de941b580274a98a9b0c5eed7ad3f75b5a..309360033b242f1d5270f28f513af9bbd5d4c73b 100644
--- a/blimp/engine/session/blimp_engine_session.cc
+++ b/blimp/engine/session/blimp_engine_session.cc
@@ -87,10 +87,6 @@ class FocusRulesImpl : public wm::BaseFocusRules {
DISALLOW_COPY_AND_ASSIGN(FocusRulesImpl);
};
-net::IPAddress GetIPv4AnyAddress() {
- return net::IPAddress(0, 0, 0, 0);
-}
-
// Proxies calls to TaskRunner::PostTask while stripping the return value,
// which provides a suitable function prototype for binding a base::Closure.
void PostTask(const scoped_refptr<base::TaskRunner>& task_runner,
@@ -104,6 +100,13 @@ base::Closure QuitCurrentMessageLoopClosure() {
base::MessageLoop::QuitWhenIdleClosure());
}
+net::IPAddress GetListeningAddress() {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(kAllowNonLocalhost)) {
+ return net::IPAddress::IPv4AllZeros();
+ }
+ return net::IPAddress::IPv4Localhost();
+}
+
uint16_t GetListeningPort() {
unsigned port_parsed = 0;
if (!base::StringToUint(
@@ -194,7 +197,7 @@ void EngineNetworkComponents::Initialize(
base::MakeUnique<BlobChannelService>(blob_channel_sender, ui_task_runner);
// Adds BlimpTransports to connection_manager_.
- net::IPEndPoint address(GetIPv4AnyAddress(), GetListeningPort());
+ net::IPEndPoint address(GetListeningAddress(), GetListeningPort());
TCPEngineTransport* transport = new TCPEngineTransport(address, net_log_);
connection_manager_->AddTransport(base::WrapUnique(transport));
« no previous file with comments | « blimp/engine/app/switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698