| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/omnibox/browser/physical_web_node.h" | 5 #include "components/omnibox/browser/physical_web_node.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/values.h" | |
| 9 #include "components/physical_web/data_source/physical_web_data_source.h" | 8 #include "components/physical_web/data_source/physical_web_data_source.h" |
| 10 | 9 |
| 11 PhysicalWebNode::PhysicalWebNode(const base::DictionaryValue& metadata_item) { | 10 PhysicalWebNode::PhysicalWebNode(const physical_web::Metadata& metadata_item) |
| 12 std::string title; | 11 : node_title_(base::UTF8ToUTF16(metadata_item.title)), |
| 13 std::string url; | 12 node_url_(metadata_item.resolved_url) { |
| 14 if (metadata_item.GetString(physical_web::kTitleKey, &title)) { | |
| 15 node_title_ = base::UTF8ToUTF16(title); | |
| 16 } | |
| 17 if (metadata_item.GetString(physical_web::kResolvedUrlKey, &url)) { | |
| 18 node_url_ = GURL(url); | |
| 19 } | |
| 20 } | 13 } |
| 21 | 14 |
| 22 PhysicalWebNode::~PhysicalWebNode() = default; | 15 PhysicalWebNode::~PhysicalWebNode() = default; |
| 23 | 16 |
| 24 const base::string16& PhysicalWebNode::GetTitledUrlNodeTitle() const { | 17 const base::string16& PhysicalWebNode::GetTitledUrlNodeTitle() const { |
| 25 return node_title_; | 18 return node_title_; |
| 26 } | 19 } |
| 27 | 20 |
| 28 const GURL& PhysicalWebNode::GetTitledUrlNodeUrl() const { | 21 const GURL& PhysicalWebNode::GetTitledUrlNodeUrl() const { |
| 29 return node_url_; | 22 return node_url_; |
| 30 } | 23 } |
| OLD | NEW |