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/background_contents.h" | 5 #include "chrome/browser/tab_contents/background_contents.h" |
6 | 6 |
7 #include "chrome/browser/background_contents_service.h" | 7 #include "chrome/browser/background_contents_service.h" |
8 #include "chrome/browser/extensions/extension_message_service.h" | 8 #include "chrome/browser/extensions/extension_message_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/renderer_preferences_util.h" | 10 #include "chrome/browser/renderer_preferences_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // BackgroundContents | 24 // BackgroundContents |
25 | 25 |
26 BackgroundContents::BackgroundContents(SiteInstance* site_instance, | 26 BackgroundContents::BackgroundContents(SiteInstance* site_instance, |
27 int routing_id, | 27 int routing_id, |
28 Delegate* delegate) | 28 Delegate* delegate) |
29 : delegate_(delegate) { | 29 : delegate_(delegate) { |
30 Profile* profile = site_instance->browsing_instance()->profile(); | 30 Profile* profile = site_instance->browsing_instance()->profile(); |
31 | 31 |
32 // TODO(rafaelw): Implement correct session storage. | 32 // TODO(rafaelw): Implement correct session storage. |
33 render_view_host_ = new RenderViewHost(site_instance, this, routing_id, NULL); | 33 render_view_host_ = new RenderViewHost(site_instance, this, routing_id, NULL); |
34 render_view_host_->AllowScriptToClose(true); | |
35 | 34 |
36 // Close ourselves when the application is shutting down. | 35 // Close ourselves when the application is shutting down. |
37 registrar_.Add(this, NotificationType::APP_TERMINATING, | 36 registrar_.Add(this, NotificationType::APP_TERMINATING, |
38 NotificationService::AllSources()); | 37 NotificationService::AllSources()); |
39 | 38 |
40 // Register for our parent profile to shutdown, so we can shut ourselves down | 39 // Register for our parent profile to shutdown, so we can shut ourselves down |
41 // as well (should only be called for OTR profiles, as we should receive | 40 // as well (should only be called for OTR profiles, as we should receive |
42 // APP_TERMINATING before non-OTR profiles are destroyed). | 41 // APP_TERMINATING before non-OTR profiles are destroyed). |
43 registrar_.Add(this, NotificationType::PROFILE_DESTROYED, | 42 registrar_.Add(this, NotificationType::PROFILE_DESTROYED, |
44 Source<Profile>(profile)); | 43 Source<Profile>(profile)); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 BackgroundContents* | 262 BackgroundContents* |
264 BackgroundContents::GetBackgroundContentsByID(int render_process_id, | 263 BackgroundContents::GetBackgroundContentsByID(int render_process_id, |
265 int render_view_id) { | 264 int render_view_id) { |
266 RenderViewHost* render_view_host = | 265 RenderViewHost* render_view_host = |
267 RenderViewHost::FromID(render_process_id, render_view_id); | 266 RenderViewHost::FromID(render_process_id, render_view_id); |
268 if (!render_view_host) | 267 if (!render_view_host) |
269 return NULL; | 268 return NULL; |
270 | 269 |
271 return render_view_host->delegate()->GetAsBackgroundContents(); | 270 return render_view_host->delegate()->GetAsBackgroundContents(); |
272 } | 271 } |
OLD | NEW |