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

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

Issue 1569893003: Add "Request app banner" context menu in DevTools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on https://codereview.chromium.org/1571633002/ Created 4 years, 11 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 "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 // Returns the current time. 53 // Returns the current time.
54 static base::Time GetCurrentTime(); 54 static base::Time GetCurrentTime();
55 55
56 // Fast-forwards the current time for testing. 56 // Fast-forwards the current time for testing.
57 static void SetTimeDeltaForTesting(int days); 57 static void SetTimeDeltaForTesting(int days);
58 58
59 AppBannerDataFetcher(content::WebContents* web_contents, 59 AppBannerDataFetcher(content::WebContents* web_contents,
60 base::WeakPtr<Delegate> weak_delegate, 60 base::WeakPtr<Delegate> weak_delegate,
61 int ideal_icon_size_in_dp, 61 int ideal_icon_size_in_dp,
62 int minimum_icon_size_in_dp); 62 int minimum_icon_size_in_dp,
63 bool is_debug_mode);
63 64
64 // Begins creating a banner for the URL being displayed by the Delegate's 65 // Begins creating a banner for the URL being displayed by the Delegate's
65 // WebContents. 66 // WebContents.
66 void Start(const GURL& validated_url, ui::PageTransition transition_type); 67 void Start(const GURL& validated_url, ui::PageTransition transition_type);
67 68
68 // Stops the pipeline when any asynchronous calls return. 69 // Stops the pipeline when any asynchronous calls return.
69 void Cancel(); 70 void Cancel();
70 71
71 // Replaces the WebContents that is being observed. 72 // Replaces the WebContents that is being observed.
72 void ReplaceWebContents(content::WebContents* web_contents); 73 void ReplaceWebContents(content::WebContents* web_contents);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // Returns whether the banner should be shown. 164 // Returns whether the banner should be shown.
164 bool CheckIfShouldShowBanner(); 165 bool CheckIfShouldShowBanner();
165 166
166 // Returns whether the fetcher is active and web contents have not been 167 // Returns whether the fetcher is active and web contents have not been
167 // closed. 168 // closed.
168 bool CheckFetcherIsStillAlive(content::WebContents* web_contents); 169 bool CheckFetcherIsStillAlive(content::WebContents* web_contents);
169 170
170 // Returns whether the given Manifest is following the requirements to show 171 // Returns whether the given Manifest is following the requirements to show
171 // a web app banner. 172 // a web app banner.
172 static bool IsManifestValidForWebApp(const content::Manifest& manifest, 173 static bool IsManifestValidForWebApp(const content::Manifest& manifest,
173 content::WebContents* web_contents); 174 content::WebContents* web_contents,
175 bool is_debug_mode);
174 176
175 const base::WeakPtr<Delegate> weak_delegate_; 177 const base::WeakPtr<Delegate> weak_delegate_;
176 const int ideal_icon_size_in_dp_; 178 const int ideal_icon_size_in_dp_;
177 const int minimum_icon_size_in_dp_; 179 const int minimum_icon_size_in_dp_;
178 base::ObserverList<Observer> observer_list_; 180 base::ObserverList<Observer> observer_list_;
179 bool is_active_; 181 bool is_active_;
180 bool was_canceled_by_page_; 182 bool was_canceled_by_page_;
181 bool page_requested_prompt_; 183 bool page_requested_prompt_;
182 ui::PageTransition transition_type_; 184 ui::PageTransition transition_type_;
183 int event_request_id_; 185 int event_request_id_;
184 scoped_ptr<SkBitmap> app_icon_; 186 scoped_ptr<SkBitmap> app_icon_;
185 std::string referrer_; 187 std::string referrer_;
186 188
187 GURL validated_url_; 189 GURL validated_url_;
188 base::string16 app_title_; 190 base::string16 app_title_;
189 content::Manifest web_app_data_; 191 content::Manifest web_app_data_;
192 const bool is_debug_mode_;
190 193
191 friend class AppBannerDataFetcherUnitTest; 194 friend class AppBannerDataFetcherUnitTest;
192 friend class base::RefCounted<AppBannerDataFetcher>; 195 friend class base::RefCounted<AppBannerDataFetcher>;
193 DISALLOW_COPY_AND_ASSIGN(AppBannerDataFetcher); 196 DISALLOW_COPY_AND_ASSIGN(AppBannerDataFetcher);
194 }; 197 };
195 198
196 } // namespace banners 199 } // namespace banners
197 200
198 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_ 201 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698