1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_DISCOVERY_H_ 6 #define CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_DISCOVERY_H_ 7 8 #include <deque> 9 #include <string> 10 11 #include "base/basictypes.h" 12 #include "base/compiler_specific.h" 13 #include "chrome/browser/ui/webui/ntp/suggestions_source.h" 14 15 class SuggestionsCombiner; 16 class Profile; 17 18 namespace base { 19 class DictionaryValue; 20 } 21 22 // A source linked to a single extension using the discovery API to suggest 23 // websites the user might find interesting. 24 class SuggestionsSourceDiscovery : public SuggestionsSource { 25 public: 26 explicit SuggestionsSourceDiscovery(const std::string& extension_id); 27 virtual ~SuggestionsSourceDiscovery(); 28 29 protected: 30 // SuggestionsSource overrides: 31 virtual void SetDebug(bool enable) OVERRIDE; 32 virtual int GetWeight() OVERRIDE; 33 virtual int GetItemCount() OVERRIDE; 34 virtual base::DictionaryValue* PopItem() OVERRIDE; 35 virtual void FetchItems(Profile* profile) OVERRIDE; 36 virtual void SetCombiner(SuggestionsCombiner* combiner) OVERRIDE; 37 38 private: 39 // Our combiner. 40 SuggestionsCombiner* combiner_; 41 42 // Keep the results fetched from the discovery service here. 43 std::deque<base::DictionaryValue*> items_; 44 45 // The extension associated with this source. 46 std::string extension_id_; 47 48 // Whether the source should provide additional debug information or not. 49 bool debug_; 50 51 DISALLOW_COPY_AND_ASSIGN(SuggestionsSourceDiscovery); 52 }; 53 54 #endif // CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_DISCOVERY_H_ 55