Factor WebAppProvider out of WebAppPolicyManager
That keyed service will, in the future, be responsible for more web app
things than just policy.
Also move c/b/wa/policy to c/b/wa/bookmark_apps/policy, where c/b/wa
means chrome/browser/web_applications. We (nigeltao@, ortuno@, loyso@,
dominickn@) want to organize c/b/wa into a 'root' directory and three
or four sub-directories as we de-tangle web apps from extensions:
- c/b/wa holds only the WebAppProvider and its Factory.
- c/b/wa/extensions is code that is tightly coupled to extensions.
- c/b/wa/bookmark_apps is code that currently depends on
c/b/wa/extensions but, in the future, should not.
- c/b/wa/components is low level code that is unrelated to extensions.
- c/b/wa/new_bookmark_apps (name pending) is high level code that is
unrelated to extensions.
Change-Id: Ie42bfc348be7166c710fc6232848b5e9eb91960e
Reviewed-on: https://chromium-review.googlesource.com/1142844
Commit-Queue: Nigel Tao <[email protected]>
Reviewed-by: Bernhard Bauer <[email protected]>
Reviewed-by: Dominick Ng <[email protected]>
Reviewed-by: Giovanni Ortuño Urquidi <[email protected]>
Cr-Commit-Position: refs/heads/master@{#576500}
diff --git a/chrome/browser/web_applications/web_app_provider.h b/chrome/browser/web_applications/web_app_provider.h
new file mode 100644
index 0000000..f2bec23
--- /dev/null
+++ b/chrome/browser/web_applications/web_app_provider.h
@@ -0,0 +1,39 @@
+// Copyright 2018 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_WEB_APPLICATIONS_WEB_APP_PROVIDER_H_
+#define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROVIDER_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "components/keyed_service/core/keyed_service.h"
+#include "components/prefs/pref_service.h"
+
+class Profile;
+
+namespace web_app {
+
+class WebAppPolicyManager;
+
+// Connects Web App features, such as the installation of default and
+// policy-managed web apps, with Profiles (as WebAppProvider is a
+// Profile-linked KeyedService) and their associated PrefService.
+class WebAppProvider : public KeyedService {
+ public:
+ static WebAppProvider* Get(Profile* profile);
+
+ explicit WebAppProvider(PrefService* pref_service);
+
+ ~WebAppProvider() override;
+
+ private:
+ std::unique_ptr<WebAppPolicyManager> web_app_policy_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebAppProvider);
+};
+
+} // namespace web_app
+
+#endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROVIDER_H_