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 "chrome/browser/devtools/device/port_forwarding_controller.h" | 5 #include "chrome/browser/devtools/device/port_forwarding_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 pref_service_(profile->GetPrefs()), | 528 pref_service_(profile->GetPrefs()), |
529 listening_(false) { | 529 listening_(false) { |
530 pref_change_registrar_.Init(pref_service_); | 530 pref_change_registrar_.Init(pref_service_); |
531 base::Closure callback = base::Bind( | 531 base::Closure callback = base::Bind( |
532 &PortForwardingController::OnPrefsChange, base::Unretained(this)); | 532 &PortForwardingController::OnPrefsChange, base::Unretained(this)); |
533 pref_change_registrar_.Add(prefs::kDevToolsPortForwardingEnabled, callback); | 533 pref_change_registrar_.Add(prefs::kDevToolsPortForwardingEnabled, callback); |
534 pref_change_registrar_.Add(prefs::kDevToolsPortForwardingConfig, callback); | 534 pref_change_registrar_.Add(prefs::kDevToolsPortForwardingConfig, callback); |
535 OnPrefsChange(); | 535 OnPrefsChange(); |
536 } | 536 } |
537 | 537 |
538 PortForwardingController::~PortForwardingController() { | 538 |
| 539 PortForwardingController::~PortForwardingController() {} |
| 540 |
| 541 void PortForwardingController::Shutdown() { |
539 // Existing connection will not be shut down. This might be confusing for | 542 // Existing connection will not be shut down. This might be confusing for |
540 // some users, but the opposite is more confusing. | 543 // some users, but the opposite is more confusing. |
541 StopListening(); | 544 StopListening(); |
542 } | 545 } |
543 | 546 |
544 void PortForwardingController::AddListener(Listener* listener) { | 547 void PortForwardingController::AddListener(Listener* listener) { |
545 listeners_.push_back(listener); | 548 listeners_.push_back(listener); |
546 } | 549 } |
547 | 550 |
548 void PortForwardingController::RemoveListener(Listener* listener) { | 551 void PortForwardingController::RemoveListener(Listener* listener) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 "PortForwardingController", | 662 "PortForwardingController", |
660 BrowserContextDependencyManager::GetInstance()) {} | 663 BrowserContextDependencyManager::GetInstance()) {} |
661 | 664 |
662 PortForwardingController::Factory::~Factory() {} | 665 PortForwardingController::Factory::~Factory() {} |
663 | 666 |
664 KeyedService* PortForwardingController::Factory::BuildServiceInstanceFor( | 667 KeyedService* PortForwardingController::Factory::BuildServiceInstanceFor( |
665 content::BrowserContext* context) const { | 668 content::BrowserContext* context) const { |
666 Profile* profile = Profile::FromBrowserContext(context); | 669 Profile* profile = Profile::FromBrowserContext(context); |
667 return new PortForwardingController(profile); | 670 return new PortForwardingController(profile); |
668 } | 671 } |
OLD | NEW |