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: chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h

Issue 775893005: [AppList] Add a Suggestions Provider to applist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fix 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: chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h
diff --git a/chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h b/chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h
new file mode 100644
index 0000000000000000000000000000000000000000..6152ada0100e059124a639d990f33cb56b88f59a
--- /dev/null
+++ b/chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h
@@ -0,0 +1,57 @@
+// 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 CHROME_BROWSER_UI_APP_LIST_SEARCH_SUGGESTIONS_URL_SUGGESTION_RESULT_H_
+#define CHROME_BROWSER_UI_APP_LIST_SEARCH_SUGGESTIONS_URL_SUGGESTION_RESULT_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "components/suggestions/proto/suggestions.pb.h"
+#include "ui/app_list/search_result.h"
+
+class AppListControllerDelegate;
+class GURL;
+class Profile;
+class SkBitmap;
+
+namespace suggestions {
+class SuggestionsService;
+} // namespace suggestions
+
+namespace app_list {
+
+class URLSuggestionResult : public SearchResult {
+ public:
+ // |suggestion| is copied to a local member, because this SuggestionResult is
+ // expected to live longer that |suggestions|.
+ URLSuggestionResult(Profile* profile,
+ AppListControllerDelegate* list_controller,
+ suggestions::SuggestionsService* suggestions_service,
+ const suggestions::ChromeSuggestion& suggestion);
+ ~URLSuggestionResult() override;
+
+ // SearchResult overrides:
+ void Open(int event_flags) override;
+ scoped_ptr<SearchResult> Duplicate() override;
+
+ // Refer to SearchResult::set_relevance for documentation.
+ using SearchResult::set_relevance;
+
+ private:
+ void UpdateIcon();
+ void OnSuggestionsThumbnailAvailable(const GURL& url, const SkBitmap* bitmap);
+
+ Profile* profile_;
+ AppListControllerDelegate* list_controller_;
+ suggestions::SuggestionsService* suggestions_service_;
+ suggestions::ChromeSuggestion suggestion_;
+
+ // For callbacks that may be run after destruction.
+ base::WeakPtrFactory<URLSuggestionResult> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(URLSuggestionResult);
+};
+
+} // namespace app_list
+
+#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_SUGGESTIONS_URL_SUGGESTION_RESULT_H_

Powered by Google App Engine
This is Rietveld 408576698