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

Side by Side Diff: components/omnibox/browser/physical_web_provider.cc

Issue 2561493002: Pass Physical Web metadata through a struct (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/memory/ptr_util.h" 5 #include "base/memory/ptr_util.h"
6 #include "base/metrics/histogram_macros.h" 6 #include "base/metrics/histogram_macros.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "components/omnibox/browser/autocomplete_provider_client.h" 9 #include "components/omnibox/browser/autocomplete_provider_client.h"
10 #include "components/omnibox/browser/autocomplete_provider_listener.h" 10 #include "components/omnibox/browser/autocomplete_provider_listener.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 physical_web::PhysicalWebDataSource* data_source = 68 physical_web::PhysicalWebDataSource* data_source =
69 client_->GetPhysicalWebDataSource(); 69 client_->GetPhysicalWebDataSource();
70 if (!data_source) { 70 if (!data_source) {
71 done_ = true; 71 done_ = true;
72 nearby_url_count_ = 0; 72 nearby_url_count_ = 0;
73 return; 73 return;
74 } 74 }
75 75
76 ConstructMatches(data_source->GetMetadata().get()); 76 ConstructMatches(data_source->GetMetadataListValue().get());
mattreynolds 2016/12/07 19:55:31 There's another GetMetadata() caller that will nee
cco3 2016/12/08 23:52:50 Done.
77 77
78 // Physical Web matches should never be default. If the omnibox input is 78 // Physical Web matches should never be default. If the omnibox input is
79 // non-empty and we have at least one Physical Web match, add the current URL 79 // non-empty and we have at least one Physical Web match, add the current URL
80 // as the default so that hitting enter after focusing the omnibox causes the 80 // as the default so that hitting enter after focusing the omnibox causes the
81 // current page to reload. If the input field is empty, no default match is 81 // current page to reload. If the input field is empty, no default match is
82 // required. 82 // required.
83 if (!matches_.empty() && !input.text().empty()) { 83 if (!matches_.empty() && !input.text().empty()) {
84 matches_.push_back(VerbatimMatchForURL(client_, input, input.current_url(), 84 matches_.push_back(VerbatimMatchForURL(client_, input, input.current_url(),
85 history_url_provider_, -1)); 85 history_url_provider_, -1));
86 } 86 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 AutocompleteInput::FormattedStringWithEquivalentMeaning( 205 AutocompleteInput::FormattedStringWithEquivalentMeaning(
206 url, match.contents, client_->GetSchemeClassifier()); 206 url, match.contents, client_->GetSchemeClassifier());
207 207
208 match.description = 208 match.description =
209 l10n_util::GetStringUTF16(IDS_PHYSICAL_WEB_OVERFLOW_DESCRIPTION); 209 l10n_util::GetStringUTF16(IDS_PHYSICAL_WEB_OVERFLOW_DESCRIPTION);
210 match.description_class.push_back( 210 match.description_class.push_back(
211 ACMatchClassification(0, ACMatchClassification::NONE)); 211 ACMatchClassification(0, ACMatchClassification::NONE));
212 212
213 matches_.push_back(match); 213 matches_.push_back(match);
214 } 214 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698