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

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

Issue 19721: Random bits of de-Winification for WebContents. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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
« no previous file with comments | « chrome/browser/printing/print_job.h ('k') | chrome/browser/shell_dialogs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 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_TEMPLATE_URL_FETCHER_H__ 5 #ifndef CHROME_BROWSER_TEMPLATE_URL_FETCHER_H_
6 #define CHROME_BROWSER_TEMPLATE_URL_FETCHER_H__ 6 #define CHROME_BROWSER_TEMPLATE_URL_FETCHER_H_
7 7
8 #include "base/gfx/native_widget_types.h"
8 #include "chrome/browser/net/url_fetcher.h" 9 #include "chrome/browser/net/url_fetcher.h"
9 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
10 #include "chrome/common/scoped_vector.h" 11 #include "chrome/common/scoped_vector.h"
11 12
12 class GURL; 13 class GURL;
13 class Profile; 14 class Profile;
14 class TemplateURL; 15 class TemplateURL;
15 class WebContents; 16 class WebContents;
16 17
17 // TemplateURLFetcher is responsible for downloading OpenSearch description 18 // TemplateURLFetcher is responsible for downloading OpenSearch description
18 // documents, creating a TemplateURL from the OSDD, and adding the TemplateURL 19 // documents, creating a TemplateURL from the OSDD, and adding the TemplateURL
19 // to the TemplateURLModel. Downloading is done in the background. 20 // to the TemplateURLModel. Downloading is done in the background.
20 // 21 //
21 class TemplateURLFetcher { 22 class TemplateURLFetcher {
22 public: 23 public:
23 // Creates a TemplateURLFetcher with the specified Profile. 24 // Creates a TemplateURLFetcher with the specified Profile.
24 explicit TemplateURLFetcher(Profile* profile); 25 explicit TemplateURLFetcher(Profile* profile);
25 26
26 // If TemplateURLFetcher is not already downloading the OSDD for osdd_url, 27 // If TemplateURLFetcher is not already downloading the OSDD for osdd_url,
27 // it is downloaded. If successful and the result can be parsed, a TemplateURL 28 // it is downloaded. If successful and the result can be parsed, a TemplateURL
28 // is added to the TemplateURLModel. 29 // is added to the TemplateURLModel.
29 void ScheduleDownload(const std::wstring& keyword, 30 void ScheduleDownload(const std::wstring& keyword,
30 const GURL& osdd_url, 31 const GURL& osdd_url,
31 const GURL& favicon_url, 32 const GURL& favicon_url,
32 const HWND parent_window, 33 const gfx::NativeView parent_window,
33 bool autodetected); 34 bool autodetected);
34 35
35 private: 36 private:
36 friend class RequestDelegate; 37 friend class RequestDelegate;
37 38
38 // A RequestDelegate is created to download each OSDD. When done downloading 39 // A RequestDelegate is created to download each OSDD. When done downloading
39 // RequestCompleted is invoked back on the TemplateURLFetcher. 40 // RequestCompleted is invoked back on the TemplateURLFetcher.
40 class RequestDelegate : public URLFetcher::Delegate { 41 class RequestDelegate : public URLFetcher::Delegate {
41 public: 42 public:
42 RequestDelegate(TemplateURLFetcher* fetcher, 43 RequestDelegate(TemplateURLFetcher* fetcher,
43 const std::wstring& keyword, 44 const std::wstring& keyword,
44 const GURL& osdd_url, 45 const GURL& osdd_url,
45 const GURL& favicon_url, 46 const GURL& favicon_url,
46 const HWND parent_window, 47 gfx::NativeView parent_window,
47 bool autodetected) 48 bool autodetected)
48 #pragma warning(disable:4355) 49 #pragma warning(disable:4355)
49 : url_fetcher_(osdd_url, URLFetcher::GET, this), 50 : url_fetcher_(osdd_url, URLFetcher::GET, this),
50 fetcher_(fetcher), 51 fetcher_(fetcher),
51 keyword_(keyword), 52 keyword_(keyword),
52 osdd_url_(osdd_url), 53 osdd_url_(osdd_url),
53 favicon_url_(favicon_url), 54 favicon_url_(favicon_url),
54 parent_window_(parent_window), 55 parent_window_(parent_window),
55 autodetected_(autodetected) { 56 autodetected_(autodetected) {
56 url_fetcher_.set_request_context(fetcher->profile()->GetRequestContext()); 57 url_fetcher_.set_request_context(fetcher->profile()->GetRequestContext());
(...skipping 18 matching lines...) Expand all
75 private: 76 private:
76 URLFetcher url_fetcher_; 77 URLFetcher url_fetcher_;
77 TemplateURLFetcher* fetcher_; 78 TemplateURLFetcher* fetcher_;
78 const std::wstring keyword_; 79 const std::wstring keyword_;
79 const GURL osdd_url_; 80 const GURL osdd_url_;
80 const GURL favicon_url_; 81 const GURL favicon_url_;
81 bool autodetected_; 82 bool autodetected_;
82 83
83 // Used to determine where to place a confirmation dialog. May be NULL, 84 // Used to determine where to place a confirmation dialog. May be NULL,
84 // in which case the confirmation will be centered in the screen if needed. 85 // in which case the confirmation will be centered in the screen if needed.
85 const HWND parent_window_; 86 gfx::NativeView parent_window_;
86 87
87 DISALLOW_EVIL_CONSTRUCTORS(RequestDelegate); 88 DISALLOW_COPY_AND_ASSIGN(RequestDelegate);
88 }; 89 };
89 90
90 Profile* profile() const { return profile_; } 91 Profile* profile() const { return profile_; }
91 92
92 // Invoked from the RequestDelegate when done downloading. 93 // Invoked from the RequestDelegate when done downloading.
93 void RequestCompleted(RequestDelegate* request); 94 void RequestCompleted(RequestDelegate* request);
94 95
95 Profile* profile_; 96 Profile* profile_;
96 97
97 // In progress requests. 98 // In progress requests.
98 ScopedVector<RequestDelegate> requests_; 99 ScopedVector<RequestDelegate> requests_;
99 100
100 DISALLOW_EVIL_CONSTRUCTORS(TemplateURLFetcher); 101 DISALLOW_COPY_AND_ASSIGN(TemplateURLFetcher);
101 }; 102 };
102 103
103 #endif // CHROME_BROWSER_OSDD_FETCHER_H__ 104 #endif // CHROME_BROWSER_OSDD_FETCHER_H_
104
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_job.h ('k') | chrome/browser/shell_dialogs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698