| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/chrome_interstitial_page.h" | 5 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" |
| 6 | 6 |
| 7 #include "chrome/browser/dom_operation_notification_details.h" | 7 #include "chrome/browser/dom_operation_notification_details.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/renderer_preferences_util.h" | 9 #include "chrome/browser/renderer_preferences_util.h" |
| 10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
| 11 #include "chrome/common/render_messages.h" |
| 12 #include "content/browser/renderer_host/render_view_host.h" |
| 11 #include "content/browser/tab_contents/tab_contents.h" | 13 #include "content/browser/tab_contents/tab_contents.h" |
| 12 #include "content/public/browser/notification_details.h" | 14 #include "content/public/browser/notification_details.h" |
| 13 #include "content/public/browser/notification_source.h" | 15 #include "content/public/browser/notification_source.h" |
| 14 | 16 |
| 15 ChromeInterstitialPage::ChromeInterstitialPage(TabContents* tab, | 17 ChromeInterstitialPage::ChromeInterstitialPage(TabContents* tab, |
| 16 bool new_navigation, | 18 bool new_navigation, |
| 17 const GURL& url) | 19 const GURL& url) |
| 18 : InterstitialPage(tab, new_navigation, url) { | 20 : InterstitialPage(tab, new_navigation, url) { |
| 19 Profile* profile = Profile::FromBrowserContext(tab->browser_context()); | 21 Profile* profile = Profile::FromBrowserContext(tab->browser_context()); |
| 20 content::RendererPreferences prefs; | 22 content::RendererPreferences prefs; |
| 21 renderer_preferences_util::UpdateFromSystemSettings(&prefs, profile); | 23 renderer_preferences_util::UpdateFromSystemSettings(&prefs, profile); |
| 22 set_renderer_preferences(prefs); | 24 set_renderer_preferences(prefs); |
| 23 } | 25 } |
| 24 | 26 |
| 25 ChromeInterstitialPage::~ChromeInterstitialPage() { | 27 ChromeInterstitialPage::~ChromeInterstitialPage() { |
| 26 } | 28 } |
| 27 | 29 |
| 28 void ChromeInterstitialPage::Show() { | 30 void ChromeInterstitialPage::Show() { |
| 29 InterstitialPage::Show(); | 31 InterstitialPage::Show(); |
| 30 | 32 |
| 31 notification_registrar_.Add( | 33 notification_registrar_.Add( |
| 32 this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, | 34 this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, |
| 33 content::Source<RenderViewHost>(render_view_host())); | 35 content::Source<RenderViewHost>(render_view_host())); |
| 36 render_view_host()->Send( |
| 37 new ChromeViewMsg_SetAsInterstitial(render_view_host()->routing_id())); |
| 34 } | 38 } |
| 35 | 39 |
| 36 void ChromeInterstitialPage::Observe( | 40 void ChromeInterstitialPage::Observe( |
| 37 int type, | 41 int type, |
| 38 const content::NotificationSource& source, | 42 const content::NotificationSource& source, |
| 39 const content::NotificationDetails& details) { | 43 const content::NotificationDetails& details) { |
| 40 if (chrome::NOTIFICATION_DOM_OPERATION_RESPONSE == type) { | 44 if (chrome::NOTIFICATION_DOM_OPERATION_RESPONSE == type) { |
| 41 if (enabled()) { | 45 if (enabled()) { |
| 42 content::Details<DomOperationNotificationDetails> dom_op_details(details); | 46 content::Details<DomOperationNotificationDetails> dom_op_details(details); |
| 43 CommandReceived(dom_op_details->json()); | 47 CommandReceived(dom_op_details->json()); |
| 44 } | 48 } |
| 45 return; | 49 return; |
| 46 } | 50 } |
| 47 InterstitialPage::Observe(type, source, details); | 51 InterstitialPage::Observe(type, source, details); |
| 48 } | 52 } |
| OLD | NEW |