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

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

Issue 2969163002: Remove AppBannerManager::event_request_id(). (Closed)
Patch Set: DCHECK -> conditional Created 3 years, 5 months 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 <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // Requests an app banner. If |is_debug_mode| is true, any failure in the 62 // Requests an app banner. If |is_debug_mode| is true, any failure in the
63 // pipeline will be reported to the devtools console. 63 // pipeline will be reported to the devtools console.
64 virtual void RequestAppBanner(const GURL& validated_url, bool is_debug_mode); 64 virtual void RequestAppBanner(const GURL& validated_url, bool is_debug_mode);
65 65
66 // Informs the page that it has been installed via an app banner. 66 // Informs the page that it has been installed via an app banner.
67 // This is redundant for the beforeinstallprompt event's promise being 67 // This is redundant for the beforeinstallprompt event's promise being
68 // resolved, but is required by the install event spec. 68 // resolved, but is required by the install event spec.
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.
72 // nothing if |request_id| does not match the current request. 72 void SendBannerAccepted();
73 void SendBannerAccepted(int request_id);
74 73
75 // Sends a message to the renderer that the user dismissed the banner. Does 74 // Sends a message to the renderer that the user dismissed the banner.
76 // nothing if |request_id| does not match the current request. 75 void SendBannerDismissed();
77 void SendBannerDismissed(int request_id);
78 76
79 // Returns a WeakPtr to this object. Exposed so subclasses/infobars may 77 // Returns a WeakPtr to this object. Exposed so subclasses/infobars may
80 // may bind callbacks without needing their own WeakPtrFactory. 78 // may bind callbacks without needing their own WeakPtrFactory.
81 base::WeakPtr<AppBannerManager> GetWeakPtr(); 79 base::WeakPtr<AppBannerManager> GetWeakPtr();
82 80
83 // Overridden and passed through base::Bind on desktop platforms. Called when 81 // Overridden and passed through base::Bind on desktop platforms. Called when
84 // the bookmark app install initiated by a banner has completed. Not used on 82 // the bookmark app install initiated by a banner has completed. Not used on
85 // Android. 83 // Android.
86 virtual void DidFinishCreatingBookmarkApp( 84 virtual void DidFinishCreatingBookmarkApp(
87 const extensions::Extension* extension, 85 const extensions::Extension* extension,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 void WebContentsDestroyed() override; 208 void WebContentsDestroyed() override;
211 209
212 // SiteEngagementObserver overrides. 210 // SiteEngagementObserver overrides.
213 void OnEngagementIncreased(content::WebContents* web_contents, 211 void OnEngagementIncreased(content::WebContents* web_contents,
214 const GURL& url, 212 const GURL& url,
215 double score) override; 213 double score) override;
216 214
217 // Subclass accessors for private fields which should not be changed outside 215 // Subclass accessors for private fields which should not be changed outside
218 // this class. 216 // this class.
219 InstallableManager* manager() const { return manager_; } 217 InstallableManager* manager() const { return manager_; }
220 int event_request_id() const { return event_request_id_; }
221 bool is_active() const { return state_ == State::ACTIVE; } 218 bool is_active() const { return state_ == State::ACTIVE; }
222 bool is_active_or_pending() const { 219 bool is_active_or_pending() const {
223 switch (state_) { 220 switch (state_) {
224 case State::ACTIVE: 221 case State::ACTIVE:
225 case State::PENDING_MANIFEST: 222 case State::PENDING_MANIFEST:
226 case State::PENDING_INSTALLABLE_CHECK: 223 case State::PENDING_INSTALLABLE_CHECK:
227 case State::PENDING_ENGAGEMENT: 224 case State::PENDING_ENGAGEMENT:
228 case State::PENDING_EVENT: 225 case State::PENDING_EVENT:
229 return true; 226 return true;
230 case State::INACTIVE: 227 case State::INACTIVE:
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // blink::mojom::AppBannerService overrides. 280 // blink::mojom::AppBannerService overrides.
284 // Called when Blink has prevented a banner from being shown, and is now 281 // Called when Blink has prevented a banner from being shown, and is now
285 // requesting that it be shown later. 282 // requesting that it be shown later.
286 void DisplayAppBanner(bool user_gesture) override; 283 void DisplayAppBanner(bool user_gesture) override;
287 284
288 // Fetches the data required to display a banner for the current page. 285 // Fetches the data required to display a banner for the current page.
289 InstallableManager* manager_; 286 InstallableManager* manager_;
290 287
291 // A monotonically increasing id to verify the response to the 288 // A monotonically increasing id to verify the response to the
292 // beforeinstallprompt event from the renderer. 289 // beforeinstallprompt event from the renderer.
293 int event_request_id_; 290 int event_request_id_;
benwells 2017/07/06 05:00:35 Is this still needed?
dominickn 2017/07/06 05:36:08 Oops. Removed.
294 291
295 // We do not want to trigger a banner when the manager is attached to 292 // We do not want to trigger a banner when the manager is attached to
296 // a WebContents that is playing video. Banners triggering on a site in the 293 // a WebContents that is playing video. Banners triggering on a site in the
297 // background will appear when the tab is reactivated. 294 // background will appear when the tab is reactivated.
298 std::vector<MediaPlayerId> active_media_players_; 295 std::vector<MediaPlayerId> active_media_players_;
299 296
300 // Mojo bindings and interface pointers. 297 // Mojo bindings and interface pointers.
301 mojo::Binding<blink::mojom::AppBannerService> binding_; 298 mojo::Binding<blink::mojom::AppBannerService> binding_;
302 blink::mojom::AppBannerEventPtr event_; 299 blink::mojom::AppBannerEventPtr event_;
303 blink::mojom::AppBannerControllerPtr controller_; 300 blink::mojom::AppBannerControllerPtr controller_;
(...skipping 16 matching lines...) Expand all
320 // scoped to the WebContents which they are observing. This allows us to use 317 // scoped to the WebContents which they are observing. This allows us to use
321 // weak pointers for callbacks. 318 // weak pointers for callbacks.
322 base::WeakPtrFactory<AppBannerManager> weak_factory_; 319 base::WeakPtrFactory<AppBannerManager> weak_factory_;
323 320
324 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); 321 DISALLOW_COPY_AND_ASSIGN(AppBannerManager);
325 }; 322 };
326 323
327 } // namespace banners 324 } // namespace banners
328 325
329 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ 326 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698