| 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 |
| 11 #include "base/callback_forward.h" | |
| 12 #include "base/macros.h" | 11 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 14 #include "chrome/browser/engagement/site_engagement_observer.h" | 13 #include "chrome/browser/engagement/site_engagement_observer.h" |
| 15 #include "chrome/browser/installable/installable_logging.h" | 14 #include "chrome/browser/installable/installable_logging.h" |
| 16 #include "chrome/browser/installable/installable_manager.h" | 15 #include "chrome/browser/installable/installable_manager.h" |
| 17 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
| 18 #include "mojo/public/cpp/bindings/binding.h" | 17 #include "mojo/public/cpp/bindings/binding.h" |
| 19 #include "third_party/WebKit/public/platform/modules/app_banner/app_banner.mojom
.h" | 18 #include "third_party/WebKit/public/platform/modules/app_banner/app_banner.mojom
.h" |
| 20 | 19 |
| 21 class SkBitmap; | 20 class SkBitmap; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 virtual void DidFinishCreatingBookmarkApp( | 86 virtual void DidFinishCreatingBookmarkApp( |
| 88 const extensions::Extension* extension, | 87 const extensions::Extension* extension, |
| 89 const WebApplicationInfo& web_app_info) {} | 88 const WebApplicationInfo& web_app_info) {} |
| 90 | 89 |
| 91 // Overridden and passed through base::Bind on Android. Called when the | 90 // Overridden and passed through base::Bind on Android. Called when the |
| 92 // 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 |
| 93 // 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 |
| 94 // desktop platforms. | 93 // desktop platforms. |
| 95 virtual void OnAppIconFetched(const SkBitmap& bitmap) {} | 94 virtual void OnAppIconFetched(const SkBitmap& bitmap) {} |
| 96 | 95 |
| 97 // Overridden and passed through base::Bind on Android. Called after a web app | |
| 98 // banner was successfully used to add a web app to homescreen to kick off an | |
| 99 // asynchronous fetch of a splash screen icon. Not used on desktop platforms. | |
| 100 virtual base::Closure FetchWebappSplashScreenImageCallback( | |
| 101 const std::string& webapp_id); | |
| 102 | |
| 103 protected: | 96 protected: |
| 104 explicit AppBannerManager(content::WebContents* web_contents); | 97 explicit AppBannerManager(content::WebContents* web_contents); |
| 105 ~AppBannerManager() override; | 98 ~AppBannerManager() override; |
| 106 | 99 |
| 107 // Returns true if the banner should be shown. Returns false if the banner has | 100 // Returns true if the banner should be shown. Returns false if the banner has |
| 108 // been shown too recently, or if the app has already been installed. | 101 // been shown too recently, or if the app has already been installed. |
| 109 // GetAppIdentifier() must return a valid value for this method to work. | 102 // GetAppIdentifier() must return a valid value for this method to work. |
| 110 bool CheckIfShouldShowBanner(); | 103 bool CheckIfShouldShowBanner(); |
| 111 | 104 |
| 112 // Return a string identifying this app for metrics. | 105 // Return a string identifying this app for metrics. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // scoped to the WebContents which they are observing. This allows us to use | 277 // scoped to the WebContents which they are observing. This allows us to use |
| 285 // weak pointers for callbacks. | 278 // weak pointers for callbacks. |
| 286 base::WeakPtrFactory<AppBannerManager> weak_factory_; | 279 base::WeakPtrFactory<AppBannerManager> weak_factory_; |
| 287 | 280 |
| 288 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); | 281 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); |
| 289 }; | 282 }; |
| 290 | 283 |
| 291 } // namespace banners | 284 } // namespace banners |
| 292 | 285 |
| 293 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ | 286 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ |
| OLD | NEW |