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 #include "chrome/browser/banners/app_banner_data_fetcher.h" | 5 #include "chrome/browser/banners/app_banner_data_fetcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "chrome/browser/banners/app_banner_metrics.h" | 9 #include "chrome/browser/banners/app_banner_metrics.h" |
10 #include "chrome/browser/banners/app_banner_settings_helper.h" | 10 #include "chrome/browser/banners/app_banner_settings_helper.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 DCHECK(web_contents); | 187 DCHECK(web_contents); |
188 | 188 |
189 // Begin asynchronously fetching the app icon. AddRef() is done before the | 189 // Begin asynchronously fetching the app icon. AddRef() is done before the |
190 // fetch to ensure that the AppBannerDataFetcher isn't deleted before the | 190 // fetch to ensure that the AppBannerDataFetcher isn't deleted before the |
191 // BitmapFetcher has called OnFetchComplete() (where the references are | 191 // BitmapFetcher has called OnFetchComplete() (where the references are |
192 // decremented). | 192 // decremented). |
193 AddRef(); | 193 AddRef(); |
194 Profile* profile = | 194 Profile* profile = |
195 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 195 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
196 bitmap_fetcher_.reset(new chrome::BitmapFetcher(image_url, this)); | 196 bitmap_fetcher_.reset(new chrome::BitmapFetcher(image_url, this)); |
197 bitmap_fetcher_->Start( | 197 bitmap_fetcher_->Init( |
198 profile->GetRequestContext(), | 198 profile->GetRequestContext(), |
199 std::string(), | 199 std::string(), |
200 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, | 200 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, |
201 net::LOAD_NORMAL); | 201 net::LOAD_NORMAL); |
| 202 bitmap_fetcher_->Start(); |
202 return true; | 203 return true; |
203 } | 204 } |
204 | 205 |
205 infobars::InfoBar* AppBannerDataFetcher::CreateBanner( | 206 infobars::InfoBar* AppBannerDataFetcher::CreateBanner( |
206 const SkBitmap* icon, | 207 const SkBitmap* icon, |
207 const base::string16& title) { | 208 const base::string16& title) { |
208 content::WebContents* web_contents = GetWebContents(); | 209 content::WebContents* web_contents = GetWebContents(); |
209 DCHECK(web_contents && !web_app_data_.IsEmpty()); | 210 DCHECK(web_contents && !web_app_data_.IsEmpty()); |
210 | 211 |
211 // TODO(dfalcantara): Desktop doesn't display app banners, yet. Just pretend | 212 // TODO(dfalcantara): Desktop doesn't display app banners, yet. Just pretend |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 if (!manifest.start_url.is_valid()) | 344 if (!manifest.start_url.is_valid()) |
344 return false; | 345 return false; |
345 if (manifest.name.is_null() && manifest.short_name.is_null()) | 346 if (manifest.name.is_null() && manifest.short_name.is_null()) |
346 return false; | 347 return false; |
347 if (!DoesManifestContainRequiredIcon(manifest)) | 348 if (!DoesManifestContainRequiredIcon(manifest)) |
348 return false; | 349 return false; |
349 return true; | 350 return true; |
350 } | 351 } |
351 | 352 |
352 } // namespace banners | 353 } // namespace banners |
OLD | NEW |