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

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

Issue 1813833002: Add report URL to safe search API functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 249
250 void SupervisedUserService::AddURLAccessRequest( 250 void SupervisedUserService::AddURLAccessRequest(
251 const GURL& url, 251 const GURL& url,
252 const SuccessCallback& callback) { 252 const SuccessCallback& callback) {
253 AddPermissionRequestInternal( 253 AddPermissionRequestInternal(
254 base::Bind(CreateURLAccessRequest, 254 base::Bind(CreateURLAccessRequest,
255 SupervisedUserURLFilter::Normalize(url)), 255 SupervisedUserURLFilter::Normalize(url)),
256 callback, 0); 256 callback, 0);
257 } 257 }
258 258
259 void SupervisedUserService::ReportURL(const GURL& url,
260 const SuccessCallback& callback) {
261 if (url_reporter_)
262 url_reporter_->ReportUrl(url, callback);
263 else
264 callback.Run(false);
265 }
266
259 void SupervisedUserService::AddExtensionUpdateRequest( 267 void SupervisedUserService::AddExtensionUpdateRequest(
260 const std::string& extension_id, 268 const std::string& extension_id,
261 const base::Version& version, 269 const base::Version& version,
262 const SuccessCallback& callback) { 270 const SuccessCallback& callback) {
263 std::string id = GetExtensionUpdateRequestId(extension_id, version); 271 std::string id = GetExtensionUpdateRequestId(extension_id, version);
264 AddPermissionRequestInternal( 272 AddPermissionRequestInternal(
265 base::Bind(CreateExtensionUpdateRequest, id), callback, 0); 273 base::Bind(CreateExtensionUpdateRequest, id), callback, 0);
266 } 274 }
267 275
268 void SupervisedUserService::AddExtensionUpdateRequest( 276 void SupervisedUserService::AddExtensionUpdateRequest(
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 void SupervisedUserService::RemoveObserver( 397 void SupervisedUserService::RemoveObserver(
390 SupervisedUserServiceObserver* observer) { 398 SupervisedUserServiceObserver* observer) {
391 observer_list_.RemoveObserver(observer); 399 observer_list_.RemoveObserver(observer);
392 } 400 }
393 401
394 void SupervisedUserService::AddPermissionRequestCreator( 402 void SupervisedUserService::AddPermissionRequestCreator(
395 scoped_ptr<PermissionRequestCreator> creator) { 403 scoped_ptr<PermissionRequestCreator> creator) {
396 permissions_creators_.push_back(creator.release()); 404 permissions_creators_.push_back(creator.release());
397 } 405 }
398 406
407 void SupervisedUserService::SetSafeSearchURLReporter(
408 scoped_ptr<SafeSearchURLReporter> reporter) {
409 url_reporter_ = std::move(reporter);
410 }
411
399 SupervisedUserService::URLFilterContext::URLFilterContext() 412 SupervisedUserService::URLFilterContext::URLFilterContext()
400 : ui_url_filter_(new SupervisedUserURLFilter), 413 : ui_url_filter_(new SupervisedUserURLFilter),
401 io_url_filter_(new SupervisedUserURLFilter) {} 414 io_url_filter_(new SupervisedUserURLFilter) {}
402 SupervisedUserService::URLFilterContext::~URLFilterContext() {} 415 SupervisedUserService::URLFilterContext::~URLFilterContext() {}
403 416
404 SupervisedUserURLFilter* 417 SupervisedUserURLFilter*
405 SupervisedUserService::URLFilterContext::ui_url_filter() const { 418 SupervisedUserService::URLFilterContext::ui_url_filter() const {
406 return ui_url_filter_.get(); 419 return ui_url_filter_.get();
407 } 420 }
408 421
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 UpdateManualHosts(); 607 UpdateManualHosts();
595 UpdateManualURLs(); 608 UpdateManualURLs();
596 609
597 #if !defined(OS_ANDROID) 610 #if !defined(OS_ANDROID)
598 // TODO(bauerb): Get rid of the platform-specific #ifdef here. 611 // TODO(bauerb): Get rid of the platform-specific #ifdef here.
599 // http://crbug.com/313377 612 // http://crbug.com/313377
600 BrowserList::AddObserver(this); 613 BrowserList::AddObserver(this);
601 #endif 614 #endif
602 } else { 615 } else {
603 permissions_creators_.clear(); 616 permissions_creators_.clear();
617 url_reporter_.reset();
604 618
605 pref_change_registrar_.Remove( 619 pref_change_registrar_.Remove(
606 prefs::kDefaultSupervisedUserFilteringBehavior); 620 prefs::kDefaultSupervisedUserFilteringBehavior);
607 pref_change_registrar_.Remove(prefs::kSupervisedUserManualHosts); 621 pref_change_registrar_.Remove(prefs::kSupervisedUserManualHosts);
608 pref_change_registrar_.Remove(prefs::kSupervisedUserManualURLs); 622 pref_change_registrar_.Remove(prefs::kSupervisedUserManualURLs);
609 for (const char* pref : kCustodianInfoPrefs) { 623 for (const char* pref : kCustodianInfoPrefs) {
610 pref_change_registrar_.Remove(pref); 624 pref_change_registrar_.Remove(pref);
611 } 625 }
612 626
613 url_filter_context_.Clear(); 627 url_filter_context_.Clear();
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); 1059 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile"));
1046 1060
1047 is_profile_active_ = profile_became_active; 1061 is_profile_active_ = profile_became_active;
1048 } 1062 }
1049 #endif // !defined(OS_ANDROID) 1063 #endif // !defined(OS_ANDROID)
1050 1064
1051 void SupervisedUserService::OnSiteListUpdated() { 1065 void SupervisedUserService::OnSiteListUpdated() {
1052 FOR_EACH_OBSERVER( 1066 FOR_EACH_OBSERVER(
1053 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged()); 1067 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged());
1054 } 1068 }
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