| 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_SEARCH_ENGINES_TEMPLATE_URL_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_FETCHER_H_ |
| 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_FETCHER_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_FETCHER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // |web_contents| specifies which WebContents displays the page the OSDD is | 48 // |web_contents| specifies which WebContents displays the page the OSDD is |
| 49 // downloaded for. |web_contents| must not be NULL, except during tests. | 49 // downloaded for. |web_contents| must not be NULL, except during tests. |
| 50 void ScheduleDownload(const string16& keyword, | 50 void ScheduleDownload(const string16& keyword, |
| 51 const GURL& osdd_url, | 51 const GURL& osdd_url, |
| 52 const GURL& favicon_url, | 52 const GURL& favicon_url, |
| 53 content::WebContents* web_contents, | 53 content::WebContents* web_contents, |
| 54 TemplateURLFetcherCallbacks* callbacks, | 54 TemplateURLFetcherCallbacks* callbacks, |
| 55 ProviderType provider_type); | 55 ProviderType provider_type); |
| 56 | 56 |
| 57 // The current number of outstanding requests. | 57 // The current number of outstanding requests. |
| 58 int requests_count() const { return requests_->size(); } | 58 int requests_count() const { return requests_.size(); } |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 // A RequestDelegate is created to download each OSDD. When done downloading | 61 // A RequestDelegate is created to download each OSDD. When done downloading |
| 62 // RequestCompleted is invoked back on the TemplateURLFetcher. | 62 // RequestCompleted is invoked back on the TemplateURLFetcher. |
| 63 class RequestDelegate; | 63 class RequestDelegate; |
| 64 friend class RequestDelegate; | 64 friend class RequestDelegate; |
| 65 | 65 |
| 66 typedef ScopedVector<RequestDelegate> Requests; | 66 typedef ScopedVector<RequestDelegate> Requests; |
| 67 | 67 |
| 68 Profile* profile() const { return profile_; } | 68 Profile* profile() const { return profile_; } |
| 69 | 69 |
| 70 // Invoked from the RequestDelegate when done downloading. | 70 // Invoked from the RequestDelegate when done downloading. |
| 71 void RequestCompleted(RequestDelegate* request); | 71 void RequestCompleted(RequestDelegate* request); |
| 72 | 72 |
| 73 Profile* profile_; | 73 Profile* profile_; |
| 74 | 74 |
| 75 // In progress requests. | 75 // In progress requests. |
| 76 Requests requests_; | 76 Requests requests_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(TemplateURLFetcher); | 78 DISALLOW_COPY_AND_ASSIGN(TemplateURLFetcher); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_FETCHER_H_ | 81 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_FETCHER_H_ |
| OLD | NEW |