| 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/browser.h" | 7 #include "chrome/browser/browser.h" |
| 8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
| 9 #include "chrome/browser/browsing_instance.h" | 9 #include "chrome/browser/browsing_instance.h" |
| 10 #include "chrome/browser/in_process_webkit/dom_storage_context.h" | 10 #include "chrome/browser/in_process_webkit/dom_storage_context.h" |
| 11 #include "chrome/browser/in_process_webkit/webkit_context.h" | 11 #include "chrome/browser/in_process_webkit/webkit_context.h" |
| 12 #include "chrome/browser/profile.h" | 12 #include "chrome/browser/profile.h" |
| 13 #include "chrome/browser/renderer_host/render_view_host.h" | 13 #include "chrome/browser/renderer_host/render_view_host.h" |
| 14 #include "chrome/browser/renderer_host/site_instance.h" | 14 #include "chrome/browser/renderer_host/site_instance.h" |
| 15 #include "chrome/browser/renderer_preferences_util.h" | 15 #include "chrome/browser/renderer_preferences_util.h" |
| 16 #include "chrome/common/notification_service.h" | 16 #include "chrome/common/notification_service.h" |
| 17 #include "chrome/common/view_types.h" | 17 #include "chrome/common/view_types.h" |
| 18 #include "chrome/common/render_messages.h" | 18 #include "chrome/common/render_messages.h" |
| 19 | 19 |
| 20 | 20 |
| 21 //////////////// | 21 //////////////// |
| 22 // BackgroundContents | 22 // BackgroundContents |
| 23 | 23 |
| 24 BackgroundContents::BackgroundContents(SiteInstance* site_instance, | 24 BackgroundContents::BackgroundContents(SiteInstance* site_instance, |
| 25 int routing_id) { | 25 int routing_id, |
| 26 const string16& frame_name) |
| 27 : frame_name_(frame_name) { |
| 26 Profile* profile = site_instance->browsing_instance()->profile(); | 28 Profile* profile = site_instance->browsing_instance()->profile(); |
| 27 | 29 |
| 28 // TODO(rafaelw): Implement correct session storage. | 30 // TODO(rafaelw): Implement correct session storage. |
| 29 int64 session_storage_namespace_id = profile->GetWebKitContext()-> | 31 int64 session_storage_namespace_id = profile->GetWebKitContext()-> |
| 30 dom_storage_context()->AllocateSessionStorageNamespaceId(); | 32 dom_storage_context()->AllocateSessionStorageNamespaceId(); |
| 31 render_view_host_ = new RenderViewHost(site_instance, this, routing_id, | 33 render_view_host_ = new RenderViewHost(site_instance, this, routing_id, |
| 32 session_storage_namespace_id); | 34 session_storage_namespace_id); |
| 33 render_view_host_->AllowScriptToClose(true); | 35 render_view_host_->AllowScriptToClose(true); |
| 34 | 36 |
| 35 #if defined(OS_WIN) || defined(OS_LINUX) | 37 #if defined(OS_WIN) || defined(OS_LINUX) |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 const GURL& source_url, | 151 const GURL& source_url, |
| 150 int request_id, | 152 int request_id, |
| 151 bool has_callback) { | 153 bool has_callback) { |
| 152 // TODO(rafaelw): It may make sense for extensions to be able to open | 154 // TODO(rafaelw): It may make sense for extensions to be able to open |
| 153 // BackgroundContents to chrome-extension://<id> pages. Consider implementing. | 155 // BackgroundContents to chrome-extension://<id> pages. Consider implementing. |
| 154 render_view_host_->BlockExtensionRequest(request_id); | 156 render_view_host_->BlockExtensionRequest(request_id); |
| 155 } | 157 } |
| 156 | 158 |
| 157 void BackgroundContents::CreateNewWindow( | 159 void BackgroundContents::CreateNewWindow( |
| 158 int route_id, | 160 int route_id, |
| 159 WindowContainerType window_container_type) { | 161 WindowContainerType window_container_type, |
| 162 const string16& frame_name) { |
| 160 delegate_view_helper_.CreateNewWindow(route_id, | 163 delegate_view_helper_.CreateNewWindow(route_id, |
| 161 render_view_host_->process()->profile(), | 164 render_view_host_->process()->profile(), |
| 162 render_view_host_->site_instance(), | 165 render_view_host_->site_instance(), |
| 163 DOMUIFactory::GetDOMUIType(url_), | 166 DOMUIFactory::GetDOMUIType(url_), |
| 164 this, | 167 this, |
| 165 window_container_type); | 168 window_container_type, |
| 169 frame_name); |
| 166 } | 170 } |
| 167 | 171 |
| 168 void BackgroundContents::CreateNewWidget(int route_id, | 172 void BackgroundContents::CreateNewWidget(int route_id, |
| 169 WebKit::WebPopupType popup_type) { | 173 WebKit::WebPopupType popup_type) { |
| 170 NOTREACHED(); | 174 NOTREACHED(); |
| 171 } | 175 } |
| 172 | 176 |
| 173 void BackgroundContents::ShowCreatedWindow(int route_id, | 177 void BackgroundContents::ShowCreatedWindow(int route_id, |
| 174 WindowOpenDisposition disposition, | 178 WindowOpenDisposition disposition, |
| 175 const gfx::Rect& initial_pos, | 179 const gfx::Rect& initial_pos, |
| 176 bool user_gesture) { | 180 bool user_gesture) { |
| 177 TabContents* contents = delegate_view_helper_.GetCreatedWindow(route_id); | 181 TabContents* contents = delegate_view_helper_.GetCreatedWindow(route_id); |
| 178 if (!contents) | 182 if (!contents) |
| 179 return; | 183 return; |
| 180 Browser* browser = BrowserList::GetLastActiveWithProfile( | 184 Browser* browser = BrowserList::GetLastActiveWithProfile( |
| 181 render_view_host_->process()->profile()); | 185 render_view_host_->process()->profile()); |
| 182 if (!browser) | 186 if (!browser) |
| 183 return; | 187 return; |
| 184 | 188 |
| 185 browser->AddTabContents(contents, disposition, initial_pos, user_gesture); | 189 browser->AddTabContents(contents, disposition, initial_pos, user_gesture); |
| 186 } | 190 } |
| 187 | 191 |
| 188 void BackgroundContents::ShowCreatedWidget(int route_id, | 192 void BackgroundContents::ShowCreatedWidget(int route_id, |
| 189 const gfx::Rect& initial_pos) { | 193 const gfx::Rect& initial_pos) { |
| 190 NOTIMPLEMENTED(); | 194 NOTIMPLEMENTED(); |
| 191 } | 195 } |
| 192 | 196 |
| OLD | NEW |