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

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

Issue 1097383005: Add possibility to define data callback to BitmapFetcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@r479598_extensions_content_verifier_directories_fail
Patch Set: Clarified how calling Init/Start twice works + fixed android Created 5 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/bitmap_fetcher/bitmap_fetcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bitmap_fetcher/bitmap_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698