OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/managed_mode/managed_mode_navigation_observer.h" | 5 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 url_filter_ = managed_user_service_->GetURLFilterForUIThread(); | 173 url_filter_ = managed_user_service_->GetURLFilterForUIThread(); |
174 } | 174 } |
175 | 175 |
176 void ManagedModeNavigationObserver::WarnInfoBarDismissed() { | 176 void ManagedModeNavigationObserver::WarnInfoBarDismissed() { |
177 DCHECK(warn_infobar_); | 177 DCHECK(warn_infobar_); |
178 warn_infobar_ = NULL; | 178 warn_infobar_ = NULL; |
179 } | 179 } |
180 | 180 |
181 void ManagedModeNavigationObserver::ProvisionalChangeToMainFrameUrl( | 181 void ManagedModeNavigationObserver::ProvisionalChangeToMainFrameUrl( |
182 const GURL& url, | 182 const GURL& url, |
183 content::RenderViewHost* render_view_host) { | 183 content::RenderFrameHost* render_frame_host) { |
184 ManagedModeURLFilter::FilteringBehavior behavior = | 184 ManagedModeURLFilter::FilteringBehavior behavior = |
185 url_filter_->GetFilteringBehaviorForURL(url); | 185 url_filter_->GetFilteringBehaviorForURL(url); |
186 | 186 |
187 if (behavior == ManagedModeURLFilter::WARN || !warn_infobar_) | 187 if (behavior == ManagedModeURLFilter::WARN || !warn_infobar_) |
188 return; | 188 return; |
189 | 189 |
190 // If we shouldn't have a warn infobar remove it here. | 190 // If we shouldn't have a warn infobar remove it here. |
191 InfoBarService::FromWebContents(web_contents())->RemoveInfoBar(warn_infobar_); | 191 InfoBarService::FromWebContents(web_contents())->RemoveInfoBar(warn_infobar_); |
192 warn_infobar_ = NULL; | 192 warn_infobar_ = NULL; |
193 } | 193 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 history_service->AddPage(add_page_args); | 255 history_service->AddPage(add_page_args); |
256 | 256 |
257 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); | 257 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); |
258 entry->SetVirtualURL(url); | 258 entry->SetVirtualURL(url); |
259 entry->SetTimestamp(timestamp); | 259 entry->SetTimestamp(timestamp); |
260 blocked_navigations_.push_back(entry.release()); | 260 blocked_navigations_.push_back(entry.release()); |
261 ManagedUserService* managed_user_service = | 261 ManagedUserService* managed_user_service = |
262 ManagedUserServiceFactory::GetForProfile(profile); | 262 ManagedUserServiceFactory::GetForProfile(profile); |
263 managed_user_service->DidBlockNavigation(web_contents()); | 263 managed_user_service->DidBlockNavigation(web_contents()); |
264 } | 264 } |
OLD | NEW |