| 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/extensions/extension_host.h" | 5 #include "chrome/browser/extensions/extension_host.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // If the process is already started, go ahead and initialize the RenderView | 195 // If the process is already started, go ahead and initialize the RenderView |
| 196 // synchronously. The process creation is the real meaty part that we want | 196 // synchronously. The process creation is the real meaty part that we want |
| 197 // to defer. | 197 // to defer. |
| 198 CreateRenderViewNow(); | 198 CreateRenderViewNow(); |
| 199 } else { | 199 } else { |
| 200 ProcessCreationQueue::get()->CreateSoon(this); | 200 ProcessCreationQueue::get()->CreateSoon(this); |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 void ExtensionHost::CreateRenderViewNow() { | 204 void ExtensionHost::CreateRenderViewNow() { |
| 205 render_view_host_->CreateRenderView(profile_->GetRequestContext()); | 205 render_view_host_->CreateRenderView(profile_->GetRequestContext(), |
| 206 string16()); |
| 206 NavigateToURL(url_); | 207 NavigateToURL(url_); |
| 207 DCHECK(IsRenderViewLive()); | 208 DCHECK(IsRenderViewLive()); |
| 208 } | 209 } |
| 209 | 210 |
| 210 void ExtensionHost::NavigateToURL(const GURL& url) { | 211 void ExtensionHost::NavigateToURL(const GURL& url) { |
| 211 LOG(INFO) << "Request to NavigateToURL " << url.spec() << " for " | 212 LOG(INFO) << "Request to NavigateToURL " << url.spec() << " for " |
| 212 << extension_->name(); | 213 << extension_->name(); |
| 213 // Prevent explicit navigation to another extension id's pages. | 214 // Prevent explicit navigation to another extension id's pages. |
| 214 // This method is only called by some APIs, so we still need to protect | 215 // This method is only called by some APIs, so we still need to protect |
| 215 // DidNavigate below (location = ""). | 216 // DidNavigate below (location = ""). |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 message, content, source_url, request_id, has_callback); | 549 message, content, source_url, request_id, has_callback); |
| 549 } | 550 } |
| 550 } | 551 } |
| 551 | 552 |
| 552 RenderViewHostDelegate::View* ExtensionHost::GetViewDelegate() { | 553 RenderViewHostDelegate::View* ExtensionHost::GetViewDelegate() { |
| 553 return this; | 554 return this; |
| 554 } | 555 } |
| 555 | 556 |
| 556 void ExtensionHost::CreateNewWindow( | 557 void ExtensionHost::CreateNewWindow( |
| 557 int route_id, | 558 int route_id, |
| 558 WindowContainerType window_container_type) { | 559 WindowContainerType window_container_type, |
| 560 const string16& frame_name) { |
| 559 delegate_view_helper_.CreateNewWindow( | 561 delegate_view_helper_.CreateNewWindow( |
| 560 route_id, | 562 route_id, |
| 561 render_view_host()->process()->profile(), | 563 render_view_host()->process()->profile(), |
| 562 site_instance(), | 564 site_instance(), |
| 563 DOMUIFactory::GetDOMUIType(url_), | 565 DOMUIFactory::GetDOMUIType(url_), |
| 564 this, | 566 this, |
| 565 window_container_type); | 567 window_container_type, |
| 568 frame_name); |
| 566 } | 569 } |
| 567 | 570 |
| 568 void ExtensionHost::CreateNewWidget(int route_id, | 571 void ExtensionHost::CreateNewWidget(int route_id, |
| 569 WebKit::WebPopupType popup_type) { | 572 WebKit::WebPopupType popup_type) { |
| 570 CreateNewWidgetInternal(route_id, popup_type); | 573 CreateNewWidgetInternal(route_id, popup_type); |
| 571 } | 574 } |
| 572 | 575 |
| 573 RenderWidgetHostView* ExtensionHost::CreateNewWidgetInternal( | 576 RenderWidgetHostView* ExtensionHost::CreateNewWidgetInternal( |
| 574 int route_id, WebKit::WebPopupType popup_type) { | 577 int route_id, WebKit::WebPopupType popup_type) { |
| 575 return delegate_view_helper_.CreateNewWidget(route_id, popup_type, | 578 return delegate_view_helper_.CreateNewWidget(route_id, popup_type, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 // Extensions hosted in ExternalTabContainer objects may not have | 732 // Extensions hosted in ExternalTabContainer objects may not have |
| 730 // an associated browser. | 733 // an associated browser. |
| 731 Browser* browser = GetBrowser(); | 734 Browser* browser = GetBrowser(); |
| 732 if (browser) | 735 if (browser) |
| 733 window_id = ExtensionTabUtil::GetWindowId(browser); | 736 window_id = ExtensionTabUtil::GetWindowId(browser); |
| 734 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { | 737 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { |
| 735 NOTREACHED(); | 738 NOTREACHED(); |
| 736 } | 739 } |
| 737 return window_id; | 740 return window_id; |
| 738 } | 741 } |
| OLD | NEW |