| OLD | NEW |
| 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_interstitial.h" | 5 #include "chrome/browser/supervised_user/supervised_user_interstitial.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 << (success ? " successfully" : " unsuccessfully"); | 303 << (success ? " successfully" : " unsuccessfully"); |
| 304 std::string jsFunc = | 304 std::string jsFunc = |
| 305 base::StringPrintf("setRequestStatus(%s);", success ? "true" : "false"); | 305 base::StringPrintf("setRequestStatus(%s);", success ? "true" : "false"); |
| 306 interstitial_page_->GetMainFrame()->ExecuteJavaScript( | 306 interstitial_page_->GetMainFrame()->ExecuteJavaScript( |
| 307 base::ASCIIToUTF16(jsFunc)); | 307 base::ASCIIToUTF16(jsFunc)); |
| 308 } | 308 } |
| 309 | 309 |
| 310 bool SupervisedUserInterstitial::ShouldProceed() { | 310 bool SupervisedUserInterstitial::ShouldProceed() { |
| 311 SupervisedUserService* supervised_user_service = | 311 SupervisedUserService* supervised_user_service = |
| 312 SupervisedUserServiceFactory::GetForProfile(profile_); | 312 SupervisedUserServiceFactory::GetForProfile(profile_); |
| 313 SupervisedUserURLFilter* url_filter = | 313 const SupervisedUserURLFilter* url_filter = |
| 314 supervised_user_service->GetURLFilterForUIThread(); | 314 supervised_user_service->GetURLFilter(); |
| 315 SupervisedUserURLFilter::FilteringBehavior behavior; | 315 SupervisedUserURLFilter::FilteringBehavior behavior; |
| 316 if (url_filter->HasAsyncURLChecker()) { | 316 if (url_filter->HasAsyncURLChecker()) { |
| 317 if (!url_filter->GetManualFilteringBehaviorForURL(url_, &behavior)) | 317 if (!url_filter->GetManualFilteringBehaviorForURL(url_, &behavior)) |
| 318 return false; | 318 return false; |
| 319 } else { | 319 } else { |
| 320 behavior = url_filter->GetFilteringBehaviorForURL(url_); | 320 behavior = url_filter->GetFilteringBehaviorForURL(url_); |
| 321 } | 321 } |
| 322 return behavior != SupervisedUserURLFilter::BLOCK; | 322 return behavior != SupervisedUserURLFilter::BLOCK; |
| 323 } | 323 } |
| 324 | 324 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 347 SupervisedUserServiceFactory::GetForProfile(profile_); | 347 SupervisedUserServiceFactory::GetForProfile(profile_); |
| 348 supervised_user_service->RemoveObserver(this); | 348 supervised_user_service->RemoveObserver(this); |
| 349 | 349 |
| 350 if (!callback_.is_null()) | 350 if (!callback_.is_null()) |
| 351 callback_.Run(continue_request); | 351 callback_.Run(continue_request); |
| 352 | 352 |
| 353 // After this, the WebContents may be destroyed. Make sure we don't try to use | 353 // After this, the WebContents may be destroyed. Make sure we don't try to use |
| 354 // it again. | 354 // it again. |
| 355 web_contents_ = nullptr; | 355 web_contents_ = nullptr; |
| 356 } | 356 } |
| OLD | NEW |