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

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

Issue 2685363002: Update AppBannerManager & AppBannerManagerAndroid to request badge icon. (Closed)
Patch Set: Addressing comments (move can_install init to constructor) Created 3 years, 10 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 <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 virtual std::string GetAppIdentifier(); 113 virtual std::string GetAppIdentifier();
114 114
115 // Return a string describing what type of banner is being created. Used when 115 // Return a string describing what type of banner is being created. Used when
116 // alerting websites that a banner is about to be created. 116 // alerting websites that a banner is about to be created.
117 virtual std::string GetBannerType(); 117 virtual std::string GetBannerType();
118 118
119 // Returns a string parameter for a devtools console message corresponding to 119 // Returns a string parameter for a devtools console message corresponding to
120 // |code|. Returns the empty string if |code| requires no parameter. 120 // |code|. Returns the empty string if |code| requires no parameter.
121 std::string GetStatusParam(InstallableStatusCode code); 121 std::string GetStatusParam(InstallableStatusCode code);
122 122
123 // Returns the ideal and minimum icon sizes required for being installable. 123 // Returns the ideal and minimum primary icon size requirements.
124 virtual int GetIdealIconSizeInPx(); 124 virtual int GetIdealPrimaryIconSizeInPx();
125 virtual int GetMinimumIconSizeInPx(); 125 virtual int GetMinimumPrimaryIconSizeInPx();
126 126
127 // Returns a WeakPtr to this object. Exposed so subclasses/infobars may 127 // Returns a WeakPtr to this object. Exposed so subclasses/infobars may
128 // may bind callbacks without needing their own WeakPtrFactory. 128 // may bind callbacks without needing their own WeakPtrFactory.
129 base::WeakPtr<AppBannerManager> GetWeakPtr(); 129 base::WeakPtr<AppBannerManager> GetWeakPtr();
130 130
131 // Returns true if |is_debug_mode_| is true or the 131 // Returns true if |is_debug_mode_| is true or the
132 // kBypassAppBannerEngagementChecks flag is set. 132 // kBypassAppBannerEngagementChecks flag is set.
133 virtual bool IsDebugMode() const; 133 virtual bool IsDebugMode() const;
134 134
135 // Returns true if the webapp at |start_url| has already been installed. 135 // Returns true if the webapp at |start_url| has already been installed.
136 virtual bool IsWebAppInstalled(content::BrowserContext* browser_context, 136 virtual bool IsWebAppInstalled(content::BrowserContext* browser_context,
137 const GURL& start_url, 137 const GURL& start_url,
138 const GURL& manifest_url); 138 const GURL& manifest_url);
139 139
140 // Callback invoked by the InstallableManager once it has fetched the page's 140 // Callback invoked by the InstallableManager once it has fetched the page's
141 // manifest. 141 // manifest.
142 void OnDidGetManifest(const InstallableData& result); 142 void OnDidGetManifest(const InstallableData& result);
143 143
144 // Returns an InstallableParams object that requests all checks necessary for
145 // a web app banner.
146 virtual InstallableParams ParamsToPerformInstallableCheck();
147
144 // Run at the conclusion of OnDidGetManifest. For web app banners, this calls 148 // Run at the conclusion of OnDidGetManifest. For web app banners, this calls
145 // back to the InstallableManager to continue checking criteria. For native 149 // back to the InstallableManager to continue checking criteria. For native
146 // app banners, this checks whether native apps are preferred in the manifest, 150 // app banners, this checks whether native apps are preferred in the manifest,
147 // and calls to Java to verify native app details. If a native banner isn't or 151 // and calls to Java to verify native app details. If a native banner isn't or
148 // can't be requested, it continues with the web app banner checks. 152 // can't be requested, it continues with the web app banner checks.
149 virtual void PerformInstallableCheck(); 153 virtual void PerformInstallableCheck();
150 154
151 // Callback invoked by the InstallableManager once it has finished checking 155 // Callback invoked by the InstallableManager once it has finished checking
152 // all other installable properties. 156 // all other installable properties.
153 void OnDidPerformInstallableCheck(const InstallableData& result); 157 virtual void OnDidPerformInstallableCheck(const InstallableData& result);
154 158
155 // Records that a banner was shown. The |event_name| corresponds to the RAPPOR 159 // Records that a banner was shown. The |event_name| corresponds to the RAPPOR
156 // metric being recorded. 160 // metric being recorded.
157 void RecordDidShowBanner(const std::string& event_name); 161 void RecordDidShowBanner(const std::string& event_name);
158 162
159 // Logs an error message corresponding to |code| to the devtools console 163 // Logs an error message corresponding to |code| to the devtools console
160 // attached to |web_contents|. Does nothing if IsDebugMode() returns false. 164 // attached to |web_contents|. Does nothing if IsDebugMode() returns false.
161 void ReportStatus(content::WebContents* web_contents, 165 void ReportStatus(content::WebContents* web_contents,
162 InstallableStatusCode code); 166 InstallableStatusCode code);
163 167
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 205
202 // The URL for which the banner check is being conducted. 206 // The URL for which the banner check is being conducted.
203 GURL validated_url_; 207 GURL validated_url_;
204 208
205 // The URL of the manifest. 209 // The URL of the manifest.
206 GURL manifest_url_; 210 GURL manifest_url_;
207 211
208 // The manifest object. 212 // The manifest object.
209 content::Manifest manifest_; 213 content::Manifest manifest_;
210 214
211 // The URL of the icon. 215 // The URL of the primary icon.
212 GURL icon_url_; 216 GURL primary_icon_url_;
213 217
214 // The icon object. 218 // The primary icon object.
215 std::unique_ptr<SkBitmap> icon_; 219 std::unique_ptr<SkBitmap> primary_icon_;
216 220
217 // The referrer string (if any) specified in the app URL. Used only for native 221 // The referrer string (if any) specified in the app URL. Used only for native
218 // app banners. 222 // app banners.
219 std::string referrer_; 223 std::string referrer_;
220 224
221 private: 225 private:
222 friend class AppBannerManagerTest; 226 friend class AppBannerManagerTest;
223 227
224 // Record that the banner could be shown at this point, if the triggering 228 // Record that the banner could be shown at this point, if the triggering
225 // heuristic allowed. 229 // heuristic allowed.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // scoped to the WebContents which they are observing. This allows us to use 284 // scoped to the WebContents which they are observing. This allows us to use
281 // weak pointers for callbacks. 285 // weak pointers for callbacks.
282 base::WeakPtrFactory<AppBannerManager> weak_factory_; 286 base::WeakPtrFactory<AppBannerManager> weak_factory_;
283 287
284 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); 288 DISALLOW_COPY_AND_ASSIGN(AppBannerManager);
285 }; 289 };
286 290
287 } // namespace banners 291 } // namespace banners
288 292
289 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ 293 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/banners/app_banner_manager_android.cc ('k') | chrome/browser/banners/app_banner_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698