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

Side by Side Diff: chrome/browser/managed_mode/managed_mode_navigation_observer.cc

Issue 211273007: Split InfoBarService core code into InfoBarManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + comments Created 6 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 | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/history/history_service.h" 11 #include "chrome/browser/history/history_service.h"
12 #include "chrome/browser/history/history_service_factory.h" 12 #include "chrome/browser/history/history_service_factory.h"
13 #include "chrome/browser/history/history_types.h" 13 #include "chrome/browser/history/history_types.h"
14 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 14 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
15 #include "chrome/browser/infobars/infobar.h" 15 #include "chrome/browser/infobars/infobar.h"
16 #include "chrome/browser/infobars/infobar_manager.h"
16 #include "chrome/browser/infobars/infobar_service.h" 17 #include "chrome/browser/infobars/infobar_service.h"
17 #include "chrome/browser/managed_mode/managed_mode_interstitial.h" 18 #include "chrome/browser/managed_mode/managed_mode_interstitial.h"
18 #include "chrome/browser/managed_mode/managed_mode_resource_throttle.h" 19 #include "chrome/browser/managed_mode/managed_mode_resource_throttle.h"
19 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" 20 #include "chrome/browser/managed_mode/managed_mode_url_filter.h"
20 #include "chrome/browser/managed_mode/managed_user_service.h" 21 #include "chrome/browser/managed_mode/managed_user_service.h"
21 #include "chrome/browser/managed_mode/managed_user_service_factory.h" 22 #include "chrome/browser/managed_mode/managed_user_service_factory.h"
22 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/tab_contents/tab_util.h" 24 #include "chrome/browser/tab_contents/tab_util.h"
24 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/navigation_entry.h" 26 #include "content/public/browser/navigation_entry.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void ManagedModeNavigationObserver::ProvisionalChangeToMainFrameUrl( 182 void ManagedModeNavigationObserver::ProvisionalChangeToMainFrameUrl(
182 const GURL& url, 183 const GURL& url,
183 content::RenderFrameHost* render_frame_host) { 184 content::RenderFrameHost* render_frame_host) {
184 ManagedModeURLFilter::FilteringBehavior behavior = 185 ManagedModeURLFilter::FilteringBehavior behavior =
185 url_filter_->GetFilteringBehaviorForURL(url); 186 url_filter_->GetFilteringBehaviorForURL(url);
186 187
187 if (behavior == ManagedModeURLFilter::WARN || !warn_infobar_) 188 if (behavior == ManagedModeURLFilter::WARN || !warn_infobar_)
188 return; 189 return;
189 190
190 // If we shouldn't have a warn infobar remove it here. 191 // If we shouldn't have a warn infobar remove it here.
191 InfoBarService::FromWebContents(web_contents())->RemoveInfoBar(warn_infobar_); 192 InfoBarManager* infobar_manager =
193 InfoBarService::FromWebContents(web_contents())->infobar_manager();
194 infobar_manager->RemoveInfoBar(warn_infobar_);
192 warn_infobar_ = NULL; 195 warn_infobar_ = NULL;
193 } 196 }
194 197
195 void ManagedModeNavigationObserver::DidCommitProvisionalLoadForFrame( 198 void ManagedModeNavigationObserver::DidCommitProvisionalLoadForFrame(
196 int64 frame_id, 199 int64 frame_id,
197 const base::string16& frame_unique_name, 200 const base::string16& frame_unique_name,
198 bool is_main_frame, 201 bool is_main_frame,
199 const GURL& url, 202 const GURL& url,
200 content::PageTransition transition_type, 203 content::PageTransition transition_type,
201 content::RenderViewHost* render_view_host) { 204 content::RenderViewHost* render_view_host) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 history_service->AddPage(add_page_args); 258 history_service->AddPage(add_page_args);
256 259
257 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); 260 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create());
258 entry->SetVirtualURL(url); 261 entry->SetVirtualURL(url);
259 entry->SetTimestamp(timestamp); 262 entry->SetTimestamp(timestamp);
260 blocked_navigations_.push_back(entry.release()); 263 blocked_navigations_.push_back(entry.release());
261 ManagedUserService* managed_user_service = 264 ManagedUserService* managed_user_service =
262 ManagedUserServiceFactory::GetForProfile(profile); 265 ManagedUserServiceFactory::GetForProfile(profile);
263 managed_user_service->DidBlockNavigation(web_contents()); 266 managed_user_service->DidBlockNavigation(web_contents());
264 } 267 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698