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

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

Issue 2682263002: Network traffic annotation added to chrome::BitmapFetcher. (Closed)
Patch Set: Comments addressed. 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
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
12 AccountAvatarFetcher::AccountAvatarFetcher( 13 AccountAvatarFetcher::AccountAvatarFetcher(
13 const GURL& url, 14 const GURL& url,
14 const base::WeakPtr<AccountAvatarFetcherDelegate>& delegate) 15 const base::WeakPtr<AccountAvatarFetcherDelegate>& delegate)
15 : fetcher_(url, this), delegate_(delegate) { 16 : delegate_(delegate) {
17 net::NetworkTrafficAnnotationTag traffic_annotation =
18 net::DefineNetworkTrafficAnnotation("credenential avatar", R"(
19 semantics {
20 sender: "chrome password manager"
21 description:
22 "Every credential saved in Chrome via the Credential Management "
23 "API can have an avatar URL. The URL is essentially provided by "
24 "the site calling the API. The avatar is used in the account "
25 "chooser UI and auto signin toast which appear when a site calls "
26 "navigator.credentials.get(). The avatar is retrieved before "
27 "showing the UI."
28 trigger:
29 "User visits a site that calls navigator.credentials.get(). "
30 "Assuming there are matching credentials in the Chrome password "
31 "store, the avatars are retrieved."
32 destination: WEBSITE
33 }
34 policy {
35 cookies_allowed: false
36 setting:
37 "One can disable saving new credentials in the settings (see "
38 "'Passwords and forms'). There is no setting to disable the API."
39 }
battre 2017/02/10 08:52:34 @vasilii: Don't we have a policy to disable the en
vasilii 2017/02/10 09:38:01 "PasswordManagerEnabled" is the policy. However, i
Ramin Halavati 2017/02/10 14:40:57 So I think as that policy stops generating this ne
vasilii 2017/02/10 16:29:39 I agree.
40 })");
41 fetcher_.reset(new chrome::BitmapFetcher(url, this, traffic_annotation));
16 } 42 }
17 43
18 AccountAvatarFetcher::~AccountAvatarFetcher() = default; 44 AccountAvatarFetcher::~AccountAvatarFetcher() = default;
19 45
20 void AccountAvatarFetcher::Start( 46 void AccountAvatarFetcher::Start(
21 net::URLRequestContextGetter* request_context) { 47 net::URLRequestContextGetter* request_context) {
22 fetcher_.Init(request_context, std::string(), 48 fetcher_->Init(
23 net::URLRequest::NEVER_CLEAR_REFERRER, 49 request_context, std::string(), net::URLRequest::NEVER_CLEAR_REFERRER,
24 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES | 50 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); 51 net::LOAD_DO_NOT_SEND_AUTH_DATA | net::LOAD_MAYBE_USER_GESTURE);
vasilii 2017/02/10 09:38:01 I liked the previous formatting more.
Ramin Halavati 2017/02/10 14:40:57 Sorry, reverted. git cl format had done it behind
26 fetcher_.Start(); 52 fetcher_->Start();
27 } 53 }
28 54
29 void AccountAvatarFetcher::OnFetchComplete(const GURL& /*url*/, 55 void AccountAvatarFetcher::OnFetchComplete(const GURL& /*url*/,
30 const SkBitmap* bitmap) { 56 const SkBitmap* bitmap) {
31 if (bitmap && delegate_) 57 if (bitmap && delegate_)
32 delegate_->UpdateAvatar(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap)); 58 delegate_->UpdateAvatar(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap));
33 59
34 delete this; 60 delete this;
35 } 61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698