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 #include "chrome/browser/ui/webui/ntp/suggestions_source_discovery.h" | 5 #include "chrome/browser/ui/webui/ntp/suggestions_source_discovery.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 void SuggestionsSourceDiscovery::FetchItems(Profile* profile) { | 62 void SuggestionsSourceDiscovery::FetchItems(Profile* profile) { |
63 DCHECK(combiner_); | 63 DCHECK(combiner_); |
64 | 64 |
65 // If a fetch is already in progress, we don't have to start a new one. | 65 // If a fetch is already in progress, we don't have to start a new one. |
66 if (recommended_fetcher_ != NULL) | 66 if (recommended_fetcher_ != NULL) |
67 return; | 67 return; |
68 | 68 |
69 // TODO(beaudoin): Extract the URL to some preference. Use a better service. | 69 // TODO(beaudoin): Extract the URL to some preference. Use a better service. |
70 recommended_fetcher_.reset(content::URLFetcher::Create( | 70 recommended_fetcher_.reset(content::URLFetcher::Create( |
71 GURL(kDiscoveryBackendURL), content::URLFetcher::GET, this)); | 71 GURL(kDiscoveryBackendURL), net::URLFetcher::GET, this)); |
72 recommended_fetcher_->SetRequestContext( | 72 recommended_fetcher_->SetRequestContext( |
73 g_browser_process->system_request_context()); | 73 g_browser_process->system_request_context()); |
74 recommended_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 74 recommended_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
75 net::LOAD_DO_NOT_SAVE_COOKIES); | 75 net::LOAD_DO_NOT_SAVE_COOKIES); |
76 recommended_fetcher_->Start(); | 76 recommended_fetcher_->Start(); |
77 } | 77 } |
78 | 78 |
79 void SuggestionsSourceDiscovery::SetCombiner(SuggestionsCombiner* combiner) { | 79 void SuggestionsSourceDiscovery::SetCombiner(SuggestionsCombiner* combiner) { |
80 DCHECK(!combiner_); | 80 DCHECK(!combiner_); |
81 combiner_ = combiner; | 81 combiner_ = combiner; |
(...skipping 30 matching lines...) Expand all Loading... |
112 unescaped_url, | 112 unescaped_url, |
113 GURL(unescaped_url)); | 113 GURL(unescaped_url)); |
114 items_.push_back(page_value); | 114 items_.push_back(page_value); |
115 } | 115 } |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 recommended_fetcher_.reset(); | 119 recommended_fetcher_.reset(); |
120 combiner_->OnItemsReady(); | 120 combiner_->OnItemsReady(); |
121 } | 121 } |
OLD | NEW |