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/devtools_ui_bindings.h" | 5 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 LOG(ERROR) << "Attempt to start unknown event listener " << event_type; | 589 LOG(ERROR) << "Attempt to start unknown event listener " << event_type; |
590 } | 590 } |
591 } | 591 } |
592 | 592 |
593 void DevToolsUIBindings::Unsubscribe(const std::string& event_type) { | 593 void DevToolsUIBindings::Unsubscribe(const std::string& event_type) { |
594 if (subscribers_.find(event_type) == subscribers_.end()) { | 594 if (subscribers_.find(event_type) == subscribers_.end()) { |
595 LOG(ERROR) << "Not yet subscribed for [" << event_type << "]"; | 595 LOG(ERROR) << "Not yet subscribed for [" << event_type << "]"; |
596 return; | 596 return; |
597 } | 597 } |
598 | 598 |
599 subscribers_.erase(event_type); | |
600 | |
601 if (event_type == kDevicesChanged) { | 599 if (event_type == kDevicesChanged) { |
602 remote_targets_handler_.reset(); | 600 remote_targets_handler_.reset(); |
603 } else if (event_type == kDeviceCountChanged) { | 601 } else if (event_type == kDeviceCountChanged) { |
604 EnableRemoteDeviceCounter(false); | 602 EnableRemoteDeviceCounter(false); |
605 } else { | 603 } else { |
606 LOG(ERROR) << "Attempt to stop unknown event listener " << event_type; | 604 LOG(ERROR) << "Attempt to stop unknown event listener " << event_type; |
607 } | 605 } |
| 606 |
| 607 subscribers_.erase(event_type); |
608 } | 608 } |
609 | 609 |
610 void DevToolsUIBindings::EnableRemoteDeviceCounter(bool enable) { | 610 void DevToolsUIBindings::EnableRemoteDeviceCounter(bool enable) { |
611 DevToolsAndroidBridge* adb_bridge = | 611 DevToolsAndroidBridge* adb_bridge = |
612 DevToolsAndroidBridge::Factory::GetForProfile(profile_); | 612 DevToolsAndroidBridge::Factory::GetForProfile(profile_); |
613 if (!adb_bridge) | 613 if (!adb_bridge) |
614 return; | 614 return; |
615 | 615 |
616 DCHECK(device_listener_enabled_ != enable); | 616 DCHECK(device_listener_enabled_ != enable); |
617 device_listener_enabled_ = enable; | 617 device_listener_enabled_ = enable; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 NULL); | 805 NULL); |
806 } | 806 } |
807 | 807 |
808 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { | 808 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { |
809 // Call delegate first - it seeds importants bit of information. | 809 // Call delegate first - it seeds importants bit of information. |
810 delegate_->OnLoadCompleted(); | 810 delegate_->OnLoadCompleted(); |
811 | 811 |
812 UpdateTheme(); | 812 UpdateTheme(); |
813 AddDevToolsExtensionsToClient(); | 813 AddDevToolsExtensionsToClient(); |
814 } | 814 } |
OLD | NEW |