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

Side by Side Diff: chrome/browser/webshare/share_service_impl.h

Issue 2849143002: webshare: Small refactor of WebShare (OnceCallback, const&, and alias) (Closed)
Patch Set: Move alias and use OnceCallback Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_ 5 #ifndef CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_
6 #define CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_ 6 #define CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // Returns the site engagement level of the site, |url|, with the user. 50 // Returns the site engagement level of the site, |url|, with the user.
51 // Virtual for testing purposes. 51 // Virtual for testing purposes.
52 virtual blink::mojom::EngagementLevel GetEngagementLevel(const GURL& url); 52 virtual blink::mojom::EngagementLevel GetEngagementLevel(const GURL& url);
53 53
54 // Shows the share picker dialog with |targets| as the list of applications 54 // Shows the share picker dialog with |targets| as the list of applications
55 // presented to the user. Passes the result to |callback|. If the user picks a 55 // presented to the user. Passes the result to |callback|. If the user picks a
56 // target, the result passed to |callback| is the manifest URL of the chosen 56 // target, the result passed to |callback| is the manifest URL of the chosen
57 // target, or is null if the user cancelled the share. Virtual for testing. 57 // target, or is null if the user cancelled the share. Virtual for testing.
58 virtual void ShowPickerDialog( 58 virtual void ShowPickerDialog(
59 const std::vector<std::pair<base::string16, GURL>>& targets, 59 const std::vector<std::pair<base::string16, GURL>>& targets,
60 const base::Callback<void(base::Optional<std::string>)>& callback); 60 chrome::WebShareTargetPickerCallback callback);
61 61
62 // Opens a new tab and navigates to |target_url|. 62 // Opens a new tab and navigates to |target_url|.
63 // Virtual for testing purposes. 63 // Virtual for testing purposes.
64 virtual void OpenTargetURL(const GURL& target_url); 64 virtual void OpenTargetURL(const GURL& target_url);
65 65
66 // Returns all stored Share Targets that have a high enough engagement score 66 // Returns all stored Share Targets that have a high enough engagement score
67 // with the user. 67 // with the user.
68 std::vector<std::pair<base::string16, GURL>> 68 std::vector<std::pair<base::string16, GURL>>
69 GetTargetsWithSufficientEngagement( 69 GetTargetsWithSufficientEngagement(
70 const base::DictionaryValue& share_targets); 70 const base::DictionaryValue& share_targets);
(...skipping 10 matching lines...) Expand all
81 base::StringPiece title, 81 base::StringPiece title,
82 base::StringPiece text, 82 base::StringPiece text,
83 const GURL& share_url, 83 const GURL& share_url,
84 std::string* url_template_filled); 84 std::string* url_template_filled);
85 85
86 void OnPickerClosed(std::unique_ptr<base::DictionaryValue> share_targets, 86 void OnPickerClosed(std::unique_ptr<base::DictionaryValue> share_targets,
87 const std::string& title, 87 const std::string& title,
88 const std::string& text, 88 const std::string& text,
89 const GURL& share_url, 89 const GURL& share_url,
90 const ShareCallback& callback, 90 const ShareCallback& callback,
91 base::Optional<std::string> result); 91 const base::Optional<std::string>& result);
92 92
93 base::WeakPtrFactory<ShareServiceImpl> weak_factory_; 93 base::WeakPtrFactory<ShareServiceImpl> weak_factory_;
94 94
95 DISALLOW_COPY_AND_ASSIGN(ShareServiceImpl); 95 DISALLOW_COPY_AND_ASSIGN(ShareServiceImpl);
96 }; 96 };
97 97
98 #endif // CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_ 98 #endif // CHROME_BROWSER_WEBSHARE_SHARE_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698