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

Unified Diff: components/autofill/core/browser/suggestion.h

Issue 772253003: Create an autofill Suggestion class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/suggestion.h
diff --git a/components/autofill/core/browser/suggestion.h b/components/autofill/core/browser/suggestion.h
new file mode 100644
index 0000000000000000000000000000000000000000..4427abb1e00497ce77720cad8177ad8e3c1b2d9d
--- /dev/null
+++ b/components/autofill/core/browser/suggestion.h
@@ -0,0 +1,60 @@
+// Copyright 2014 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.
+
+#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_SUGGESTION_H_
+#define COMPONENTS_AUTOFILL_CORE_BROWSER_SUGGESTION_H_
+
+#include <string>
+
+#include "base/strings/string16.h"
+
+namespace autofill {
+
+// Represents a single FormGroup and a specific data variant. This is assigned
+// by the storage layer to uniquely identify the profile this came from.
+struct SuggestionBackendID {
+ SuggestionBackendID();
+ SuggestionBackendID(const std::string& guid, size_t variant);
+ ~SuggestionBackendID();
+
+ std::string guid;
+ size_t variant;
+
+ // For using as a key in a map.
+ bool operator<(const SuggestionBackendID& other) const;
+};
+
+struct Suggestion {
+ Suggestion();
+ explicit Suggestion(const base::string16& value);
+
+ // Constructor for unit tests. It will convert the strings from UTF-8 to
+ // UTF-16.
+ Suggestion(const std::string& value,
+ const std::string& label,
+ const std::string& icon,
+ int frontend_id);
+
+ ~Suggestion();
+
+ // ID generated by the backend layer. This identifies the exact autofill
+ // profile that generated this suggestion.
+ SuggestionBackendID backend_id;
+
+ // ID for the frontend to use in identifying the particular result. Positive
+ // values are sent over IPC to identify the item selected. Negative values
+ // (see popup_item_ids.h) have special built-in meanings. Default initialized
+ // to 0.
+ int frontend_id;
+
+ base::string16 value;
+ base::string16 label;
+ base::string16 icon;
+
+ bool is_masked;
+};
+
+} // namespace autofill
+
+#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_SUGGESTION_H_
« no previous file with comments | « components/autofill/core/browser/personal_data_manager_unittest.cc ('k') | components/autofill/core/browser/suggestion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698