| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void OnInstall(); | 72 void OnInstall(); |
| 73 | 73 |
| 74 // Sends a message to the renderer that the user accepted the banner. Does | 74 // Sends a message to the renderer that the user accepted the banner. Does |
| 75 // nothing if |request_id| does not match the current request. | 75 // nothing if |request_id| does not match the current request. |
| 76 void SendBannerAccepted(int request_id); | 76 void SendBannerAccepted(int request_id); |
| 77 | 77 |
| 78 // Sends a message to the renderer that the user dismissed the banner. Does | 78 // Sends a message to the renderer that the user dismissed the banner. Does |
| 79 // nothing if |request_id| does not match the current request. | 79 // nothing if |request_id| does not match the current request. |
| 80 void SendBannerDismissed(int request_id); | 80 void SendBannerDismissed(int request_id); |
| 81 | 81 |
| 82 // Returns a WeakPtr to this object. Exposed so subclasses/infobars may |
| 83 // may bind callbacks without needing their own WeakPtrFactory. |
| 84 base::WeakPtr<AppBannerManager> GetWeakPtr(); |
| 85 |
| 82 // Overridden and passed through base::Bind on desktop platforms. Called when | 86 // Overridden and passed through base::Bind on desktop platforms. Called when |
| 83 // the bookmark app install initiated by a banner has completed. Not used on | 87 // the bookmark app install initiated by a banner has completed. Not used on |
| 84 // Android. | 88 // Android. |
| 85 virtual void DidFinishCreatingBookmarkApp( | 89 virtual void DidFinishCreatingBookmarkApp( |
| 86 const extensions::Extension* extension, | 90 const extensions::Extension* extension, |
| 87 const WebApplicationInfo& web_app_info) {} | 91 const WebApplicationInfo& web_app_info) {} |
| 88 | 92 |
| 89 // Overridden and passed through base::Bind on Android. Called when the | 93 // Overridden and passed through base::Bind on Android. Called when the |
| 90 // download of a native app's icon is complete, as native banners use an icon | 94 // download of a native app's icon is complete, as native banners use an icon |
| 91 // provided from the Play Store rather than the web manifest. Not used on | 95 // provided from the Play Store rather than the web manifest. Not used on |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 virtual std::string GetBannerType(); | 133 virtual std::string GetBannerType(); |
| 130 | 134 |
| 131 // Returns a string parameter for a devtools console message corresponding to | 135 // Returns a string parameter for a devtools console message corresponding to |
| 132 // |code|. Returns the empty string if |code| requires no parameter. | 136 // |code|. Returns the empty string if |code| requires no parameter. |
| 133 std::string GetStatusParam(InstallableStatusCode code); | 137 std::string GetStatusParam(InstallableStatusCode code); |
| 134 | 138 |
| 135 // Returns the ideal and minimum primary icon size requirements. | 139 // Returns the ideal and minimum primary icon size requirements. |
| 136 virtual int GetIdealPrimaryIconSizeInPx(); | 140 virtual int GetIdealPrimaryIconSizeInPx(); |
| 137 virtual int GetMinimumPrimaryIconSizeInPx(); | 141 virtual int GetMinimumPrimaryIconSizeInPx(); |
| 138 | 142 |
| 139 // Returns a WeakPtr to this object. Exposed so subclasses/infobars may | |
| 140 // may bind callbacks without needing their own WeakPtrFactory. | |
| 141 base::WeakPtr<AppBannerManager> GetWeakPtr(); | |
| 142 | |
| 143 // Returns true if |is_debug_mode_| is true or the | 143 // Returns true if |is_debug_mode_| is true or the |
| 144 // kBypassAppBannerEngagementChecks flag is set. | 144 // kBypassAppBannerEngagementChecks flag is set. |
| 145 virtual bool IsDebugMode() const; | 145 virtual bool IsDebugMode() const; |
| 146 | 146 |
| 147 // Returns true if the webapp at |start_url| has already been installed. | 147 // Returns true if the webapp at |start_url| has already been installed. |
| 148 virtual bool IsWebAppInstalled(content::BrowserContext* browser_context, | 148 virtual bool IsWebAppInstalled(content::BrowserContext* browser_context, |
| 149 const GURL& start_url, | 149 const GURL& start_url, |
| 150 const GURL& manifest_url); | 150 const GURL& manifest_url); |
| 151 | 151 |
| 152 // Callback invoked by the InstallableManager once it has fetched the page's | 152 // Callback invoked by the InstallableManager once it has fetched the page's |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // scoped to the WebContents which they are observing. This allows us to use | 308 // scoped to the WebContents which they are observing. This allows us to use |
| 309 // weak pointers for callbacks. | 309 // weak pointers for callbacks. |
| 310 base::WeakPtrFactory<AppBannerManager> weak_factory_; | 310 base::WeakPtrFactory<AppBannerManager> weak_factory_; |
| 311 | 311 |
| 312 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); | 312 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); |
| 313 }; | 313 }; |
| 314 | 314 |
| 315 } // namespace banners | 315 } // namespace banners |
| 316 | 316 |
| 317 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ | 317 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ |
| OLD | NEW |