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

Unified Diff: chrome/browser/ui/passwords/account_avatar_fetcher.cc

Issue 901493003: Extract some account chooser views things for cross-platform use. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/passwords/account_avatar_fetcher.cc
diff --git a/chrome/browser/ui/passwords/account_avatar_fetcher.cc b/chrome/browser/ui/passwords/account_avatar_fetcher.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e55583fe69516a8824aeefdd557450b09fbfb2f8
--- /dev/null
+++ b/chrome/browser/ui/passwords/account_avatar_fetcher.cc
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/passwords/account_avatar_fetcher.h"
+
+#include "net/base/load_flags.h"
+#include "ui/gfx/image/image.h"
+#include "ui/gfx/image/image_skia.h"
+#include "ui/gfx/image/image_skia_operations.h"
+
+AccountAvatarFetcher::AccountAvatarFetcher(
+ const GURL& url,
+ const base::WeakPtr<AccountAvatarFetcherDelegate>& delegate)
+ : fetcher_(url, this), delegate_(delegate) {
+}
+
+AccountAvatarFetcher::~AccountAvatarFetcher() = default;
+
+void AccountAvatarFetcher::Start(
+ net::URLRequestContextGetter* request_context) {
+ fetcher_.Start(request_context, std::string(),
+ net::URLRequest::NEVER_CLEAR_REFERRER,
+ net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES |
+ net::LOAD_MAYBE_USER_GESTURE);
+}
+
+void AccountAvatarFetcher::OnFetchComplete(const GURL /*url*/,
+ const SkBitmap* bitmap) {
+ if (bitmap && delegate_)
+ delegate_->UpdateAvatar(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap));
+
+ delete this;
+}
« no previous file with comments | « chrome/browser/ui/passwords/account_avatar_fetcher.h ('k') | chrome/browser/ui/passwords/manage_passwords_view_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698