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

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

Issue 2050933002: Upstream: Add additional checks before creating a WebAPK after clicking "Add to Homescreen" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'create_webapk_requirements_enum_class' into create_webapk_requirements2 Created 4 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_DATA_FETCHER_H_ 5 #ifndef CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_
6 #define CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_ 6 #define CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "chrome/browser/banners/app_banner_debug_log.h"
15 #include "chrome/common/web_application_info.h" 16 #include "chrome/common/web_application_info.h"
16 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "content/public/browser/web_contents_observer.h" 19 #include "content/public/browser/web_contents_observer.h"
19 #include "content/public/common/manifest.h" 20 #include "content/public/common/manifest.h"
20 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm ptReply.h" 21 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm ptReply.h"
21 22
22 namespace chrome { 23 namespace chrome {
23 class BitmapFetcher; 24 class BitmapFetcher;
24 } // namespace chrome 25 } // namespace chrome
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void OnBannerPromptReply(content::RenderFrameHost* render_frame_host, 124 void OnBannerPromptReply(content::RenderFrameHost* render_frame_host,
124 int request_id, 125 int request_id,
125 blink::WebAppBannerPromptReply reply, 126 blink::WebAppBannerPromptReply reply,
126 std::string referrer); 127 std::string referrer);
127 128
128 // Called when the client has prevented a banner from being shown, and is 129 // Called when the client has prevented a banner from being shown, and is
129 // now requesting that it be shown later. 130 // now requesting that it be shown later.
130 void OnRequestShowAppBanner(content::RenderFrameHost* render_frame_host, 131 void OnRequestShowAppBanner(content::RenderFrameHost* render_frame_host,
131 int request_id); 132 int request_id);
132 133
134 // Returns whether the given Manifest meets the requirements to show a web app
135 // banner. If not, sets |code| to the reason why.
136 virtual bool CheckManifest(const content::Manifest& manifest,
137 OutputDeveloperMessageCode* code);
138
133 content::WebContents* GetWebContents(); 139 content::WebContents* GetWebContents();
134 virtual std::string GetAppIdentifier(); 140 virtual std::string GetAppIdentifier();
135 const GURL& manifest_url() { return manifest_url_; } 141 const GURL& manifest_url() { return manifest_url_; }
136 const content::Manifest& manifest() { return manifest_; } 142 const content::Manifest& manifest() { return manifest_; }
137 void set_app_title(const base::string16& title) { app_title_ = title; } 143 void set_app_title(const base::string16& title) { app_title_ = title; }
138 int event_request_id() { return event_request_id_; } 144 int event_request_id() { return event_request_id_; }
139 145
140 // Fetches the icon at the given URL asynchronously, returning |false| if a 146 // Fetches the icon at the given URL asynchronously, returning |false| if a
141 // load could not be started. 147 // load could not be started.
142 bool FetchAppIcon(content::WebContents* web_contents, const GURL& url); 148 bool FetchAppIcon(content::WebContents* web_contents, const GURL& url);
(...skipping 29 matching lines...) Expand all
172 const base::string16& title, 178 const base::string16& title,
173 const std::string& referrer) = 0; 179 const std::string& referrer) = 0;
174 180
175 // Returns whether the banner should be shown. 181 // Returns whether the banner should be shown.
176 bool CheckIfShouldShowBanner(); 182 bool CheckIfShouldShowBanner();
177 183
178 // Returns whether the fetcher is active and web contents have not been 184 // Returns whether the fetcher is active and web contents have not been
179 // closed. 185 // closed.
180 bool CheckFetcherIsStillAlive(content::WebContents* web_contents); 186 bool CheckFetcherIsStillAlive(content::WebContents* web_contents);
181 187
182 // Returns whether the given Manifest is following the requirements to show
183 // a web app banner.
184 static bool IsManifestValidForWebApp(const content::Manifest& manifest,
185 content::WebContents* web_contents,
186 bool is_debug_mode);
187
188 const base::WeakPtr<Delegate> weak_delegate_; 188 const base::WeakPtr<Delegate> weak_delegate_;
189 const int ideal_icon_size_in_dp_; 189 const int ideal_icon_size_in_dp_;
190 const int minimum_icon_size_in_dp_; 190 const int minimum_icon_size_in_dp_;
191 base::ObserverList<Observer> observer_list_; 191 base::ObserverList<Observer> observer_list_;
192 bool is_active_; 192 bool is_active_;
193 bool was_canceled_by_page_; 193 bool was_canceled_by_page_;
194 bool page_requested_prompt_; 194 bool page_requested_prompt_;
195 const bool is_debug_mode_; 195 const bool is_debug_mode_;
196 ui::PageTransition transition_type_; 196 ui::PageTransition transition_type_;
197 int event_request_id_; 197 int event_request_id_;
(...skipping 13 matching lines...) Expand all
211 content::BrowserThread::UI>; 211 content::BrowserThread::UI>;
212 friend class base::DeleteHelper<AppBannerDataFetcher>; 212 friend class base::DeleteHelper<AppBannerDataFetcher>;
213 friend class AppBannerDataFetcherUnitTest; 213 friend class AppBannerDataFetcherUnitTest;
214 friend class base::RefCounted<AppBannerDataFetcher>; 214 friend class base::RefCounted<AppBannerDataFetcher>;
215 DISALLOW_COPY_AND_ASSIGN(AppBannerDataFetcher); 215 DISALLOW_COPY_AND_ASSIGN(AppBannerDataFetcher);
216 }; 216 };
217 217
218 } // namespace banners 218 } // namespace banners
219 219
220 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_ 220 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc ('k') | chrome/browser/banners/app_banner_data_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698