| 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/tab_contents/background_contents.h" | 5 #include "chrome/browser/tab_contents/background_contents.h" |
| 6 | 6 |
| 7 #include "chrome/browser/background/background_contents_service.h" | 7 #include "chrome/browser/background/background_contents_service.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 9 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/renderer_preferences_util.h" | 11 #include "chrome/browser/renderer_preferences_util.h" |
| 12 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 12 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
| 13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 14 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
| 15 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
| 16 #include "content/public/browser/session_storage_namespace.h" | 16 #include "content/public/browser/session_storage_namespace.h" |
| 17 #include "content/public/browser/site_instance.h" | 17 #include "content/public/browser/site_instance.h" |
| 18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 19 #include "extensions/browser/view_type_utils.h" | 19 #include "extensions/browser/view_type_utils.h" |
| 20 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
| 21 | 21 |
| 22 using content::SiteInstance; | 22 using content::SiteInstance; |
| 23 using content::WebContents; | 23 using content::WebContents; |
| 24 | 24 |
| 25 BackgroundContents::BackgroundContents( | 25 BackgroundContents::BackgroundContents( |
| 26 SiteInstance* site_instance, | 26 SiteInstance* site_instance, |
| 27 int routing_id, | 27 int routing_id, |
| 28 int main_frame_routing_id, |
| 28 Delegate* delegate, | 29 Delegate* delegate, |
| 29 const std::string& partition_id, | 30 const std::string& partition_id, |
| 30 content::SessionStorageNamespace* session_storage_namespace) | 31 content::SessionStorageNamespace* session_storage_namespace) |
| 31 : delegate_(delegate) { | 32 : delegate_(delegate) { |
| 32 profile_ = Profile::FromBrowserContext( | 33 profile_ = Profile::FromBrowserContext( |
| 33 site_instance->GetBrowserContext()); | 34 site_instance->GetBrowserContext()); |
| 34 | 35 |
| 35 WebContents::CreateParams create_params(profile_, site_instance); | 36 WebContents::CreateParams create_params(profile_, site_instance); |
| 36 create_params.routing_id = routing_id; | 37 create_params.routing_id = routing_id; |
| 38 create_params.main_frame_routing_id = main_frame_routing_id; |
| 37 if (session_storage_namespace) { | 39 if (session_storage_namespace) { |
| 38 content::SessionStorageNamespaceMap session_storage_namespace_map; | 40 content::SessionStorageNamespaceMap session_storage_namespace_map; |
| 39 session_storage_namespace_map.insert( | 41 session_storage_namespace_map.insert( |
| 40 std::make_pair(partition_id, session_storage_namespace)); | 42 std::make_pair(partition_id, session_storage_namespace)); |
| 41 web_contents_.reset(WebContents::CreateWithSessionStorage( | 43 web_contents_.reset(WebContents::CreateWithSessionStorage( |
| 42 create_params, session_storage_namespace_map)); | 44 create_params, session_storage_namespace_map)); |
| 43 } else { | 45 } else { |
| 44 web_contents_.reset(WebContents::Create(create_params)); | 46 web_contents_.reset(WebContents::Create(create_params)); |
| 45 } | 47 } |
| 46 extensions::SetViewType( | 48 extensions::SetViewType( |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 case chrome::NOTIFICATION_PROFILE_DESTROYED: | 153 case chrome::NOTIFICATION_PROFILE_DESTROYED: |
| 152 case chrome::NOTIFICATION_APP_TERMINATING: { | 154 case chrome::NOTIFICATION_APP_TERMINATING: { |
| 153 delete this; | 155 delete this; |
| 154 break; | 156 break; |
| 155 } | 157 } |
| 156 default: | 158 default: |
| 157 NOTREACHED() << "Unexpected notification sent."; | 159 NOTREACHED() << "Unexpected notification sent."; |
| 158 break; | 160 break; |
| 159 } | 161 } |
| 160 } | 162 } |
| OLD | NEW |