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 "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/banners/app_banner_debug_log.h" | 10 #include "chrome/browser/banners/app_banner_debug_log.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 DCHECK(web_contents); | 190 DCHECK(web_contents); |
191 | 191 |
192 // Begin asynchronously fetching the app icon. AddRef() is done before the | 192 // Begin asynchronously fetching the app icon. AddRef() is done before the |
193 // fetch to ensure that the AppBannerDataFetcher isn't deleted before the | 193 // fetch to ensure that the AppBannerDataFetcher isn't deleted before the |
194 // BitmapFetcher has called OnFetchComplete() (where the references are | 194 // BitmapFetcher has called OnFetchComplete() (where the references are |
195 // decremented). | 195 // decremented). |
196 AddRef(); | 196 AddRef(); |
197 Profile* profile = | 197 Profile* profile = |
198 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 198 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
199 bitmap_fetcher_.reset(new chrome::BitmapFetcher(image_url, this)); | 199 bitmap_fetcher_.reset(new chrome::BitmapFetcher(image_url, this)); |
200 bitmap_fetcher_->Start( | 200 bitmap_fetcher_->Init( |
201 profile->GetRequestContext(), | 201 profile->GetRequestContext(), |
202 std::string(), | 202 std::string(), |
203 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, | 203 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, |
204 net::LOAD_NORMAL); | 204 net::LOAD_NORMAL); |
| 205 bitmap_fetcher_->Start(); |
205 return true; | 206 return true; |
206 } | 207 } |
207 | 208 |
208 infobars::InfoBar* AppBannerDataFetcher::CreateBanner( | 209 infobars::InfoBar* AppBannerDataFetcher::CreateBanner( |
209 const SkBitmap* icon, | 210 const SkBitmap* icon, |
210 const base::string16& title) { | 211 const base::string16& title) { |
211 content::WebContents* web_contents = GetWebContents(); | 212 content::WebContents* web_contents = GetWebContents(); |
212 DCHECK(web_contents && !web_app_data_.IsEmpty()); | 213 DCHECK(web_contents && !web_app_data_.IsEmpty()); |
213 | 214 |
214 // TODO(dfalcantara): Desktop doesn't display app banners, yet. Just pretend | 215 // TODO(dfalcantara): Desktop doesn't display app banners, yet. Just pretend |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 return false; | 395 return false; |
395 } | 396 } |
396 if (!DoesManifestContainRequiredIcon(manifest)) { | 397 if (!DoesManifestContainRequiredIcon(manifest)) { |
397 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon); | 398 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon); |
398 return false; | 399 return false; |
399 } | 400 } |
400 return true; | 401 return true; |
401 } | 402 } |
402 | 403 |
403 } // namespace banners | 404 } // namespace banners |
OLD | NEW |