summaryrefslogtreecommitdiffstats
path: root/chrome/browser/search_engines/search_provider_install_data.h
diff options
context:
space:
mode:
authorlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-17 19:35:21 +0000
committerlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-17 19:35:21 +0000
commit1cc7e730535abf1d6a96d53d2cfa372c9bcb7291 (patch)
tree8bc6fef895c019fc74f17935adfc66b8b2876fac /chrome/browser/search_engines/search_provider_install_data.h
parent3c0d45e1a201dfabfefecf3f2bb81411b0272c37 (diff)
downloadchromium_src-1cc7e730535abf1d6a96d53d2cfa372c9bcb7291.zip
chromium_src-1cc7e730535abf1d6a96d53d2cfa372c9bcb7291.tar.gz
chromium_src-1cc7e730535abf1d6a96d53d2cfa372c9bcb7291.tar.bz2
Add support for Google base URL to SearchProviderInstallData.
BUG=38475 TEST=unit_tests --gtest_filter=SearchProviderInstallDataTest* Review URL: http://codereview.chromium.org/3410010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59834 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/search_engines/search_provider_install_data.h')
-rw-r--r--chrome/browser/search_engines/search_provider_install_data.h33
1 files changed, 24 insertions, 9 deletions
diff --git a/chrome/browser/search_engines/search_provider_install_data.h b/chrome/browser/search_engines/search_provider_install_data.h
index f6fbf3b..3a7d525 100644
--- a/chrome/browser/search_engines/search_provider_install_data.h
+++ b/chrome/browser/search_engines/search_provider_install_data.h
@@ -13,9 +13,12 @@
#include "base/scoped_ptr.h"
#include "base/scoped_vector.h"
#include "base/task_queue.h"
+#include "base/weak_ptr.h"
#include "chrome/browser/webdata/web_data_service.h"
class GURL;
+class NotificationSource;
+class NotificationType;
class SearchHostToURLsMap;
class Task;
class TemplateURL;
@@ -24,7 +27,8 @@ class TemplateURL;
// loading the data on demand (when CallWhenLoaded is called) and then throwing
// away the results after the callbacks are done, so the results are always up
// to date with what is in the database.
-class SearchProviderInstallData : public WebDataServiceConsumer {
+class SearchProviderInstallData : public WebDataServiceConsumer,
+ public base::SupportsWeakPtr<SearchProviderInstallData> {
public:
enum State {
// The search provider is not installed.
@@ -37,20 +41,28 @@ class SearchProviderInstallData : public WebDataServiceConsumer {
INSTALLED_AS_DEFAULT = 2
};
- explicit SearchProviderInstallData(WebDataService* web_service);
- ~SearchProviderInstallData();
-
- // Use to determine when the search provider information is loaded.
- // The callback may happen synchronously or asynchronously. This
- // takes ownership of |task|. There is no need to do anything special
- // to make it function (as it just relies on the normal I/O thread message
- // loop).
+ // |ui_death_notification| and |ui_death_source| indentify a notification that
+ // may be observed on the UI thread to know when this class no longer needs to
+ // be kept up to date. (Note that this class may be deleted before or after
+ // that notification occurs. It doesn't matter.)
+ SearchProviderInstallData(WebDataService* web_service,
+ NotificationType ui_death_notification,
+ const NotificationSource& ui_death_source);
+ virtual ~SearchProviderInstallData();
+
+ // Use to determine when the search provider information is loaded. The
+ // callback may happen synchronously or asynchronously. This takes ownership
+ // of |task|. There is no need to do anything special to make it function
+ // (as it just relies on the normal I/O thread message loop).
void CallWhenLoaded(Task* task);
// Returns the search provider install state for the given origin.
// This should only be called while a task is called back from CallWhenLoaded.
State GetInstallState(const GURL& requested_origin);
+ // Called when the google base url has changed.
+ void OnGoogleURLChange(const std::string& google_base_url);
+
private:
// WebDataServiceConsumer
// Notification that the keywords have been loaded.
@@ -88,6 +100,9 @@ class SearchProviderInstallData : public WebDataServiceConsumer {
// The security origin for the default search provider.
std::string default_search_origin_;
+ // The google base url.
+ std::string google_base_url_;
+
DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallData);
};