Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: chrome/browser/search_engines/template_url_fetcher.h

Issue 6291003: Revert 71485 - Remove wstring from TemplateURL and friends.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/scoped_vector.h" 9 #include "base/scoped_vector.h"
10 #include "base/string16.h"
11 #include "gfx/native_widget_types.h" 10 #include "gfx/native_widget_types.h"
12 11
13 class GURL; 12 class GURL;
14 class Profile; 13 class Profile;
15 class TemplateURL; 14 class TemplateURL;
16 class TemplateURLFetcherCallbacks; 15 class TemplateURLFetcherCallbacks;
17 16
18 // TemplateURLFetcher is responsible for downloading OpenSearch description 17 // TemplateURLFetcher is responsible for downloading OpenSearch description
19 // documents, creating a TemplateURL from the OSDD, and adding the TemplateURL 18 // documents, creating a TemplateURL from the OSDD, and adding the TemplateURL
20 // to the TemplateURLModel. Downloading is done in the background. 19 // to the TemplateURLModel. Downloading is done in the background.
21 // 20 //
22 class TemplateURLFetcher { 21 class TemplateURLFetcher {
23 public: 22 public:
24 enum ProviderType { 23 enum ProviderType {
25 AUTODETECTED_PROVIDER, 24 AUTODETECTED_PROVIDER,
26 EXPLICIT_PROVIDER, // Supplied by Javascript. 25 EXPLICIT_PROVIDER, // Supplied by Javascript.
27 EXPLICIT_DEFAULT_PROVIDER // Supplied by Javascript as default provider. 26 EXPLICIT_DEFAULT_PROVIDER // Supplied by Javascript as default provider.
28 }; 27 };
29 28
30 // Creates a TemplateURLFetcher with the specified Profile. 29 // Creates a TemplateURLFetcher with the specified Profile.
31 explicit TemplateURLFetcher(Profile* profile); 30 explicit TemplateURLFetcher(Profile* profile);
32 ~TemplateURLFetcher(); 31 ~TemplateURLFetcher();
33 32
34 // If TemplateURLFetcher is not already downloading the OSDD for osdd_url, 33 // If TemplateURLFetcher is not already downloading the OSDD for osdd_url,
35 // it is downloaded. If successful and the result can be parsed, a TemplateURL 34 // it is downloaded. If successful and the result can be parsed, a TemplateURL
36 // is added to the TemplateURLModel. Takes ownership of |callbacks|. 35 // is added to the TemplateURLModel. Takes ownership of |callbacks|.
37 void ScheduleDownload(const string16& keyword, 36 void ScheduleDownload(const std::wstring& keyword,
38 const GURL& osdd_url, 37 const GURL& osdd_url,
39 const GURL& favicon_url, 38 const GURL& favicon_url,
40 TemplateURLFetcherCallbacks* callbacks, 39 TemplateURLFetcherCallbacks* callbacks,
41 ProviderType provider_type); 40 ProviderType provider_type);
42 41
43 // The current number of outstanding requests. 42 // The current number of outstanding requests.
44 int requests_count() const { return requests_->size(); } 43 int requests_count() const { return requests_->size(); }
45 44
46 private: 45 private:
47 friend class RequestDelegate; 46 friend class RequestDelegate;
48 47
49 // A RequestDelegate is created to download each OSDD. When done downloading 48 // A RequestDelegate is created to download each OSDD. When done downloading
50 // RequestCompleted is invoked back on the TemplateURLFetcher. 49 // RequestCompleted is invoked back on the TemplateURLFetcher.
51 class RequestDelegate; 50 class RequestDelegate;
52 51
53 Profile* profile() const { return profile_; } 52 Profile* profile() const { return profile_; }
54 53
55 // Invoked from the RequestDelegate when done downloading. 54 // Invoked from the RequestDelegate when done downloading.
56 void RequestCompleted(RequestDelegate* request); 55 void RequestCompleted(RequestDelegate* request);
57 56
58 Profile* profile_; 57 Profile* profile_;
59 58
60 // In progress requests. 59 // In progress requests.
61 ScopedVector<RequestDelegate> requests_; 60 ScopedVector<RequestDelegate> requests_;
62 61
63 DISALLOW_COPY_AND_ASSIGN(TemplateURLFetcher); 62 DISALLOW_COPY_AND_ASSIGN(TemplateURLFetcher);
64 }; 63 };
65 64
66 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_FETCHER_H_ 65 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_FETCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url.cc ('k') | chrome/browser/search_engines/template_url_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698