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

Unified Diff: components/omnibox/browser/shortcut_match.h

Issue 1877833002: Optimize shortcuts provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added new files Created 4 years, 8 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
Index: components/omnibox/browser/shortcut_match.h
diff --git a/components/omnibox/browser/shortcut_match.h b/components/omnibox/browser/shortcut_match.h
new file mode 100644
index 0000000000000000000000000000000000000000..b6534d27c1782dc67d9a55a457884de75c39eafd
--- /dev/null
+++ b/components/omnibox/browser/shortcut_match.h
@@ -0,0 +1,37 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
Peter Kasting 2016/04/12 00:55:08 Nit: Wrong copyright header (no (c))
Alexander Yashkin 2016/04/12 09:09:20 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_OMNIBOX_BROWSER_SHORTCUT_MATCH_H_
+#define COMPONENTS_OMNIBOX_BROWSER_SHORTCUT_MATCH_H_
+
+#include <vector>
+
+#include "base/strings/string16.h"
+#include "components/omnibox/browser/shortcuts_backend.h"
+#include "url/gurl.h"
+
+// Structure that describes match from shortcut database. It holds only
+// information necessary for shortcut deduplication and relevance sort.
+// It is converted to AutocompleteMatch at final stage of shortcuts provider
+// processing.
Peter Kasting 2016/04/12 00:55:08 Nit: How about: ShortcutMatch holds sufficient in
Alexander Yashkin 2016/04/12 09:09:20 Done, thanks.
+struct ShortcutMatch {
+ ShortcutMatch(int relevance,
+ const GURL& stripped_destination_url,
+ const ShortcutsDatabase::Shortcut* shortcut);
+ static bool DestinationsEqual(const ShortcutMatch& elem1,
Peter Kasting 2016/04/12 00:55:08 Why are these next two methods static on this clas
Alexander Yashkin 2016/04/12 09:09:20 I agree that DedupShortcutMatchesByDestination is
+ const ShortcutMatch& elem2);
+ static void DedupShortcutMatchesByDestination(
+ metrics::OmniboxEventProto::PageClassification page_classification,
+ std::vector<ShortcutMatch>* matches);
+
+ int relevance;
+ GURL stripped_destination_url;
+ const ShortcutsDatabase::Shortcut* shortcut;
+ base::string16 contents;
+ AutocompleteMatch::Type type;
+};
+
+typedef std::vector<ShortcutMatch> ShortcutMatches;
+
+#endif // COMPONENTS_YANDEX_OMNIBOX_BROWSER_SHORTCUT_MATCH_H_

Powered by Google App Engine
This is Rietveld 408576698