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

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

Issue 2682263002: Network traffic annotation added to chrome::BitmapFetcher. (Closed)
Patch Set: Unittests added. 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("", R"(
vasilii 2017/02/09 13:47:46 "credenential avatar"
Ramin Halavati 2017/02/09 14:22:51 Done.
19 semantics {
20 sender: ""
vasilii 2017/02/09 13:47:45 Chrome Password manager
Ramin Halavati 2017/02/09 14:22:51 Done.
21 description: ""
vasilii 2017/02/09 13:47:45 Every credential saved in Chrome via the Credentia
Ramin Halavati 2017/02/09 14:22:51 Done.
22 trigger: ""
vasilii 2017/02/09 13:47:45 User visits a site that calls navigator.credential
Ramin Halavati 2017/02/09 14:22:51 Done.
23 data: ""
vasilii 2017/02/09 13:47:45 No outbound data.
Ramin Halavati 2017/02/09 14:22:51 Done.
24 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER
vasilii 2017/02/09 13:47:45 WEBSITE
Ramin Halavati 2017/02/09 14:22:51 Done.
25 }
26 policy {
27 cookies_allowed: false/true
vasilii 2017/02/09 13:47:46 false
Ramin Halavati 2017/02/09 14:22:51 Done.
28 cookies_store_exceptions: ""
29 setting: ""
vasilii 2017/02/09 13:47:45 One can disable saving new credentials in the sett
Ramin Halavati 2017/02/09 14:22:51 Done.
30 policy {
vasilii 2017/02/09 13:47:45 N/A
Ramin Halavati 2017/02/09 14:22:51 Done.
31 [POLICY_NAME] {
32 policy_options {mode: MANDATORY/RECOMMENDED/UNSET}
33 value: ...
34 }
35 }
36 })");
37 fetcher_.reset(new chrome::BitmapFetcher(url, this, traffic_annotation));
vasilii 2017/02/09 13:47:46 I don't think we need a unique_ptr here. Can you c
Ramin Halavati 2017/02/09 14:22:51 The tag is now generated by net::DefineNetworkTraf
vasilii 2017/02/09 14:25:53 Right, to the anonymous namespace.
Ramin Halavati 2017/02/10 14:40:57 Done.
16 } 38 }
17 39
18 AccountAvatarFetcher::~AccountAvatarFetcher() = default; 40 AccountAvatarFetcher::~AccountAvatarFetcher() = default;
19 41
20 void AccountAvatarFetcher::Start( 42 void AccountAvatarFetcher::Start(
21 net::URLRequestContextGetter* request_context) { 43 net::URLRequestContextGetter* request_context) {
22 fetcher_.Init(request_context, std::string(), 44 fetcher_->Init(request_context, std::string(),
23 net::URLRequest::NEVER_CLEAR_REFERRER, 45 net::URLRequest::NEVER_CLEAR_REFERRER,
24 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES | 46 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); 47 net::LOAD_DO_NOT_SEND_AUTH_DATA | net::LOAD_MAYBE_USER_GESTURE);
26 fetcher_.Start(); 48 fetcher_->Start();
27 } 49 }
28 50
29 void AccountAvatarFetcher::OnFetchComplete(const GURL& /*url*/, 51 void AccountAvatarFetcher::OnFetchComplete(const GURL& /*url*/,
30 const SkBitmap* bitmap) { 52 const SkBitmap* bitmap) {
31 if (bitmap && delegate_) 53 if (bitmap && delegate_)
32 delegate_->UpdateAvatar(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap)); 54 delegate_->UpdateAvatar(gfx::ImageSkia::CreateFrom1xBitmap(*bitmap));
33 55
34 delete this; 56 delete this;
35 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698