| OLD | NEW |
| 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/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 // Returns the current time. | 52 // Returns the current time. |
| 53 static base::Time GetCurrentTime(); | 53 static base::Time GetCurrentTime(); |
| 54 | 54 |
| 55 // Fast-forwards the current time for testing. | 55 // Fast-forwards the current time for testing. |
| 56 static void SetTimeDeltaForTesting(int days); | 56 static void SetTimeDeltaForTesting(int days); |
| 57 | 57 |
| 58 AppBannerDataFetcher(content::WebContents* web_contents, | 58 AppBannerDataFetcher(content::WebContents* web_contents, |
| 59 base::WeakPtr<Delegate> weak_delegate, | 59 base::WeakPtr<Delegate> weak_delegate, |
| 60 int ideal_icon_size_in_dp); | 60 int ideal_icon_size_in_dp, |
| 61 int minimum_icon_size_in_dp); |
| 61 | 62 |
| 62 // Begins creating a banner for the URL being displayed by the Delegate's | 63 // Begins creating a banner for the URL being displayed by the Delegate's |
| 63 // WebContents. | 64 // WebContents. |
| 64 void Start(const GURL& validated_url, ui::PageTransition transition_type); | 65 void Start(const GURL& validated_url, ui::PageTransition transition_type); |
| 65 | 66 |
| 66 // Stops the pipeline when any asynchronous calls return. | 67 // Stops the pipeline when any asynchronous calls return. |
| 67 void Cancel(); | 68 void Cancel(); |
| 68 | 69 |
| 69 // Replaces the WebContents that is being observed. | 70 // Replaces the WebContents that is being observed. |
| 70 void ReplaceWebContents(content::WebContents* web_contents); | 71 void ReplaceWebContents(content::WebContents* web_contents); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 163 |
| 163 // Returns whether the fetcher is active and web contents have not been | 164 // Returns whether the fetcher is active and web contents have not been |
| 164 // closed. | 165 // closed. |
| 165 bool CheckFetcherIsStillAlive(content::WebContents* web_contents); | 166 bool CheckFetcherIsStillAlive(content::WebContents* web_contents); |
| 166 | 167 |
| 167 // Returns whether the given Manifest is following the requirements to show | 168 // Returns whether the given Manifest is following the requirements to show |
| 168 // a web app banner. | 169 // a web app banner. |
| 169 static bool IsManifestValidForWebApp(const content::Manifest& manifest, | 170 static bool IsManifestValidForWebApp(const content::Manifest& manifest, |
| 170 content::WebContents* web_contents); | 171 content::WebContents* web_contents); |
| 171 | 172 |
| 173 const base::WeakPtr<Delegate> weak_delegate_; |
| 172 const int ideal_icon_size_in_dp_; | 174 const int ideal_icon_size_in_dp_; |
| 173 const base::WeakPtr<Delegate> weak_delegate_; | 175 const int minimum_icon_size_in_dp_; |
| 174 base::ObserverList<Observer> observer_list_; | 176 base::ObserverList<Observer> observer_list_; |
| 175 bool is_active_; | 177 bool is_active_; |
| 176 bool was_canceled_by_page_; | 178 bool was_canceled_by_page_; |
| 177 bool page_requested_prompt_; | 179 bool page_requested_prompt_; |
| 178 ui::PageTransition transition_type_; | 180 ui::PageTransition transition_type_; |
| 179 int event_request_id_; | 181 int event_request_id_; |
| 180 scoped_ptr<SkBitmap> app_icon_; | 182 scoped_ptr<SkBitmap> app_icon_; |
| 181 std::string referrer_; | 183 std::string referrer_; |
| 182 | 184 |
| 183 GURL validated_url_; | 185 GURL validated_url_; |
| 184 base::string16 app_title_; | 186 base::string16 app_title_; |
| 185 content::Manifest web_app_data_; | 187 content::Manifest web_app_data_; |
| 186 | 188 |
| 187 friend class AppBannerDataFetcherUnitTest; | 189 friend class AppBannerDataFetcherUnitTest; |
| 188 friend class base::RefCounted<AppBannerDataFetcher>; | 190 friend class base::RefCounted<AppBannerDataFetcher>; |
| 189 DISALLOW_COPY_AND_ASSIGN(AppBannerDataFetcher); | 191 DISALLOW_COPY_AND_ASSIGN(AppBannerDataFetcher); |
| 190 }; | 192 }; |
| 191 | 193 |
| 192 } // namespace banners | 194 } // namespace banners |
| 193 | 195 |
| 194 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_ | 196 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_ |
| OLD | NEW |