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

Unified Diff: chrome/browser/webshare/share_service_impl.h

Issue 2664033002: Read share targets from prefstore, and filter by engagement. (Closed)
Patch Set: Fixed, as per feedback Created 3 years, 10 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/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..33679d45f734c2d36a2a380be687e6a15348b355 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,18 @@ 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);
+
+ // 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 +61,11 @@ 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();
+
// 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.
@@ -64,6 +87,8 @@ class ShareServiceImpl : public blink::mojom::ShareService {
base::Optional<std::string> result);
DISALLOW_COPY_AND_ASSIGN(ShareServiceImpl);
+
+ std::unique_ptr<base::DictionaryValue> share_targets;
Matt Giuca 2017/02/09 05:47:16 share_targets_
Matt Giuca 2017/02/09 23:21:09 Actually, remove this and just make it a temporary
constantina 2017/02/10 00:43:09 Done.
};
#endif // CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_
« no previous file with comments | « no previous file | chrome/browser/webshare/share_service_impl.cc » ('j') | chrome/browser/webshare/share_service_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698