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

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

Issue 2583853004: [chrome.dial] Adds chrome.dial.fetchDeviceDecription API. (Closed)
Patch Set: Rebase and fix typo. Created 3 years, 11 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
« no previous file with comments | « chrome/browser/extensions/api/dial/dial_registry.h ('k') | chrome/common/extensions/api/dial.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 55282c848d01f3bd19681e9cb2883940d0855600..752dbd69f9fe77c1bb67fceb361d0f43fecab297 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"
@@ -84,6 +85,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);
« no previous file with comments | « chrome/browser/extensions/api/dial/dial_registry.h ('k') | chrome/common/extensions/api/dial.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698