Chromium Code Reviews| Index: components/omnibox/browser/physical_web_node.cc |
| diff --git a/components/omnibox/browser/physical_web_node.cc b/components/omnibox/browser/physical_web_node.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..893da436d9a57ee0611da72bddcf002b754ecee6 |
| --- /dev/null |
| +++ b/components/omnibox/browser/physical_web_node.cc |
| @@ -0,0 +1,30 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "components/omnibox/browser/physical_web_node.h" |
| + |
| +#include "base/strings/utf_string_conversions.h" |
| +#include "base/values.h" |
| +#include "components/physical_web/data_source/physical_web_data_source.h" |
| + |
| +PhysicalWebNode::PhysicalWebNode(const base::DictionaryValue& metadata_item) { |
| + std::string title; |
| + std::string url; |
| + if (metadata_item.GetString(physical_web::kTitleKey, &title)) { |
| + node_title_ = base::UTF8ToUTF16(title); |
| + } |
| + if (metadata_item.GetString(physical_web::kResolvedUrlKey, &url)) { |
|
Mark P
2016/12/21 18:57:50
BTW, why do you use the resolved URL key here? Wh
mattreynolds
2016/12/21 22:25:58
The scanned URL is the URL broadcast by the Physic
Mark P
2016/12/21 23:21:40
Nice!
|
| + node_url_ = GURL(url); |
| + } |
| +} |
| + |
| +PhysicalWebNode::~PhysicalWebNode() = default; |
| + |
| +const base::string16& PhysicalWebNode::GetTitledUrlNodeTitle() const { |
| + return node_title_; |
| +} |
| + |
| +const GURL& PhysicalWebNode::GetTitledUrlNodeUrl() const { |
| + return node_url_; |
| +} |