| Index: chrome/browser/ui/views/frame/browser_view.cc
|
| diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
|
| index 259e9f85f9a9390f179e0b68393c5426f6957373..b9abe87b13743b6e1c60a4971edf4e9172eea901 100644
|
| --- a/chrome/browser/ui/views/frame/browser_view.cc
|
| +++ b/chrome/browser/ui/views/frame/browser_view.cc
|
| @@ -105,9 +105,6 @@ using views::GridLayout;
|
|
|
| // The height of the status bubble.
|
| static const int kStatusBubbleHeight = 20;
|
| -// The name of a key to store on the window handle so that other code can
|
| -// locate this object using just the handle.
|
| -static const char* const kBrowserViewKey = "__BROWSER_VIEW__";
|
| // How frequently we check for hung plugin windows.
|
| static const int kDefaultHungPluginDetectFrequency = 2000;
|
| // How long do we wait before we consider a window hung (in ms).
|
| @@ -450,7 +447,6 @@ BrowserView::BrowserView(Browser* browser)
|
| #endif
|
| {
|
| browser_->tabstrip_model()->AddObserver(this);
|
| -
|
| registrar_.Add(this,
|
| NotificationType::SIDEBAR_CHANGED,
|
| Source<SidebarManager>(SidebarManager::GetInstance()));
|
| @@ -477,10 +473,11 @@ BrowserView::~BrowserView() {
|
|
|
| // The TabStrip attaches a listener to the model. Make sure we shut down the
|
| // TabStrip first so that it can cleanly remove the listener.
|
| - tabstrip_->parent()->RemoveChildView(tabstrip_);
|
| - delete tabstrip_;
|
| - tabstrip_ = NULL;
|
| -
|
| + if(tabstrip_) {
|
| + tabstrip_->parent()->RemoveChildView(tabstrip_);
|
| + delete tabstrip_;
|
| + tabstrip_ = NULL;
|
| + }
|
| // Child views maintain PrefMember attributes that point to
|
| // OffTheRecordProfile's PrefService which gets deleted by ~Browser.
|
| RemoveAllChildViews(true);
|
| @@ -1694,9 +1691,10 @@ views::ClientView* BrowserView::CreateClientView(views::Window* window) {
|
| bool BrowserView::CanClose() {
|
| // You cannot close a frame for which there is an active originating drag
|
| // session.
|
| - if (tabstrip_->IsDragSessionActive())
|
| - return false;
|
| -
|
| + if (tabstrip_) {
|
| + if (tabstrip_->IsDragSessionActive())
|
| + return false;
|
| + }
|
| // Give beforeunload handlers the chance to cancel the close before we hide
|
| // the window below.
|
| if (!browser_->ShouldCloseWindow())
|
| @@ -1855,11 +1853,20 @@ void BrowserView::InitTabStrip(TabStripModel* model) {
|
| tabstrip_controller->InitFromModel(tabstrip_);
|
| }
|
|
|
| +void BrowserView::InitToolbar(Browser* browser) {
|
| + toolbar_ = new ToolbarView(browser_.get());
|
| + AddChildView(toolbar_);
|
| + toolbar_->Init(browser_->profile());
|
| + toolbar_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLBAR));
|
| +}
|
| +
|
| ///////////////////////////////////////////////////////////////////////////////
|
| // BrowserView, private:
|
|
|
| void BrowserView::Init() {
|
| - SetLayoutManager(CreateLayoutManager());
|
| + if(!GetLayoutManager())
|
| + SetLayoutManager(CreateLayoutManager());
|
| +
|
| // Stow a pointer to this object onto the window handle so that we can get at
|
| // it later when all we have is a native view.
|
| GetWidget()->SetNativeWindowProperty(kBrowserViewKey, this);
|
| @@ -1881,10 +1888,7 @@ void BrowserView::Init() {
|
|
|
| InitTabStrip(browser_->tabstrip_model());
|
|
|
| - toolbar_ = new ToolbarView(browser_.get());
|
| - AddChildView(toolbar_);
|
| - toolbar_->Init(browser_->profile());
|
| - toolbar_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLBAR));
|
| + InitToolbar(browser_.get());
|
|
|
| infobar_container_ = new InfoBarContainer(this);
|
| AddChildView(infobar_container_);
|
|
|