| 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 this, | 520 this, |
| 521 window_container_type, | 521 window_container_type, |
| 522 frame_name); | 522 frame_name); |
| 523 } | 523 } |
| 524 | 524 |
| 525 void ExtensionHost::CreateNewWidget(int route_id, | 525 void ExtensionHost::CreateNewWidget(int route_id, |
| 526 WebKit::WebPopupType popup_type) { | 526 WebKit::WebPopupType popup_type) { |
| 527 CreateNewWidgetInternal(route_id, popup_type); | 527 CreateNewWidgetInternal(route_id, popup_type); |
| 528 } | 528 } |
| 529 | 529 |
| 530 void ExtensionHost::CreateNewFullscreenWidget(int route_id, |
| 531 WebKit::WebPopupType popup_type) { |
| 532 NOTREACHED() |
| 533 << "ExtensionHost does not support showing full screen popups yet."; |
| 534 } |
| 535 |
| 530 RenderWidgetHostView* ExtensionHost::CreateNewWidgetInternal( | 536 RenderWidgetHostView* ExtensionHost::CreateNewWidgetInternal( |
| 531 int route_id, WebKit::WebPopupType popup_type) { | 537 int route_id, WebKit::WebPopupType popup_type) { |
| 532 return delegate_view_helper_.CreateNewWidget(route_id, popup_type, | 538 return delegate_view_helper_.CreateNewWidget(route_id, popup_type, |
| 533 site_instance()->GetProcess()); | 539 site_instance()->GetProcess()); |
| 534 } | 540 } |
| 535 | 541 |
| 536 void ExtensionHost::ShowCreatedWindow(int route_id, | 542 void ExtensionHost::ShowCreatedWindow(int route_id, |
| 537 WindowOpenDisposition disposition, | 543 WindowOpenDisposition disposition, |
| 538 const gfx::Rect& initial_pos, | 544 const gfx::Rect& initial_pos, |
| 539 bool user_gesture) { | 545 bool user_gesture) { |
| 540 TabContents* contents = delegate_view_helper_.GetCreatedWindow(route_id); | 546 TabContents* contents = delegate_view_helper_.GetCreatedWindow(route_id); |
| 541 if (!contents) | 547 if (!contents) |
| 542 return; | 548 return; |
| 543 | 549 |
| 544 Browser* browser = extension_function_dispatcher_->GetCurrentBrowser( | 550 Browser* browser = extension_function_dispatcher_->GetCurrentBrowser( |
| 545 profile_->GetExtensionsService()->IsIncognitoEnabled(extension_)); | 551 profile_->GetExtensionsService()->IsIncognitoEnabled(extension_)); |
| 546 if (!browser) | 552 if (!browser) |
| 547 return; | 553 return; |
| 548 | 554 |
| 549 browser->AddTabContents(contents, disposition, initial_pos, user_gesture); | 555 browser->AddTabContents(contents, disposition, initial_pos, user_gesture); |
| 550 } | 556 } |
| 551 | 557 |
| 552 void ExtensionHost::ShowCreatedWidget(int route_id, | 558 void ExtensionHost::ShowCreatedWidget(int route_id, |
| 553 const gfx::Rect& initial_pos) { | 559 const gfx::Rect& initial_pos) { |
| 554 ShowCreatedWidgetInternal(delegate_view_helper_.GetCreatedWidget(route_id), | 560 ShowCreatedWidgetInternal(delegate_view_helper_.GetCreatedWidget(route_id), |
| 555 initial_pos); | 561 initial_pos); |
| 556 } | 562 } |
| 557 | 563 |
| 564 void ExtensionHost::ShowCreatedFullscreenWidget(int route_id) { |
| 565 NOTREACHED() |
| 566 << "ExtensionHost does not support showing full screen popups yet."; |
| 567 } |
| 568 |
| 558 void ExtensionHost::ShowCreatedWidgetInternal( | 569 void ExtensionHost::ShowCreatedWidgetInternal( |
| 559 RenderWidgetHostView* widget_host_view, | 570 RenderWidgetHostView* widget_host_view, |
| 560 const gfx::Rect& initial_pos) { | 571 const gfx::Rect& initial_pos) { |
| 561 Browser *browser = GetBrowser(); | 572 Browser *browser = GetBrowser(); |
| 562 DCHECK(browser); | 573 DCHECK(browser); |
| 563 if (!browser) | 574 if (!browser) |
| 564 return; | 575 return; |
| 565 browser->BrowserRenderWidgetShowing(); | 576 browser->BrowserRenderWidgetShowing(); |
| 566 // TODO(erikkay): These two lines could be refactored with TabContentsView. | 577 // TODO(erikkay): These two lines could be refactored with TabContentsView. |
| 567 widget_host_view->InitAsPopup(render_view_host()->view(), initial_pos); | 578 widget_host_view->InitAsPopup(render_view_host()->view(), initial_pos); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 // Extensions hosted in ExternalTabContainer objects may not have | 694 // Extensions hosted in ExternalTabContainer objects may not have |
| 684 // an associated browser. | 695 // an associated browser. |
| 685 Browser* browser = GetBrowser(); | 696 Browser* browser = GetBrowser(); |
| 686 if (browser) | 697 if (browser) |
| 687 window_id = ExtensionTabUtil::GetWindowId(browser); | 698 window_id = ExtensionTabUtil::GetWindowId(browser); |
| 688 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { | 699 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { |
| 689 NOTREACHED(); | 700 NOTREACHED(); |
| 690 } | 701 } |
| 691 return window_id; | 702 return window_id; |
| 692 } | 703 } |
| OLD | NEW |