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

Unified Diff: chrome/browser/managed_mode/managed_mode_interstitial.cc

Issue 12887005: Show interstitial from ManagedModeNavigationObserver instead of ManagedModeResourceThrottle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/managed_mode/managed_mode_interstitial.cc
diff --git a/chrome/browser/managed_mode/managed_mode_interstitial.cc b/chrome/browser/managed_mode/managed_mode_interstitial.cc
index 878d7c7e0aa58bce697a35e376f6448ce0e00026..ac1f537754587b7035f99ceb7ffd3d2630c6aec4 100644
--- a/chrome/browser/managed_mode/managed_mode_interstitial.cc
+++ b/chrome/browser/managed_mode/managed_mode_interstitial.cc
@@ -11,7 +11,6 @@
#include "chrome/browser/managed_mode/managed_user_service.h"
#include "chrome/browser/managed_mode/managed_user_service_factory.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
@@ -28,44 +27,6 @@
using content::BrowserThread;
-namespace {
-
-void ShowInterstitialOnUIThread(int render_process_host_id,
- int render_view_id,
- const GURL& url,
- const base::Callback<void(bool)>& callback) {
- // The tab might have been closed.
- content::WebContents* web_contents =
- tab_util::GetWebContentsByID(render_process_host_id, render_view_id);
- if (!web_contents) {
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE, base::Bind(callback, true));
- return;
- }
-
- ManagedModeNavigationObserver* navigation_observer =
- ManagedModeNavigationObserver::FromWebContents(web_contents);
- if (navigation_observer)
- navigation_observer->SetStateToRecordingAfterPreview();
-
- new ManagedModeInterstitial(web_contents, url, callback);
-}
-
-} // namespace
-
-// static
-void ManagedModeInterstitial::ShowInterstitial(
- int render_process_host_id,
- int render_view_id,
- const GURL& url,
- const base::Callback<void(bool)>& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&ShowInterstitialOnUIThread, render_process_host_id,
- render_view_id, url, callback));
-}
-
ManagedModeInterstitial::ManagedModeInterstitial(
content::WebContents* web_contents,
const GURL& url,
@@ -164,20 +125,14 @@ void ManagedModeInterstitial::CommandReceived(const std::string& command) {
}
void ManagedModeInterstitial::OnProceed() {
- DispatchContinueRequest(true);
+ callback_.Run(true);
}
void ManagedModeInterstitial::OnDontProceed() {
- DispatchContinueRequest(false);
+ callback_.Run(false);
}
void ManagedModeInterstitial::OnAuthorizationResult(bool success) {
if (success)
interstitial_page_->Proceed();
}
-
-void ManagedModeInterstitial::DispatchContinueRequest(bool continue_request) {
- BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- base::Bind(callback_, continue_request));
-}
-

Powered by Google App Engine
This is Rietveld 408576698