| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_DISCOVERY_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_DISCOVERY_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_DISCOVERY_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_DISCOVERY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 | 10 |
| 11 #include "chrome/browser/cancelable_request.h" | 11 #include "chrome/browser/cancelable_request.h" |
| 12 #include "chrome/browser/history/history_types.h" | 12 #include "chrome/browser/history/history_types.h" |
| 13 #include "chrome/browser/ui/webui/ntp/suggestions_source.h" | 13 #include "chrome/browser/ui/webui/ntp/suggestions_source.h" |
| 14 #include "content/public/common/url_fetcher_delegate.h" | 14 #include "net/url_request/url_fetcher_delegate.h" |
| 15 | 15 |
| 16 class SuggestionsCombiner; | 16 class SuggestionsCombiner; |
| 17 class Profile; | 17 class Profile; |
| 18 class URLFetcher; | |
| 19 | 18 |
| 20 namespace base { | 19 namespace base { |
| 21 class DictionaryValue; | 20 class DictionaryValue; |
| 22 } | 21 } |
| 23 | 22 |
| 23 namespace net { |
| 24 class URLFetcher; |
| 25 } |
| 26 |
| 24 // A source that suggests websites the user might find interesting. | 27 // A source that suggests websites the user might find interesting. |
| 25 class SuggestionsSourceDiscovery : public SuggestionsSource, | 28 class SuggestionsSourceDiscovery : public SuggestionsSource, |
| 26 public content::URLFetcherDelegate { | 29 public net::URLFetcherDelegate { |
| 27 public: | 30 public: |
| 28 SuggestionsSourceDiscovery(); | 31 SuggestionsSourceDiscovery(); |
| 29 virtual ~SuggestionsSourceDiscovery(); | 32 virtual ~SuggestionsSourceDiscovery(); |
| 30 | 33 |
| 31 // content::URLFetcherDelegate override and implementation. | 34 // net::URLFetcherDelegate override and implementation. |
| 32 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 35 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| 33 | 36 |
| 34 protected: | 37 protected: |
| 35 // SuggestionsSource overrides: | 38 // SuggestionsSource overrides: |
| 36 virtual int GetWeight() OVERRIDE; | 39 virtual int GetWeight() OVERRIDE; |
| 37 virtual int GetItemCount() OVERRIDE; | 40 virtual int GetItemCount() OVERRIDE; |
| 38 virtual base::DictionaryValue* PopItem() OVERRIDE; | 41 virtual base::DictionaryValue* PopItem() OVERRIDE; |
| 39 virtual void FetchItems(Profile* profile) OVERRIDE; | 42 virtual void FetchItems(Profile* profile) OVERRIDE; |
| 40 virtual void SetCombiner(SuggestionsCombiner* combiner) OVERRIDE; | 43 virtual void SetCombiner(SuggestionsCombiner* combiner) OVERRIDE; |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 // Our combiner. | 46 // Our combiner. |
| 44 SuggestionsCombiner* combiner_; | 47 SuggestionsCombiner* combiner_; |
| 45 | 48 |
| 46 // Keep the results fetched from the discovery service here. | 49 // Keep the results fetched from the discovery service here. |
| 47 std::deque<base::DictionaryValue*> items_; | 50 std::deque<base::DictionaryValue*> items_; |
| 48 | 51 |
| 49 // Fetcher for the recommended pages. | 52 // Fetcher for the recommended pages. |
| 50 scoped_ptr<content::URLFetcher> recommended_fetcher_; | 53 scoped_ptr<net::URLFetcher> recommended_fetcher_; |
| 51 | 54 |
| 52 DISALLOW_COPY_AND_ASSIGN(SuggestionsSourceDiscovery); | 55 DISALLOW_COPY_AND_ASSIGN(SuggestionsSourceDiscovery); |
| 53 }; | 56 }; |
| 54 | 57 |
| 55 #endif // CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_DISCOVERY_H_ | 58 #endif // CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_DISCOVERY_H_ |
| OLD | NEW |