diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 19:13:44 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 19:13:44 +0000 |
commit | ab861b4d129b7dfc67ab7b1dc8ccfbacff3dde17 (patch) | |
tree | b0b97b6a1427ff1b8c853c11dcfadf63f3b90bb4 /chrome/browser/external_tab_container.cc | |
parent | ac3fa8e2ef53e83b113d726209525f4af4aa46f1 (diff) | |
download | chromium_src-ab861b4d129b7dfc67ab7b1dc8ccfbacff3dde17.zip chromium_src-ab861b4d129b7dfc67ab7b1dc8ccfbacff3dde17.tar.gz chromium_src-ab861b4d129b7dfc67ab7b1dc8ccfbacff3dde17.tar.bz2 |
This CL adds support for displaying Chrome InfoBars in pages rendered via ChromeFrame. To achieve this
the ExternalTabContainer now creates a view which comprises of the InfoBarContainer and the TabContentsContainer
view. It uses the GridLayout manager to layout this view.
The InfoBarContainer no longer depends on the BrowserView. It now passes notifications to the InfoBarContainerDelegate
interface which is implemented by the BrowserView and the ExternalTabContainer.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=24051
Bug=24051
Review URL: http://codereview.chromium.org/573022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38228 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/external_tab_container.cc')
-rw-r--r-- | chrome/browser/external_tab_container.cc | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index 6e89fcd..993411c 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -30,6 +30,8 @@ #include "chrome/common/notification_service.h" #include "chrome/test/automation/automation_messages.h" #include "grit/generated_resources.h" +#include "views/grid_layout.h" +#include "views/widget/root_view.h" #include "views/window/window.h" static const wchar_t kWindowObjectKey[] = L"ChromeWindowObject"; @@ -105,14 +107,6 @@ bool ExternalTabContainer::Init(Profile* profile, BindingsPolicy::EXTERNAL_HOST); } - // Create a TabContentsContainer to handle focus cycling using Tab and - // Shift-Tab. - tab_contents_container_ = new TabContentsContainer; - SetContentsView(tab_contents_container_); - - // Note that SetTabContents must be called after AddChildView is called - tab_contents_container_->ChangeTabContents(tab_contents_); - NavigationController* controller = &tab_contents_->controller(); registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, Source<NavigationController>(controller)); @@ -156,6 +150,7 @@ bool ExternalTabContainer::Init(Profile* profile, disabled_context_menu_ids_.push_back( IDS_CONTENT_CONTEXT_OPENLINKOFFTHERECORD); LoadAccelerators(); + SetupExternalTabView(); return true; } @@ -201,6 +196,7 @@ void ExternalTabContainer::Uninitialize() { } request_context_ = NULL; + tab_contents_container_ = NULL; } bool ExternalTabContainer::Reinitialize( @@ -759,6 +755,12 @@ void ExternalTabContainer::SetEnableExtensionAutomation( } } +void ExternalTabContainer::InfoBarSizeChanged(bool is_animating) { + if (GetRootView()) { + GetRootView()->Layout(); + } +} + // ExternalTabContainer instances do not have a window. views::Window* ExternalTabContainer::GetWindow() { return NULL; @@ -887,3 +889,36 @@ void ExternalTabContainer::ServicePendingOpenURLRequests() { pending_open_url_requests_.clear(); } +void ExternalTabContainer::SetupExternalTabView() { + // Create a TabContentsContainer to handle focus cycling using Tab and + // Shift-Tab. + tab_contents_container_ = new TabContentsContainer; + + // The views created here will be destroyed when the ExternalTabContainer + // widget is torn down. + views::View* external_tab_view = new views::View(); + + InfoBarContainer* info_bar_container = new InfoBarContainer(this); + info_bar_container->ChangeTabContents(tab_contents_); + + views::GridLayout* layout = new views::GridLayout(external_tab_view); + views::ColumnSet* columns = layout->AddColumnSet(0); // Give this column an + // identifier of 0. + columns->AddColumn(views::GridLayout::FILL, + views::GridLayout::FILL, + 1, + views::GridLayout::USE_PREF, + 0, + 0); + + external_tab_view->SetLayoutManager(layout); + + layout->StartRow(0, 0); + layout->AddView(info_bar_container); + layout->StartRow(1, 0); + layout->AddView(tab_contents_container_); + SetContentsView(external_tab_view); + // Note that SetTabContents must be called after AddChildView is called + tab_contents_container_->ChangeTabContents(tab_contents_); +} + |