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

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

Issue 690423003: Supervised user SafeSites: Expose & use API key from src-internal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update test Created 6 years, 1 month 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 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/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 BrowserThread::PostTask( 165 BrowserThread::PostTask(
166 BrowserThread::IO, 166 BrowserThread::IO,
167 FROM_HERE, 167 FROM_HERE,
168 base::Bind(&SupervisedUserURLFilter::SetBlacklist, 168 base::Bind(&SupervisedUserURLFilter::SetBlacklist,
169 io_url_filter_, 169 io_url_filter_,
170 &blacklist_)); 170 &blacklist_));
171 } 171 }
172 172
173 void SupervisedUserService::URLFilterContext::InitAsyncURLChecker( 173 void SupervisedUserService::URLFilterContext::InitAsyncURLChecker(
174 net::URLRequestContextGetter* context, 174 net::URLRequestContextGetter* context,
175 const std::string& cx, 175 const std::string& cx) {
176 const std::string& api_key) { 176 ui_url_filter_->InitAsyncURLChecker(context, cx);
177 ui_url_filter_->InitAsyncURLChecker(context, cx, api_key);
178 BrowserThread::PostTask( 177 BrowserThread::PostTask(
179 BrowserThread::IO, 178 BrowserThread::IO,
180 FROM_HERE, 179 FROM_HERE,
181 base::Bind(&SupervisedUserURLFilter::InitAsyncURLChecker, 180 base::Bind(&SupervisedUserURLFilter::InitAsyncURLChecker,
182 io_url_filter_, context, cx, api_key)); 181 io_url_filter_, context, cx));
183 } 182 }
184 183
185 SupervisedUserService::SupervisedUserService(Profile* profile) 184 SupervisedUserService::SupervisedUserService(Profile* profile)
186 : includes_sync_sessions_type_(true), 185 : includes_sync_sessions_type_(true),
187 profile_(profile), 186 profile_(profile),
188 active_(false), 187 active_(false),
189 delegate_(NULL), 188 delegate_(NULL),
190 #if defined(ENABLE_EXTENSIONS) 189 #if defined(ENABLE_EXTENSIONS)
191 extension_registry_observer_(this), 190 extension_registry_observer_(this),
192 #endif 191 #endif
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 if (!blacklist_path.empty()) 863 if (!blacklist_path.empty())
865 LoadBlacklist(blacklist_path, delegate_->GetBlacklistURL()); 864 LoadBlacklist(blacklist_path, delegate_->GetBlacklistURL());
866 } 865 }
867 bool use_safesites = 866 bool use_safesites =
868 CommandLine::ForCurrentProcess()->HasSwitch( 867 CommandLine::ForCurrentProcess()->HasSwitch(
869 switches::kEnableSupervisedUserSafeSites); 868 switches::kEnableSupervisedUserSafeSites);
870 if (delegate_ && use_safesites) { 869 if (delegate_ && use_safesites) {
871 const std::string& cx = delegate_->GetSafeSitesCx(); 870 const std::string& cx = delegate_->GetSafeSitesCx();
872 if (!cx.empty()) { 871 if (!cx.empty()) {
873 url_filter_context_.InitAsyncURLChecker( 872 url_filter_context_.InitAsyncURLChecker(
874 profile_->GetRequestContext(), cx, delegate_->GetSafeSitesApiKey()); 873 profile_->GetRequestContext(), cx);
875 } 874 }
876 } 875 }
877 876
878 #if !defined(OS_ANDROID) 877 #if !defined(OS_ANDROID)
879 // TODO(bauerb): Get rid of the platform-specific #ifdef here. 878 // TODO(bauerb): Get rid of the platform-specific #ifdef here.
880 // http://crbug.com/313377 879 // http://crbug.com/313377
881 BrowserList::AddObserver(this); 880 BrowserList::AddObserver(this);
882 #endif 881 #endif
883 } else { 882 } else {
884 permissions_creators_.clear(); 883 permissions_creators_.clear();
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 // The active user can be NULL in unit tests. 1006 // The active user can be NULL in unit tests.
1008 if (user_manager::UserManager::Get()->GetActiveUser()) { 1007 if (user_manager::UserManager::Get()->GetActiveUser()) {
1009 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( 1008 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName(
1010 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); 1009 user_manager::UserManager::Get()->GetActiveUser()->GetUserID()));
1011 } 1010 }
1012 return std::string(); 1011 return std::string();
1013 #else 1012 #else
1014 return profile_->GetPrefs()->GetString(prefs::kProfileName); 1013 return profile_->GetPrefs()->GetString(prefs::kProfileName);
1015 #endif 1014 #endif
1016 } 1015 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698