Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: chrome/browser/banners/app_banner_manager.h

Issue 2379923002: Implement "appinstalled" event on Android. (Closed)
Patch Set: Rebase. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 11 #include "base/callback_forward.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/engagement/site_engagement_observer.h" 14 #include "chrome/browser/engagement/site_engagement_observer.h"
15 #include "chrome/browser/installable/installable_logging.h" 15 #include "chrome/browser/installable/installable_logging.h"
16 #include "chrome/browser/installable/installable_manager.h" 16 #include "chrome/browser/installable/installable_manager.h"
17 #include "content/public/browser/web_contents_observer.h" 17 #include "content/public/browser/web_contents_observer.h"
18 #include "mojo/public/cpp/bindings/binding.h" 18 #include "mojo/public/cpp/bindings/binding.h"
19 #include "third_party/WebKit/public/platform/modules/app_banner/app_banner.mojom .h" 19 #include "third_party/WebKit/public/platform/modules/app_banner/app_banner.mojom .h"
20 #include "third_party/WebKit/public/platform/modules/installation/installation.m ojom.h"
dominickn 2016/12/15 03:45:59 Nit: move this include to the cc file.
Matt Giuca 2016/12/15 06:17:23 Done.
20 21
21 class SkBitmap; 22 class SkBitmap;
22 struct WebApplicationInfo; 23 struct WebApplicationInfo;
23 24
24 namespace content { 25 namespace content {
25 class RenderFrameHost; 26 class RenderFrameHost;
26 class WebContents; 27 class WebContents;
27 } 28 }
28 29
29 // This forward declaration exists solely for the DidFinishCreatingBookmarkApp 30 // This forward declaration exists solely for the DidFinishCreatingBookmarkApp
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // Sets the total engagement required for triggering the banner in testing. 62 // Sets the total engagement required for triggering the banner in testing.
62 static void SetTotalEngagementToTrigger(double engagement); 63 static void SetTotalEngagementToTrigger(double engagement);
63 64
64 // Returns whether or not the URLs match for everything except for the ref. 65 // Returns whether or not the URLs match for everything except for the ref.
65 static bool URLsAreForTheSamePage(const GURL& first, const GURL& second); 66 static bool URLsAreForTheSamePage(const GURL& first, const GURL& second);
66 67
67 // Requests an app banner. If |is_debug_mode| is true, any failure in the 68 // Requests an app banner. If |is_debug_mode| is true, any failure in the
68 // pipeline will be reported to the devtools console. 69 // pipeline will be reported to the devtools console.
69 virtual void RequestAppBanner(const GURL& validated_url, bool is_debug_mode); 70 virtual void RequestAppBanner(const GURL& validated_url, bool is_debug_mode);
70 71
72 // Informs the page that it has been installed via an app banner.
73 // This is redundant for the beforeinstallprompt event's promise being
74 // resolved, but is required by the install event spec.
75 void OnInstall();
76
71 // Sends a message to the renderer that the user accepted the banner. Does 77 // Sends a message to the renderer that the user accepted the banner. Does
72 // nothing if |request_id| does not match the current request. 78 // nothing if |request_id| does not match the current request.
73 void SendBannerAccepted(int request_id); 79 void SendBannerAccepted(int request_id);
74 80
75 // Sends a message to the renderer that the user dismissed the banner. Does 81 // Sends a message to the renderer that the user dismissed the banner. Does
76 // nothing if |request_id| does not match the current request. 82 // nothing if |request_id| does not match the current request.
77 void SendBannerDismissed(int request_id); 83 void SendBannerDismissed(int request_id);
78 84
79 // Overridden and passed through base::Bind on desktop platforms. Called when 85 // 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 86 // 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
269 // scoped to the WebContents which they are observing. This allows us to use 275 // scoped to the WebContents which they are observing. This allows us to use
270 // weak pointers for callbacks. 276 // weak pointers for callbacks.
271 base::WeakPtrFactory<AppBannerManager> weak_factory_; 277 base::WeakPtrFactory<AppBannerManager> weak_factory_;
272 278
273 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); 279 DISALLOW_COPY_AND_ASSIGN(AppBannerManager);
274 }; 280 };
275 281
276 } // namespace banners 282 } // namespace banners
277 283
278 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ 284 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698