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

Side by Side Diff: chrome/browser/ui/passwords/account_avatar_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 | « chrome/browser/search/suggestions/image_fetcher_impl.cc ('k') | no next file » | 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/ui/passwords/account_avatar_fetcher.h" 5 #include "chrome/browser/ui/passwords/account_avatar_fetcher.h"
6 6
7 #include "net/base/load_flags.h" 7 #include "net/base/load_flags.h"
8 #include "ui/gfx/image/image.h" 8 #include "ui/gfx/image/image.h"
9 #include "ui/gfx/image/image_skia.h" 9 #include "ui/gfx/image/image_skia.h"
10 #include "ui/gfx/image/image_skia_operations.h" 10 #include "ui/gfx/image/image_skia_operations.h"
11 11
12 AccountAvatarFetcher::AccountAvatarFetcher( 12 AccountAvatarFetcher::AccountAvatarFetcher(
13 const GURL& url, 13 const GURL& url,
14 const base::WeakPtr<AccountAvatarFetcherDelegate>& delegate) 14 const base::WeakPtr<AccountAvatarFetcherDelegate>& delegate)
15 : fetcher_(url, this), delegate_(delegate) { 15 : fetcher_(url, this), delegate_(delegate) {
16 } 16 }
17 17
18 AccountAvatarFetcher::~AccountAvatarFetcher() = default; 18 AccountAvatarFetcher::~AccountAvatarFetcher() = default;
19 19
20 void AccountAvatarFetcher::Start( 20 void AccountAvatarFetcher::Start(
21 net::URLRequestContextGetter* request_context) { 21 net::URLRequestContextGetter* request_context) {
22 fetcher_.Start(request_context, std::string(), 22 fetcher_.Init(request_context, std::string(),
23 net::URLRequest::NEVER_CLEAR_REFERRER, 23 net::URLRequest::NEVER_CLEAR_REFERRER,
24 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES | 24 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES |
25 net::LOAD_MAYBE_USER_GESTURE); 25 net::LOAD_MAYBE_USER_GESTURE);
26 fetcher_.Start();
26 } 27 }
27 28
28 void AccountAvatarFetcher::OnFetchComplete(const GURL& /*url*/, 29 void AccountAvatarFetcher::OnFetchComplete(const GURL& /*url*/,
29 const SkBitmap* bitmap) { 30 const SkBitmap* bitmap) {
30 if (bitmap && delegate_) 31 if (bitmap && delegate_)
31 delegate_->UpdateAvatar(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap)); 32 delegate_->UpdateAvatar(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap));
32 33
33 delete this; 34 delete this;
34 } 35 }
OLDNEW
« no previous file with comments | « chrome/browser/search/suggestions/image_fetcher_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698