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

Unified Diff: chrome/browser/extensions/api/dial/dial_registry.cc

Issue 2583853004: [chrome.dial] Adds chrome.dial.fetchDeviceDecription API. (Closed)
Patch Set: Respond to imcheng@ comments Created 3 years, 12 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
Index: chrome/browser/extensions/api/dial/dial_registry.cc
diff --git a/chrome/browser/extensions/api/dial/dial_registry.cc b/chrome/browser/extensions/api/dial/dial_registry.cc
index f3cbe46ef07475adb6df57c9d42e37b5493ab561..453a5a0afe7eb6a6d5aad8986f73695577d1d649 100644
--- a/chrome/browser/extensions/api/dial/dial_registry.cc
+++ b/chrome/browser/extensions/api/dial/dial_registry.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/api/dial/dial_registry.h"
#include <memory>
+#include <utility>
#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
@@ -82,6 +83,23 @@ void DialRegistry::OnListenerRemoved() {
}
}
+GURL DialRegistry::GetDeviceDescriptionURL(const std::string& label) const {
+ const auto device_it = device_by_label_map_.find(label);
+ if (device_it != device_by_label_map_.end())
+ return device_it->second->device_description_url();
+
+ return GURL();
+}
+
+void DialRegistry::AddDeviceForTest(const DialDeviceData& device_data) {
+ std::unique_ptr<DialDeviceData> test_data =
+ base::MakeUnique<DialDeviceData>(device_data);
+ device_by_label_map_.insert(
+ std::make_pair(device_data.label(), test_data.get()));
+ device_by_id_map_.insert(
+ std::make_pair(device_data.device_id(), std::move(test_data)));
+}
+
bool DialRegistry::ReadyToDiscover() {
if (num_listeners_ == 0) {
dial_api_->OnDialError(DIAL_NO_LISTENERS);

Powered by Google App Engine
This is Rietveld 408576698