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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // The referrer string (if any) specified in the app URL. Used only for native | 244 // The referrer string (if any) specified in the app URL. Used only for native |
245 // app banners. | 245 // app banners. |
246 std::string referrer_; | 246 std::string referrer_; |
247 | 247 |
248 // The current banner pipeline state for this page load. | 248 // The current banner pipeline state for this page load. |
249 State state_; | 249 State state_; |
250 | 250 |
251 private: | 251 private: |
252 friend class AppBannerManagerTest; | 252 friend class AppBannerManagerTest; |
253 | 253 |
| 254 // Returns whether the new experimental flow and UI is enabled. |
| 255 static bool IsExperimentalAppBannersEnabled(); |
| 256 |
254 // Record that the banner could be shown at this point, if the triggering | 257 // Record that the banner could be shown at this point, if the triggering |
255 // heuristic allowed. | 258 // heuristic allowed. |
256 void RecordCouldShowBanner(); | 259 void RecordCouldShowBanner(); |
257 | 260 |
258 // Creates a banner for the app. Overridden by subclasses as the infobar is | 261 // Creates the app banner UI. Overridden by subclasses as the infobar is |
259 // platform-specific. | 262 // platform-specific. |
260 virtual void ShowBanner() = 0; | 263 virtual void ShowBannerUI() = 0; |
261 | 264 |
262 // Called after the manager sends a message to the renderer regarding its | 265 // Called after the manager sends a message to the renderer regarding its |
263 // intention to show a prompt. The renderer will send a message back with the | 266 // intention to show a prompt. The renderer will send a message back with the |
264 // opportunity to cancel. | 267 // opportunity to cancel. |
265 void OnBannerPromptReply(blink::mojom::AppBannerPromptReply reply, | 268 void OnBannerPromptReply(blink::mojom::AppBannerPromptReply reply, |
266 const std::string& referrer); | 269 const std::string& referrer); |
267 | 270 |
| 271 // Does the non-platform specific parts of showing the app banner. |
| 272 void ShowBanner(); |
| 273 |
268 // blink::mojom::AppBannerService overrides. | 274 // blink::mojom::AppBannerService overrides. |
269 // Called when Blink has prevented a banner from being shown, and is now | 275 // Called when Blink has prevented a banner from being shown, and is now |
270 // requesting that it be shown later. | 276 // requesting that it be shown later. |
271 void DisplayAppBanner(bool user_gesture) override; | 277 void DisplayAppBanner(bool user_gesture) override; |
272 | 278 |
273 // Fetches the data required to display a banner for the current page. | 279 // Fetches the data required to display a banner for the current page. |
274 InstallableManager* manager_; | 280 InstallableManager* manager_; |
275 | 281 |
276 // A monotonically increasing id to verify the response to the | 282 // A monotonically increasing id to verify the response to the |
277 // beforeinstallprompt event from the renderer. | 283 // beforeinstallprompt event from the renderer. |
(...skipping 27 matching lines...) Expand all Loading... |
305 // scoped to the WebContents which they are observing. This allows us to use | 311 // scoped to the WebContents which they are observing. This allows us to use |
306 // weak pointers for callbacks. | 312 // weak pointers for callbacks. |
307 base::WeakPtrFactory<AppBannerManager> weak_factory_; | 313 base::WeakPtrFactory<AppBannerManager> weak_factory_; |
308 | 314 |
309 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); | 315 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); |
310 }; | 316 }; |
311 | 317 |
312 } // namespace banners | 318 } // namespace banners |
313 | 319 |
314 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ | 320 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ |
OLD | NEW |