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