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

Unified Diff: chrome/browser/search/google_search_provider_service.h

Issue 2805133004: Local NTP: Deploy strict-dynamic CSP (Closed)
Patch Set: fix Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search/google_search_provider_service.h
diff --git a/chrome/browser/search/google_search_provider_service.h b/chrome/browser/search/google_search_provider_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..042b41a2b546bf43e0637d8564f1da844d7c8b7f
--- /dev/null
+++ b/chrome/browser/search/google_search_provider_service.h
@@ -0,0 +1,48 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SEARCH_GOOGLE_SEARCH_PROVIDER_SERVICE_H_
+#define CHROME_BROWSER_SEARCH_GOOGLE_SEARCH_PROVIDER_SERVICE_H_
+
+#include "base/macros.h"
+#include "base/observer_list.h"
+#include "base/scoped_observer.h"
+#include "chrome/browser/search/google_search_provider_service_observer.h"
+#include "components/keyed_service/core/keyed_service.h"
+#include "components/search_engines/template_url_service_observer.h"
+
+class TemplateURLService;
+
+// Tracks whether the default search provider is Google.
sfiera 2017/04/11 09:45:17 Comments? Tests? It's not clear from the header wh
Marc Treib 2017/04/11 12:37:59 Two things: 1) It abstracts away the kinda yucky T
sfiera 2017/04/11 14:07:35 On its own, I'm not sure that motivates this class
Marc Treib 2017/04/12 11:53:45 You're right, this isn't really worth a new servic
+class GoogleSearchProviderService : public KeyedService,
+ public TemplateURLServiceObserver {
+ public:
+ explicit GoogleSearchProviderService(
+ TemplateURLService* template_url_service);
+ ~GoogleSearchProviderService() override;
+
+ // KeyedService implementation.
+ void Shutdown() override;
+
+ bool DefaultSearchProviderIsGoogle() const;
+
+ void AddObserver(GoogleSearchProviderServiceObserver* observer);
+ void RemoveObserver(GoogleSearchProviderServiceObserver* observer);
+
+ private:
+ // TemplateURLServiceObserver implementation.
+ void OnTemplateURLServiceChanged() override;
+
+ TemplateURLService* template_url_service_;
+ ScopedObserver<TemplateURLService, GoogleSearchProviderService>
+ template_url_service_observer_;
+
+ bool is_google_;
+
+ base::ObserverList<GoogleSearchProviderServiceObserver, true> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(GoogleSearchProviderService);
+};
+
+#endif // CHROME_BROWSER_SEARCH_GOOGLE_SEARCH_PROVIDER_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698