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

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

Issue 376413002: Stop using TemplateURLServiceTestUtil to initialize TemplateURLServiceFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TemplateURLServiceWithoutFallbackTest Created 6 years, 5 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) 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_SEARCH_PROVIDER_INSTALL_DATA_H_ 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_DATA_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_DATA_H_ 6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_DATA_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 16
17 class GURL; 17 class GURL;
18 class Profile; 18 class GoogleURLTracker;
19 class SearchHostToURLsMap; 19 class SearchHostToURLsMap;
20 class TemplateURL; 20 class TemplateURL;
21 class TemplateURLService; 21 class TemplateURLService;
22 22
23 namespace content { 23 namespace content {
24 class RenderProcessHost; 24 class RenderProcessHost;
25 } 25 }
26 26
27 // Provides the search provider install state for the I/O thread. It works by 27 // Provides the search provider install state for the I/O thread. It works by
28 // loading the data on demand (when CallWhenLoaded is called) and then throwing 28 // loading the data on demand (when CallWhenLoaded is called) and then throwing
29 // away the results after the callbacks are done, so the results are always up 29 // away the results after the callbacks are done, so the results are always up
30 // to date with what is in the database. 30 // to date with what is in the database.
31 class SearchProviderInstallData { 31 class SearchProviderInstallData {
32 public: 32 public:
33 enum State { 33 enum State {
34 // The search provider is not installed. 34 // The search provider is not installed.
35 NOT_INSTALLED = 0, 35 NOT_INSTALLED = 0,
36 36
37 // The search provider is in the user's set but is not 37 // The search provider is in the user's set but is not
38 INSTALLED_BUT_NOT_DEFAULT = 1, 38 INSTALLED_BUT_NOT_DEFAULT = 1,
39 39
40 // The search provider is set as the user's default. 40 // The search provider is set as the user's default.
41 INSTALLED_AS_DEFAULT = 2 41 INSTALLED_AS_DEFAULT = 2
42 }; 42 };
43 43
44 // |host| is a RenderProcessHost that is observed, and whose destruction is a 44 // |host| is a RenderProcessHost that is observed, and whose destruction is a
45 // signal to this class that it no longer needs to be kept up to date. (Note 45 // signal to this class that it no longer needs to be kept up to date. (Note
46 // that this class may be deleted before or after that death occurs. It 46 // that this class may be deleted before or after that death occurs. It
47 // doesn't matter.) 47 // doesn't matter.)
48 SearchProviderInstallData(Profile* profile, content::RenderProcessHost* host); 48 SearchProviderInstallData(TemplateURLService* template_url_service,
49 const std::string& google_base_url,
50 GoogleURLTracker* google_url_tracker,
51 content::RenderProcessHost* host);
49 virtual ~SearchProviderInstallData(); 52 virtual ~SearchProviderInstallData();
50 53
51 // Use to determine when the search provider information is loaded. The 54 // Use to determine when the search provider information is loaded. The
52 // callback may happen synchronously or asynchronously. There is no need to do 55 // callback may happen synchronously or asynchronously. There is no need to do
53 // anything special to make it function (as it just relies on the normal I/O 56 // anything special to make it function (as it just relies on the normal I/O
54 // thread message loop). 57 // thread message loop).
55 void CallWhenLoaded(const base::Closure& closure); 58 void CallWhenLoaded(const base::Closure& closure);
56 59
57 // Returns the search provider install state for the given origin. 60 // Returns the search provider install state for the given origin.
58 // This should only be called while a task is called back from CallWhenLoaded. 61 // This should only be called while a task is called back from CallWhenLoaded.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 98
96 // The google base url. 99 // The google base url.
97 std::string google_base_url_; 100 std::string google_base_url_;
98 101
99 base::WeakPtrFactory<SearchProviderInstallData> weak_factory_; 102 base::WeakPtrFactory<SearchProviderInstallData> weak_factory_;
100 103
101 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallData); 104 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallData);
102 }; 105 };
103 106
104 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_DATA_H_ 107 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698