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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_service.cc

Issue 1308723005: Popular sites on the NTP: re-download popular suggestions once per Chrome run (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@knn_ordering
Patch Set: rebase Created 5 years, 3 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/net/file_downloader.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/supervised_user/supervised_user_service.h" 5 #include "chrome/browser/supervised_user/supervised_user_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 bool file_exists) { 628 bool file_exists) {
629 if (file_exists) { 629 if (file_exists) {
630 LoadBlacklistFromFile(path); 630 LoadBlacklistFromFile(path);
631 return; 631 return;
632 } 632 }
633 633
634 DCHECK(!blacklist_downloader_); 634 DCHECK(!blacklist_downloader_);
635 blacklist_downloader_.reset(new FileDownloader( 635 blacklist_downloader_.reset(new FileDownloader(
636 url, 636 url,
637 path, 637 path,
638 false,
638 profile_->GetRequestContext(), 639 profile_->GetRequestContext(),
639 base::Bind(&SupervisedUserService::OnBlacklistDownloadDone, 640 base::Bind(&SupervisedUserService::OnBlacklistDownloadDone,
640 base::Unretained(this), path))); 641 base::Unretained(this), path)));
641 } 642 }
642 643
643 void SupervisedUserService::LoadBlacklistFromFile(const base::FilePath& path) { 644 void SupervisedUserService::LoadBlacklistFromFile(const base::FilePath& path) {
644 // This object is guaranteed to outlive the URLFilterContext, so we can bind a 645 // This object is guaranteed to outlive the URLFilterContext, so we can bind a
645 // raw pointer to it in the callback. 646 // raw pointer to it in the callback.
646 url_filter_context_.LoadBlacklist( 647 url_filter_context_.LoadBlacklist(
647 path, base::Bind(&SupervisedUserService::OnBlacklistLoaded, 648 path, base::Bind(&SupervisedUserService::OnBlacklistLoaded,
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 // The active user can be NULL in unit tests. 955 // The active user can be NULL in unit tests.
955 if (user_manager::UserManager::Get()->GetActiveUser()) { 956 if (user_manager::UserManager::Get()->GetActiveUser()) {
956 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( 957 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName(
957 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); 958 user_manager::UserManager::Get()->GetActiveUser()->GetUserID()));
958 } 959 }
959 return std::string(); 960 return std::string();
960 #else 961 #else
961 return profile_->GetPrefs()->GetString(prefs::kProfileName); 962 return profile_->GetPrefs()->GetString(prefs::kProfileName);
962 #endif 963 #endif
963 } 964 }
OLDNEW
« no previous file with comments | « chrome/browser/net/file_downloader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698