OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browsing_instance.h" | 8 #include "chrome/browser/browsing_instance.h" |
9 #include "chrome/browser/in_process_webkit/dom_storage_context.h" | |
10 #include "chrome/browser/in_process_webkit/webkit_context.h" | |
11 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
12 #include "chrome/browser/renderer_host/render_view_host.h" | 10 #include "chrome/browser/renderer_host/render_view_host.h" |
13 #include "chrome/browser/renderer_host/site_instance.h" | 11 #include "chrome/browser/renderer_host/site_instance.h" |
14 #include "chrome/browser/renderer_preferences_util.h" | 12 #include "chrome/browser/renderer_preferences_util.h" |
15 #include "chrome/common/notification_service.h" | 13 #include "chrome/common/notification_service.h" |
16 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
17 #include "chrome/common/view_types.h" | 15 #include "chrome/common/view_types.h" |
18 #include "chrome/common/render_messages_params.h" | 16 #include "chrome/common/render_messages_params.h" |
19 #include "gfx/rect.h" | 17 #include "gfx/rect.h" |
20 | 18 |
21 //////////////// | 19 //////////////// |
22 // BackgroundContents | 20 // BackgroundContents |
23 | 21 |
24 BackgroundContents::BackgroundContents(SiteInstance* site_instance, | 22 BackgroundContents::BackgroundContents(SiteInstance* site_instance, |
25 int routing_id, | 23 int routing_id, |
26 Delegate* delegate) | 24 Delegate* delegate) |
27 : delegate_(delegate) { | 25 : delegate_(delegate) { |
28 Profile* profile = site_instance->browsing_instance()->profile(); | 26 Profile* profile = site_instance->browsing_instance()->profile(); |
29 | 27 |
30 // TODO(rafaelw): Implement correct session storage. | 28 // TODO(rafaelw): Implement correct session storage. |
31 int64 session_storage_namespace_id = profile->GetWebKitContext()-> | 29 render_view_host_ = new RenderViewHost(site_instance, this, routing_id, NULL); |
32 dom_storage_context()->AllocateSessionStorageNamespaceId(); | |
33 render_view_host_ = new RenderViewHost(site_instance, this, routing_id, | |
34 session_storage_namespace_id); | |
35 render_view_host_->AllowScriptToClose(true); | 30 render_view_host_->AllowScriptToClose(true); |
36 | 31 |
37 // Close ourselves when the application is shutting down. | 32 // Close ourselves when the application is shutting down. |
38 registrar_.Add(this, NotificationType::APP_TERMINATING, | 33 registrar_.Add(this, NotificationType::APP_TERMINATING, |
39 NotificationService::AllSources()); | 34 NotificationService::AllSources()); |
40 | 35 |
41 // Register for our parent profile to shutdown, so we can shut ourselves down | 36 // Register for our parent profile to shutdown, so we can shut ourselves down |
42 // as well (should only be called for OTR profiles, as we should receive | 37 // as well (should only be called for OTR profiles, as we should receive |
43 // APP_TERMINATING before non-OTR profiles are destroyed). | 38 // APP_TERMINATING before non-OTR profiles are destroyed). |
44 registrar_.Add(this, NotificationType::PROFILE_DESTROYED, | 39 registrar_.Add(this, NotificationType::PROFILE_DESTROYED, |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } | 185 } |
191 | 186 |
192 void BackgroundContents::ShowCreatedWidget(int route_id, | 187 void BackgroundContents::ShowCreatedWidget(int route_id, |
193 const gfx::Rect& initial_pos) { | 188 const gfx::Rect& initial_pos) { |
194 NOTIMPLEMENTED(); | 189 NOTIMPLEMENTED(); |
195 } | 190 } |
196 | 191 |
197 void BackgroundContents::ShowCreatedFullscreenWidget(int route_id) { | 192 void BackgroundContents::ShowCreatedFullscreenWidget(int route_id) { |
198 NOTIMPLEMENTED(); | 193 NOTIMPLEMENTED(); |
199 } | 194 } |
OLD | NEW |