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

Side by Side Diff: chrome/browser/ui/passwords/account_avatar_fetcher.cc

Issue 2682263002: Network traffic annotation added to chrome::BitmapFetcher. (Closed)
Patch Set: nits Created 3 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/omnibox/chrome_omnibox_client.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 "net/traffic_annotation/network_traffic_annotation.h"
8 #include "ui/gfx/image/image.h" 9 #include "ui/gfx/image/image.h"
9 #include "ui/gfx/image/image_skia.h" 10 #include "ui/gfx/image/image_skia.h"
10 #include "ui/gfx/image/image_skia_operations.h" 11 #include "ui/gfx/image/image_skia_operations.h"
11 12
13 namespace {
14
15 constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation =
16 net::DefineNetworkTrafficAnnotation("credenential_avatar", R"(
17 semantics {
18 sender: "Chrome Password Manager"
19 description:
20 "Every credential saved in Chromium via the Credential Management "
21 "API can have an avatar URL. The URL is essentially provided by "
22 "the site calling the API. The avatar is used in the account "
23 "chooser UI and auto signin toast which appear when a site calls "
24 "navigator.credentials.get(). The avatar is retrieved before "
25 "showing the UI."
26 trigger:
27 "User visits a site that calls navigator.credentials.get(). "
28 "Assuming there are matching credentials in the Chromium password "
29 "store, the avatars are retrieved."
30 destination: WEBSITE
31 }
32 policy {
33 cookies_allowed: false
34 setting:
35 "One can disable saving new credentials in the settings (see "
36 "'Passwords and forms'). There is no setting to disable the API."
37 policy {
38 PasswordManagerEnabled {
39 policy_options {mode: MANDATORY}
40 value: false
41 }
42 }
43 })");
44
45 } // namespace
46
12 AccountAvatarFetcher::AccountAvatarFetcher( 47 AccountAvatarFetcher::AccountAvatarFetcher(
13 const GURL& url, 48 const GURL& url,
14 const base::WeakPtr<AccountAvatarFetcherDelegate>& delegate) 49 const base::WeakPtr<AccountAvatarFetcherDelegate>& delegate)
15 : fetcher_(url, this), delegate_(delegate) { 50 : fetcher_(url, this, kTrafficAnnotation), delegate_(delegate) {}
16 }
17 51
18 AccountAvatarFetcher::~AccountAvatarFetcher() = default; 52 AccountAvatarFetcher::~AccountAvatarFetcher() = default;
19 53
20 void AccountAvatarFetcher::Start( 54 void AccountAvatarFetcher::Start(
21 net::URLRequestContextGetter* request_context) { 55 net::URLRequestContextGetter* request_context) {
22 fetcher_.Init(request_context, std::string(), 56 fetcher_.Init(request_context, std::string(),
23 net::URLRequest::NEVER_CLEAR_REFERRER, 57 net::URLRequest::NEVER_CLEAR_REFERRER,
24 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES | 58 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES |
25 net::LOAD_DO_NOT_SEND_AUTH_DATA | net::LOAD_MAYBE_USER_GESTURE); 59 net::LOAD_DO_NOT_SEND_AUTH_DATA | net::LOAD_MAYBE_USER_GESTURE);
26 fetcher_.Start(); 60 fetcher_.Start();
27 } 61 }
28 62
29 void AccountAvatarFetcher::OnFetchComplete(const GURL& /*url*/, 63 void AccountAvatarFetcher::OnFetchComplete(const GURL& /*url*/,
30 const SkBitmap* bitmap) { 64 const SkBitmap* bitmap) {
31 if (bitmap && delegate_) 65 if (bitmap && delegate_)
32 delegate_->UpdateAvatar(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap)); 66 delegate_->UpdateAvatar(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap));
33 67
34 delete this; 68 delete this;
35 } 69 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/chrome_omnibox_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698