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

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

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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
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_navigation_observer.h" 5 #include "chrome/browser/supervised_user/supervised_user_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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 174 }
175 175
176 void SupervisedUserNavigationObserver::WarnInfoBarDismissed() { 176 void SupervisedUserNavigationObserver::WarnInfoBarDismissed() {
177 DCHECK(warn_infobar_); 177 DCHECK(warn_infobar_);
178 warn_infobar_ = NULL; 178 warn_infobar_ = NULL;
179 } 179 }
180 180
181 void SupervisedUserNavigationObserver::DidCommitProvisionalLoadForFrame( 181 void SupervisedUserNavigationObserver::DidCommitProvisionalLoadForFrame(
182 content::RenderFrameHost* render_frame_host, 182 content::RenderFrameHost* render_frame_host,
183 const GURL& url, 183 const GURL& url,
184 content::PageTransition transition_type) { 184 ui::PageTransition transition_type) {
185 if (render_frame_host->GetParent()) 185 if (render_frame_host->GetParent())
186 return; 186 return;
187 187
188 DVLOG(1) << "DidCommitProvisionalLoadForFrame " << url.spec(); 188 DVLOG(1) << "DidCommitProvisionalLoadForFrame " << url.spec();
189 SupervisedUserURLFilter::FilteringBehavior behavior = 189 SupervisedUserURLFilter::FilteringBehavior behavior =
190 url_filter_->GetFilteringBehaviorForURL(url); 190 url_filter_->GetFilteringBehaviorForURL(url);
191 191
192 if (behavior == SupervisedUserURLFilter::WARN && !warn_infobar_) { 192 if (behavior == SupervisedUserURLFilter::WARN && !warn_infobar_) {
193 warn_infobar_ = SupervisedUserWarningInfoBarDelegate::Create( 193 warn_infobar_ = SupervisedUserWarningInfoBarDelegate::Create(
194 InfoBarService::FromWebContents(web_contents())); 194 InfoBarService::FromWebContents(web_contents()));
(...skipping 27 matching lines...) Expand all
222 SupervisedUserInterstitial::Show(web_contents, url, callback); 222 SupervisedUserInterstitial::Show(web_contents, url, callback);
223 } 223 }
224 224
225 void SupervisedUserNavigationObserver::OnRequestBlockedInternal( 225 void SupervisedUserNavigationObserver::OnRequestBlockedInternal(
226 const GURL& url) { 226 const GURL& url) {
227 Time timestamp = Time::Now(); // TODO(bauerb): Use SaneTime when available. 227 Time timestamp = Time::Now(); // TODO(bauerb): Use SaneTime when available.
228 // Create a history entry for the attempt and mark it as such. 228 // Create a history entry for the attempt and mark it as such.
229 history::HistoryAddPageArgs add_page_args( 229 history::HistoryAddPageArgs add_page_args(
230 url, timestamp, web_contents(), 0, 230 url, timestamp, web_contents(), 0,
231 url, history::RedirectList(), 231 url, history::RedirectList(),
232 content::PAGE_TRANSITION_BLOCKED, history::SOURCE_BROWSED, 232 ui::PAGE_TRANSITION_BLOCKED, history::SOURCE_BROWSED,
233 false); 233 false);
234 234
235 // Add the entry to the history database. 235 // Add the entry to the history database.
236 Profile* profile = 236 Profile* profile =
237 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 237 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
238 HistoryService* history_service = 238 HistoryService* history_service =
239 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); 239 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS);
240 240
241 // |history_service| is null if saving history is disabled. 241 // |history_service| is null if saving history is disabled.
242 if (history_service) 242 if (history_service)
243 history_service->AddPage(add_page_args); 243 history_service->AddPage(add_page_args);
244 244
245 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); 245 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create());
246 entry->SetVirtualURL(url); 246 entry->SetVirtualURL(url);
247 entry->SetTimestamp(timestamp); 247 entry->SetTimestamp(timestamp);
248 blocked_navigations_.push_back(entry.release()); 248 blocked_navigations_.push_back(entry.release());
249 SupervisedUserService* supervised_user_service = 249 SupervisedUserService* supervised_user_service =
250 SupervisedUserServiceFactory::GetForProfile(profile); 250 SupervisedUserServiceFactory::GetForProfile(profile);
251 supervised_user_service->DidBlockNavigation(web_contents()); 251 supervised_user_service->DidBlockNavigation(web_contents());
252 } 252 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698