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

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

Issue 2379923002: Implement "appinstalled" event on Android. (Closed)
Patch Set: Blink style. 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"
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 static void SetEngagementWeights(double direct_engagement, 65 static void SetEngagementWeights(double direct_engagement,
65 double indirect_engagement); 66 double indirect_engagement);
66 67
67 // Returns whether or not the URLs match for everything except for the ref. 68 // Returns whether or not the URLs match for everything except for the ref.
68 static bool URLsAreForTheSamePage(const GURL& first, const GURL& second); 69 static bool URLsAreForTheSamePage(const GURL& first, const GURL& second);
69 70
70 // Requests an app banner. If |is_debug_mode| is true, any failure in the 71 // Requests an app banner. If |is_debug_mode| is true, any failure in the
71 // pipeline will be reported to the devtools console. 72 // pipeline will be reported to the devtools console.
72 virtual void RequestAppBanner(const GURL& validated_url, bool is_debug_mode); 73 virtual void RequestAppBanner(const GURL& validated_url, bool is_debug_mode);
73 74
75 // Informs the page that it has been installed via an app banner.
76 // This is redundant for the beforeinstallprompt event's promise being
77 // resolved, but is required by the install event spec.
78 void OnInstall();
79
74 // Sends a message to the renderer that the user accepted the banner. Does 80 // Sends a message to the renderer that the user accepted the banner. Does
75 // nothing if |request_id| does not match the current request. 81 // nothing if |request_id| does not match the current request.
76 void SendBannerAccepted(int request_id); 82 void SendBannerAccepted(int request_id);
77 83
78 // Sends a message to the renderer that the user dismissed the banner. Does 84 // Sends a message to the renderer that the user dismissed the banner. Does
79 // nothing if |request_id| does not match the current request. 85 // nothing if |request_id| does not match the current request.
80 void SendBannerDismissed(int request_id); 86 void SendBannerDismissed(int request_id);
81 87
82 // Overridden and passed through base::Bind on desktop platforms. Called when 88 // 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 89 // the bookmark app install initiated by a banner has completed. Not used on
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // requests for it to be shown later on. 271 // requests for it to be shown later on.
266 bool was_canceled_by_page_; 272 bool was_canceled_by_page_;
267 bool page_requested_prompt_; 273 bool page_requested_prompt_;
268 274
269 // Whether we should be logging errors to the console for this request. 275 // Whether we should be logging errors to the console for this request.
270 bool is_debug_mode_; 276 bool is_debug_mode_;
271 277
272 // Whether the installable status has been logged for this run. 278 // Whether the installable status has been logged for this run.
273 bool need_to_log_status_; 279 bool need_to_log_status_;
274 280
281 // Service to send events to the renderer.
282 blink::mojom::InstallationServicePtr installation_service_;
dominickn 2016/12/09 06:08:17 This is a one-way message (no callback). No need f
Matt Giuca 2016/12/12 04:28:20 Same question as on the other one.
283
275 // The concrete subclasses of this class are expected to have their lifetimes 284 // The concrete subclasses of this class are expected to have their lifetimes
276 // scoped to the WebContents which they are observing. This allows us to use 285 // scoped to the WebContents which they are observing. This allows us to use
277 // weak pointers for callbacks. 286 // weak pointers for callbacks.
278 base::WeakPtrFactory<AppBannerManager> weak_factory_; 287 base::WeakPtrFactory<AppBannerManager> weak_factory_;
279 288
280 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); 289 DISALLOW_COPY_AND_ASSIGN(AppBannerManager);
281 }; 290 };
282 291
283 } // namespace banners 292 } // namespace banners
284 293
285 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ 294 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698