| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "content/shell/browser/layout_test/layout_test_bluetooth_chooser_factor
y.h" | 5 #include "content/shell/browser/layout_test/layout_test_bluetooth_chooser_factor
y.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 break; | 54 break; |
| 55 case DiscoveryState::DISCOVERING: | 55 case DiscoveryState::DISCOVERING: |
| 56 factory_->events_.push_back("discovering"); | 56 factory_->events_.push_back("discovering"); |
| 57 break; | 57 break; |
| 58 case DiscoveryState::IDLE: | 58 case DiscoveryState::IDLE: |
| 59 factory_->events_.push_back("discovery-idle"); | 59 factory_->events_.push_back("discovery-idle"); |
| 60 break; | 60 break; |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 void AddDevice(const std::string& device_id, | 64 void AddOrUpdateDevice(const std::string& device_id, |
| 65 const base::string16& device_name) override { | 65 const base::string16& device_name) override { |
| 66 CheckFactory(); | 66 CheckFactory(); |
| 67 std::string event = "add-device("; | 67 std::string event = "add-device("; |
| 68 event += base::UTF16ToUTF8(device_name); | 68 event += base::UTF16ToUTF8(device_name); |
| 69 event += ")="; | 69 event += ")="; |
| 70 event += device_id; | 70 event += device_id; |
| 71 factory_->events_.push_back(event); | 71 factory_->events_.push_back(event); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void RemoveDevice(const std::string& device_id) override { | 74 void RemoveDevice(const std::string& device_id) override { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 const std::string& device_id) { | 125 const std::string& device_id) { |
| 126 // Copy |choosers_| to make sure event handler executions that modify | 126 // Copy |choosers_| to make sure event handler executions that modify |
| 127 // |choosers_| don't invalidate iterators. | 127 // |choosers_| don't invalidate iterators. |
| 128 std::vector<Chooser*> choosers_copy(choosers_.begin(), choosers_.end()); | 128 std::vector<Chooser*> choosers_copy(choosers_.begin(), choosers_.end()); |
| 129 for (Chooser* chooser : choosers_copy) { | 129 for (Chooser* chooser : choosers_copy) { |
| 130 chooser->event_handler.Run(event, device_id); | 130 chooser->event_handler.Run(event, device_id); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace content | 134 } // namespace content |
| OLD | NEW |