| Index: chrome/browser/webshare/share_service_impl.h
|
| diff --git a/chrome/browser/webshare/share_service_impl.h b/chrome/browser/webshare/share_service_impl.h
|
| index 3bc47deae3f5b84fee5fe3b2ca1e73cfcedde381..b2de0601fc801fd1993d2df67435bc5173bc55f9 100644
|
| --- a/chrome/browser/webshare/share_service_impl.h
|
| +++ b/chrome/browser/webshare/share_service_impl.h
|
| @@ -5,20 +5,26 @@
|
| #ifndef CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_
|
| #define CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_
|
|
|
| +#include <memory>
|
| #include <string>
|
| +#include <vector>
|
|
|
| #include "base/gtest_prod_util.h"
|
| #include "base/strings/string16.h"
|
| +#include "chrome/browser/ui/browser.h"
|
| +#include "chrome/browser/ui/browser_dialogs.h"
|
| #include "mojo/public/cpp/bindings/interface_request.h"
|
| #include "third_party/WebKit/public/platform/modules/webshare/webshare.mojom.h"
|
| +#include "third_party/WebKit/public/platform/site_engagement.mojom.h"
|
|
|
| +class DictionaryValue;
|
| class GURL;
|
|
|
| // Desktop implementation of the ShareService Mojo service.
|
| class ShareServiceImpl : public blink::mojom::ShareService {
|
| public:
|
| - ShareServiceImpl() = default;
|
| - ~ShareServiceImpl() override = default;
|
| + ShareServiceImpl();
|
| + ~ShareServiceImpl() override;
|
|
|
| static void Create(mojo::InterfaceRequest<ShareService> request);
|
|
|
| @@ -31,6 +37,20 @@ class ShareServiceImpl : public blink::mojom::ShareService {
|
| private:
|
| FRIEND_TEST_ALL_PREFIXES(ShareServiceImplUnittest, ReplacePlaceholders);
|
|
|
| + Browser* GetBrowser();
|
| +
|
| + // Returns the URL template of the target identified by |target_url|
|
| + std::string GetTargetTemplate(
|
| + const std::string& target_url,
|
| + const base::DictionaryValue& share_targets);
|
| +
|
| + // Virtual for testing purposes.
|
| + virtual PrefService* GetPrefService();
|
| +
|
| + // Returns the site engagement level of the site, |url|, with the user.
|
| + // Virtual for testing purposes.
|
| + virtual blink::mojom::EngagementLevel GetEngagementLevel(const GURL& url);
|
| +
|
| // Shows the share picker dialog with |targets| as the list of applications
|
| // presented to the user. Passes the result to |callback|. If the user picks a
|
| // target, the result passed to |callback| is the manifest URL of the chosen
|
| @@ -43,6 +63,12 @@ class ShareServiceImpl : public blink::mojom::ShareService {
|
| // Virtual for testing purposes.
|
| virtual void OpenTargetURL(const GURL& target_url);
|
|
|
| + // Returns all stored Share Targets that have a high enough engagement score
|
| + // with the user.
|
| + std::vector<std::pair<base::string16, GURL>>
|
| + GetTargetsWithSufficientEngagement(
|
| + const base::DictionaryValue& share_targets);
|
| +
|
| // Writes to |url_template_filled|, a copy of |url_template| with all
|
| // instances of "{title}", "{text}", and "{url}" replaced with
|
| // |title|, |text|, and |url| respectively.
|
| @@ -57,7 +83,8 @@ class ShareServiceImpl : public blink::mojom::ShareService {
|
| const GURL& share_url,
|
| std::string* url_template_filled);
|
|
|
| - void OnPickerClosed(const std::string& title,
|
| + void OnPickerClosed(std::unique_ptr<base::DictionaryValue> share_targets,
|
| + const std::string& title,
|
| const std::string& text,
|
| const GURL& share_url,
|
| const ShareCallback& callback,
|
|
|