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

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

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

Powered by Google App Engine
This is Rietveld 408576698