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

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

Issue 8570022: base::Bind() conversion for chrome/browser/search_engines (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
16 #include "base/task_queue.h"
17 #include "chrome/browser/webdata/web_data_service.h" 17 #include "chrome/browser/webdata/web_data_service.h"
18 18
19 class GURL; 19 class GURL;
20 class SearchHostToURLsMap; 20 class SearchHostToURLsMap;
21 class Task;
22 class TemplateURL; 21 class TemplateURL;
23 22
24 namespace content { 23 namespace content {
25 class NotificationSource; 24 class NotificationSource;
26 } 25 }
27 26
28 // 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
29 // 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
30 // 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
31 // to date with what is in the database. 30 // to date with what is in the database.
(...skipping 14 matching lines...) Expand all
46 // |ui_death_notification| and |ui_death_source| indentify a notification that 45 // |ui_death_notification| and |ui_death_source| indentify a notification that
47 // may be observed on the UI thread to know when this class no longer needs to 46 // may be observed on the UI thread to know when this class no longer needs to
48 // be kept up to date. (Note that this class may be deleted before or after 47 // be kept up to date. (Note that this class may be deleted before or after
49 // that notification occurs. It doesn't matter.) 48 // that notification occurs. It doesn't matter.)
50 SearchProviderInstallData(WebDataService* web_service, 49 SearchProviderInstallData(WebDataService* web_service,
51 int ui_death_notification, 50 int ui_death_notification,
52 const content::NotificationSource& ui_death_source); 51 const content::NotificationSource& ui_death_source);
53 virtual ~SearchProviderInstallData(); 52 virtual ~SearchProviderInstallData();
54 53
55 // Use to determine when the search provider information is loaded. The 54 // Use to determine when the search provider information is loaded. The
56 // callback may happen synchronously or asynchronously. This takes ownership 55 // callback may happen synchronously or asynchronously. There is no need to do
57 // of |task|. There is no need to do anything special to make it function 56 // anything special to make it function (as it just relies on the normal I/O
58 // (as it just relies on the normal I/O thread message loop). 57 // thread message loop).
59 void CallWhenLoaded(Task* task); 58 void CallWhenLoaded(const base::Closure& closure);
60 59
61 // Returns the search provider install state for the given origin. 60 // Returns the search provider install state for the given origin.
62 // 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.
63 State GetInstallState(const GURL& requested_origin); 62 State GetInstallState(const GURL& requested_origin);
64 63
65 // Called when the google base url has changed. 64 // Called when the google base url has changed.
66 void OnGoogleURLChange(const std::string& google_base_url); 65 void OnGoogleURLChange(const std::string& google_base_url);
67 66
68 private: 67 private:
69 // WebDataServiceConsumer 68 // WebDataServiceConsumer
70 // Notification that the keywords have been loaded. 69 // Notification that the keywords have been loaded.
71 // This is invoked from WebDataService, and should not be directly 70 // This is invoked from WebDataService, and should not be directly
72 // invoked. 71 // invoked.
73 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, 72 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h,
74 const WDTypedResult* result); 73 const WDTypedResult* result);
75 74
76 // Stores information about the default search provider. 75 // Stores information about the default search provider.
77 void SetDefault(const TemplateURL* template_url); 76 void SetDefault(const TemplateURL* template_url);
78 77
79 // Sets up the loaded state and then lets clients know that the search 78 // Sets up the loaded state and then lets clients know that the search
80 // provider install state has been loaded. 79 // provider install state has been loaded.
81 void OnLoadFailed(); 80 void OnLoadFailed();
82 81
83 // Does notifications to let clients know that the search provider 82 // Does notifications to let clients know that the search provider
84 // install state has been loaded. 83 // install state has been loaded.
85 void NotifyLoaded(); 84 void NotifyLoaded();
86 85
87 // The list of tasks to call after the load has finished. 86 // The list of closures to call after the load has finished.
88 TaskQueue task_queue_; 87 std::vector<base::Closure> closure_queue_;
89 88
90 // Service used to store entries. 89 // Service used to store entries.
91 scoped_refptr<WebDataService> web_service_; 90 scoped_refptr<WebDataService> web_service_;
92 91
93 // If non-zero, we're waiting on a load. 92 // If non-zero, we're waiting on a load.
94 WebDataService::Handle load_handle_; 93 WebDataService::Handle load_handle_;
95 94
96 // Holds results of a load that was done using this class. 95 // Holds results of a load that was done using this class.
97 scoped_ptr<SearchHostToURLsMap> provider_map_; 96 scoped_ptr<SearchHostToURLsMap> provider_map_;
98 97
99 // The list of template urls that are owned by the class. 98 // The list of template urls that are owned by the class.
100 ScopedVector<const TemplateURL> template_urls_; 99 ScopedVector<const TemplateURL> template_urls_;
101 100
102 // The security origin for the default search provider. 101 // The security origin for the default search provider.
103 std::string default_search_origin_; 102 std::string default_search_origin_;
104 103
105 // The google base url. 104 // The google base url.
106 std::string google_base_url_; 105 std::string google_base_url_;
107 106
108 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallData); 107 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallData);
109 }; 108 };
110 109
111 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_DATA_H_ 110 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_PROVIDER_INSTALL_DATA_H_
OLDNEW
« no previous file with comments | « base/task_queue_unittest.cc ('k') | chrome/browser/search_engines/search_provider_install_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698