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