Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / passwords / account_avatar_fetcher.cc
blob3889e11a2a098895c93a211a04f6f53db321019c
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/passwords/account_avatar_fetcher.h"
7 #include "net/base/load_flags.h"
8 #include "ui/gfx/image/image.h"
9 #include "ui/gfx/image/image_skia.h"
10 #include "ui/gfx/image/image_skia_operations.h"
12 AccountAvatarFetcher::AccountAvatarFetcher(
13 const GURL& url,
14 const base::WeakPtr<AccountAvatarFetcherDelegate>& delegate)
15 : fetcher_(url, this), delegate_(delegate) {
18 AccountAvatarFetcher::~AccountAvatarFetcher() = default;
20 void AccountAvatarFetcher::Start(
21 net::URLRequestContextGetter* request_context) {
22 fetcher_.Init(request_context, std::string(),
23 net::URLRequest::NEVER_CLEAR_REFERRER,
24 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES |
25 net::LOAD_MAYBE_USER_GESTURE);
26 fetcher_.Start();
29 void AccountAvatarFetcher::OnFetchComplete(const GURL& /*url*/,
30 const SkBitmap* bitmap) {
31 if (bitmap && delegate_)
32 delegate_->UpdateAvatar(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap));
34 delete this;