| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // request without showing the interstitial. | 150 // request without showing the interstitial. |
| 151 DispatchContinueRequest(true); | 151 DispatchContinueRequest(true); |
| 152 return false; | 152 return false; |
| 153 } | 153 } |
| 154 | 154 |
| 155 InfoBarService* service = InfoBarService::FromWebContents(web_contents_); | 155 InfoBarService* service = InfoBarService::FromWebContents(web_contents_); |
| 156 if (service) { | 156 if (service) { |
| 157 // Remove all the infobars which are attached to |web_contents_| and for | 157 // Remove all the infobars which are attached to |web_contents_| and for |
| 158 // which ShouldExpire() returns true. | 158 // which ShouldExpire() returns true. |
| 159 content::LoadCommittedDetails details; | 159 content::LoadCommittedDetails details; |
| 160 // |details.is_in_page| is default false, and |details.is_main_frame| is | 160 // |details.is_same_page| is default false, and |details.is_main_frame| is |
| 161 // default true. This results in is_navigation_to_different_page() returning | 161 // default true. This results in is_navigation_to_different_page() returning |
| 162 // true. | 162 // true. |
| 163 DCHECK(details.is_navigation_to_different_page()); | 163 DCHECK(details.is_navigation_to_different_page()); |
| 164 const content::NavigationController& controller = | 164 const content::NavigationController& controller = |
| 165 web_contents_->GetController(); | 165 web_contents_->GetController(); |
| 166 details.entry = controller.GetActiveEntry(); | 166 details.entry = controller.GetActiveEntry(); |
| 167 if (controller.GetLastCommittedEntry()) { | 167 if (controller.GetLastCommittedEntry()) { |
| 168 details.previous_entry_index = controller.GetLastCommittedEntryIndex(); | 168 details.previous_entry_index = controller.GetLastCommittedEntryIndex(); |
| 169 details.previous_url = controller.GetLastCommittedEntry()->GetURL(); | 169 details.previous_url = controller.GetLastCommittedEntry()->GetURL(); |
| 170 } | 170 } |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |