| 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_interstitial.h" | 5 #include "chrome/browser/managed_mode/managed_mode_interstitial.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" |
| 8 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/tab_contents/tab_util.h" | 11 #include "chrome/browser/tab_contents/tab_util.h" |
| 11 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 12 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 12 #include "chrome/common/jstemplate_builder.h" | 13 #include "chrome/common/jstemplate_builder.h" |
| 13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 15 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/interstitial_page.h" | 17 #include "content/public/browser/interstitial_page.h" |
| 17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 32 const base::Callback<void(bool)>& callback) { | 33 const base::Callback<void(bool)>& callback) { |
| 33 // The tab might have been closed. | 34 // The tab might have been closed. |
| 34 content::WebContents* web_contents = | 35 content::WebContents* web_contents = |
| 35 tab_util::GetWebContentsByID(render_process_host_id, render_view_id); | 36 tab_util::GetWebContentsByID(render_process_host_id, render_view_id); |
| 36 if (!web_contents) { | 37 if (!web_contents) { |
| 37 BrowserThread::PostTask( | 38 BrowserThread::PostTask( |
| 38 BrowserThread::IO, FROM_HERE, base::Bind(callback, true)); | 39 BrowserThread::IO, FROM_HERE, base::Bind(callback, true)); |
| 39 return; | 40 return; |
| 40 } | 41 } |
| 41 | 42 |
| 43 ManagedModeNavigationObserver* navigation_observer = |
| 44 ManagedModeNavigationObserver::FromWebContents(web_contents); |
| 45 navigation_observer->SetStateToRecordingAfterPreview(); |
| 46 |
| 42 new ManagedModeInterstitial(web_contents, url, callback); | 47 new ManagedModeInterstitial(web_contents, url, callback); |
| 43 } | 48 } |
| 44 | 49 |
| 45 } // namespace | 50 } // namespace |
| 46 | 51 |
| 47 // static | 52 // static |
| 48 void ManagedModeInterstitial::ShowInterstitial( | 53 void ManagedModeInterstitial::ShowInterstitial( |
| 49 int render_process_host_id, | 54 int render_process_host_id, |
| 50 int render_view_id, | 55 int render_view_id, |
| 51 const GURL& url, | 56 const GURL& url, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 140 |
| 136 void ManagedModeInterstitial::OnDontProceed() { | 141 void ManagedModeInterstitial::OnDontProceed() { |
| 137 DispatchContinueRequest(false); | 142 DispatchContinueRequest(false); |
| 138 } | 143 } |
| 139 | 144 |
| 140 void ManagedModeInterstitial::DispatchContinueRequest(bool continue_request) { | 145 void ManagedModeInterstitial::DispatchContinueRequest(bool continue_request) { |
| 141 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 146 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 142 base::Bind(callback_, continue_request)); | 147 base::Bind(callback_, continue_request)); |
| 143 } | 148 } |
| 144 | 149 |
| OLD | NEW |