OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BANNERS_APP_BANNER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ |
6 #define CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ | 6 #define CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // Sets the total engagement required for triggering the banner in testing. | 61 // Sets the total engagement required for triggering the banner in testing. |
62 static void SetTotalEngagementToTrigger(double engagement); | 62 static void SetTotalEngagementToTrigger(double engagement); |
63 | 63 |
64 // Returns whether or not the URLs match for everything except for the ref. | 64 // Returns whether or not the URLs match for everything except for the ref. |
65 static bool URLsAreForTheSamePage(const GURL& first, const GURL& second); | 65 static bool URLsAreForTheSamePage(const GURL& first, const GURL& second); |
66 | 66 |
67 // Requests an app banner. If |is_debug_mode| is true, any failure in the | 67 // Requests an app banner. If |is_debug_mode| is true, any failure in the |
68 // pipeline will be reported to the devtools console. | 68 // pipeline will be reported to the devtools console. |
69 virtual void RequestAppBanner(const GURL& validated_url, bool is_debug_mode); | 69 virtual void RequestAppBanner(const GURL& validated_url, bool is_debug_mode); |
70 | 70 |
| 71 // Informs the page that it has been installed via an app banner. |
| 72 // This is redundant for the beforeinstallprompt event's promise being |
| 73 // resolved, but is required by the install event spec. |
| 74 void OnInstall(); |
| 75 |
71 // Sends a message to the renderer that the user accepted the banner. Does | 76 // Sends a message to the renderer that the user accepted the banner. Does |
72 // nothing if |request_id| does not match the current request. | 77 // nothing if |request_id| does not match the current request. |
73 void SendBannerAccepted(int request_id); | 78 void SendBannerAccepted(int request_id); |
74 | 79 |
75 // Sends a message to the renderer that the user dismissed the banner. Does | 80 // Sends a message to the renderer that the user dismissed the banner. Does |
76 // nothing if |request_id| does not match the current request. | 81 // nothing if |request_id| does not match the current request. |
77 void SendBannerDismissed(int request_id); | 82 void SendBannerDismissed(int request_id); |
78 | 83 |
79 // Overridden and passed through base::Bind on desktop platforms. Called when | 84 // Overridden and passed through base::Bind on desktop platforms. Called when |
80 // the bookmark app install initiated by a banner has completed. Not used on | 85 // the bookmark app install initiated by a banner has completed. Not used on |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // scoped to the WebContents which they are observing. This allows us to use | 274 // scoped to the WebContents which they are observing. This allows us to use |
270 // weak pointers for callbacks. | 275 // weak pointers for callbacks. |
271 base::WeakPtrFactory<AppBannerManager> weak_factory_; | 276 base::WeakPtrFactory<AppBannerManager> weak_factory_; |
272 | 277 |
273 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); | 278 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); |
274 }; | 279 }; |
275 | 280 |
276 } // namespace banners | 281 } // namespace banners |
277 | 282 |
278 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ | 283 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ |
OLD | NEW |