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

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

Issue 1265983007: Popular sites on the NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 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/supervised_user/supervised_user_service.h ('k') | chrome/chrome_browser.gypi » ('j') | 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"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/task_runner_util.h" 14 #include "base/task_runner_util.h"
15 #include "base/version.h" 15 #include "base/version.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h " 17 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h "
18 #include "chrome/browser/net/file_downloader.h"
18 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/profiles/profile_info_cache.h" 20 #include "chrome/browser/profiles/profile_info_cache.h"
20 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
21 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
22 #include "chrome/browser/signin/signin_manager_factory.h" 23 #include "chrome/browser/signin/signin_manager_factory.h"
23 #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist_ downloader.h"
24 #include "chrome/browser/supervised_user/experimental/supervised_user_filtering_ switches.h" 24 #include "chrome/browser/supervised_user/experimental/supervised_user_filtering_ switches.h"
25 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser vice.h" 25 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser vice.h"
26 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser vice_factory.h" 26 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser vice_factory.h"
27 #include "chrome/browser/supervised_user/legacy/permission_request_creator_sync. h" 27 #include "chrome/browser/supervised_user/legacy/permission_request_creator_sync. h"
28 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_ser vice.h" 28 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_ser vice.h"
29 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_ser vice_factory.h" 29 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_ser vice_factory.h"
30 #include "chrome/browser/supervised_user/legacy/supervised_user_registration_uti lity.h" 30 #include "chrome/browser/supervised_user/legacy/supervised_user_registration_uti lity.h"
31 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_ service_factory.h" 31 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_ service_factory.h"
32 #include "chrome/browser/supervised_user/supervised_user_constants.h" 32 #include "chrome/browser/supervised_user/supervised_user_constants.h"
33 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" 33 #include "chrome/browser/supervised_user/supervised_user_service_observer.h"
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 625
626 void SupervisedUserService::OnBlacklistFileChecked(const base::FilePath& path, 626 void SupervisedUserService::OnBlacklistFileChecked(const base::FilePath& path,
627 const GURL& url, 627 const GURL& url,
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 SupervisedUserBlacklistDownloader( 635 blacklist_downloader_.reset(new FileDownloader(
636 url, 636 url,
637 path, 637 path,
638 profile_->GetRequestContext(), 638 profile_->GetRequestContext(),
639 base::Bind(&SupervisedUserService::OnBlacklistDownloadDone, 639 base::Bind(&SupervisedUserService::OnBlacklistDownloadDone,
640 base::Unretained(this), path))); 640 base::Unretained(this), path)));
641 } 641 }
642 642
643 void SupervisedUserService::LoadBlacklistFromFile(const base::FilePath& path) { 643 void SupervisedUserService::LoadBlacklistFromFile(const base::FilePath& path) {
644 // This object is guaranteed to outlive the URLFilterContext, so we can bind a 644 // This object is guaranteed to outlive the URLFilterContext, so we can bind a
645 // raw pointer to it in the callback. 645 // raw pointer to it in the callback.
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 // The active user can be NULL in unit tests. 953 // The active user can be NULL in unit tests.
954 if (user_manager::UserManager::Get()->GetActiveUser()) { 954 if (user_manager::UserManager::Get()->GetActiveUser()) {
955 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( 955 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName(
956 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); 956 user_manager::UserManager::Get()->GetActiveUser()->GetUserID()));
957 } 957 }
958 return std::string(); 958 return std::string();
959 #else 959 #else
960 return profile_->GetPrefs()->GetString(prefs::kProfileName); 960 return profile_->GetPrefs()->GetString(prefs::kProfileName);
961 #endif 961 #endif
962 } 962 }
OLDNEW
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_service.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698