OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 ~Listener() override { | 56 ~Listener() override { |
57 DevToolsAndroidBridge::Factory::GetForProfile(profile_)-> | 57 DevToolsAndroidBridge::Factory::GetForProfile(profile_)-> |
58 RemovePortForwardingListener(this); | 58 RemovePortForwardingListener(this); |
59 } | 59 } |
60 | 60 |
61 void PortStatusChanged(const ForwardingStatus& status) override { | 61 void PortStatusChanged(const ForwardingStatus& status) override { |
62 if (status.empty() && skip_empty_devices_) | 62 if (status.empty() && skip_empty_devices_) |
63 return; | 63 return; |
64 base::ThreadTaskRunnerHandle::Get()->PostTask( | 64 base::ThreadTaskRunnerHandle::Get()->PostTask( |
65 FROM_HERE, base::MessageLoop::QuitClosure()); | 65 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
66 } | 66 } |
67 | 67 |
68 void set_skip_empty_devices(bool skip_empty_devices) { | 68 void set_skip_empty_devices(bool skip_empty_devices) { |
69 skip_empty_devices_ = skip_empty_devices; | 69 skip_empty_devices_ = skip_empty_devices; |
70 } | 70 } |
71 | 71 |
72 private: | 72 private: |
73 Profile* profile_; | 73 Profile* profile_; |
74 bool skip_empty_devices_; | 74 bool skip_empty_devices_; |
75 }; | 75 }; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 base::DictionaryValue config; | 171 base::DictionaryValue config; |
172 config.SetString( | 172 config.SetString( |
173 forwarding_port, original_url.host() + ":" + original_url.port()); | 173 forwarding_port, original_url.host() + ":" + original_url.port()); |
174 prefs->Set(prefs::kDevToolsPortForwardingConfig, config); | 174 prefs->Set(prefs::kDevToolsPortForwardingConfig, config); |
175 | 175 |
176 scoped_ptr<Listener> wait_for_port_forwarding(new Listener(profile)); | 176 scoped_ptr<Listener> wait_for_port_forwarding(new Listener(profile)); |
177 content::RunMessageLoop(); | 177 content::RunMessageLoop(); |
178 | 178 |
179 self_provider->set_release_callback_for_test( | 179 self_provider->set_release_callback_for_test( |
180 base::Bind(&base::MessageLoop::PostTask, | 180 base::Bind(&base::MessageLoop::PostTask, |
181 base::Unretained(base::MessageLoop::current()), | 181 base::Unretained(base::MessageLoop::current()), FROM_HERE, |
182 FROM_HERE, | 182 base::MessageLoop::QuitWhenIdleClosure())); |
183 base::MessageLoop::QuitClosure())); | |
184 wait_for_port_forwarding.reset(); | 183 wait_for_port_forwarding.reset(); |
185 content::RunMessageLoop(); | 184 content::RunMessageLoop(); |
186 } | 185 } |
OLD | NEW |