OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/views/frame/browser_view.h" | 5 #include "chrome/browser/views/frame/browser_view.h" |
6 | 6 |
7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 GetWidget()->SetBounds(bounds); | 595 GetWidget()->SetBounds(bounds); |
596 } | 596 } |
597 | 597 |
598 void BrowserView::Close() { | 598 void BrowserView::Close() { |
599 frame_->GetWindow()->Close(); | 599 frame_->GetWindow()->Close(); |
600 | 600 |
601 BubbleSet::iterator bubble = browser_bubbles_.begin(); | 601 BubbleSet::iterator bubble = browser_bubbles_.begin(); |
602 for (; bubble != browser_bubbles_.end(); ++bubble) { | 602 for (; bubble != browser_bubbles_.end(); ++bubble) { |
603 (*bubble)->BrowserWindowClosed(); | 603 (*bubble)->BrowserWindowClosed(); |
604 } | 604 } |
605 | |
606 g_browser_process->local_state()->SetInteger( | |
607 prefs::kDevToolsSplitLocation, contents_split_->divider_offset()); | |
608 } | 605 } |
609 | 606 |
610 void BrowserView::Activate() { | 607 void BrowserView::Activate() { |
611 frame_->GetWindow()->Activate(); | 608 frame_->GetWindow()->Activate(); |
612 } | 609 } |
613 | 610 |
614 bool BrowserView::IsActive() const { | 611 bool BrowserView::IsActive() const { |
615 return frame_->GetWindow()->IsActive(); | 612 return frame_->GetWindow()->IsActive(); |
616 } | 613 } |
617 | 614 |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 AddChildView(toolbar_); | 1426 AddChildView(toolbar_); |
1430 toolbar_->SetID(VIEW_ID_TOOLBAR); | 1427 toolbar_->SetID(VIEW_ID_TOOLBAR); |
1431 toolbar_->Init(browser_->profile()); | 1428 toolbar_->Init(browser_->profile()); |
1432 toolbar_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TOOLBAR)); | 1429 toolbar_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TOOLBAR)); |
1433 | 1430 |
1434 infobar_container_ = new InfoBarContainer(this); | 1431 infobar_container_ = new InfoBarContainer(this); |
1435 AddChildView(infobar_container_); | 1432 AddChildView(infobar_container_); |
1436 | 1433 |
1437 contents_container_ = new TabContentsContainer; | 1434 contents_container_ = new TabContentsContainer; |
1438 devtools_container_ = new TabContentsContainer; | 1435 devtools_container_ = new TabContentsContainer; |
| 1436 devtools_container_->SetVisible(false); |
1439 contents_split_ = new views::SingleSplitView( | 1437 contents_split_ = new views::SingleSplitView( |
1440 contents_container_, | 1438 contents_container_, |
1441 devtools_container_, | 1439 devtools_container_, |
1442 views::SingleSplitView::VERTICAL_SPLIT); | 1440 views::SingleSplitView::VERTICAL_SPLIT); |
1443 AddChildView(contents_split_); | 1441 AddChildView(contents_split_); |
1444 set_contents_view(contents_split_); | 1442 set_contents_view(contents_split_); |
1445 | 1443 |
1446 status_bubble_.reset(new StatusBubbleViews(GetWidget())); | 1444 status_bubble_.reset(new StatusBubbleViews(GetWidget())); |
1447 | 1445 |
1448 extension_shelf_ = new ExtensionShelf(browser_.get()); | 1446 extension_shelf_ = new ExtensionShelf(browser_.get()); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 // TODO(beng): Remove this function once the interface between | 1598 // TODO(beng): Remove this function once the interface between |
1601 // InfoBarContainer, DownloadShelfView and TabContents and this | 1599 // InfoBarContainer, DownloadShelfView and TabContents and this |
1602 // view is sorted out. | 1600 // view is sorted out. |
1603 return true; | 1601 return true; |
1604 } | 1602 } |
1605 | 1603 |
1606 void BrowserView::UpdateDevToolsForContents(TabContents* tab_contents) { | 1604 void BrowserView::UpdateDevToolsForContents(TabContents* tab_contents) { |
1607 TabContents* devtools_contents = | 1605 TabContents* devtools_contents = |
1608 DevToolsWindow::GetDevToolsContents(tab_contents); | 1606 DevToolsWindow::GetDevToolsContents(tab_contents); |
1609 devtools_container_->ChangeTabContents(devtools_contents); | 1607 devtools_container_->ChangeTabContents(devtools_contents); |
| 1608 if (!devtools_contents && devtools_container_->IsVisible()) { |
| 1609 // Store split offset when hiding devtools window only. |
| 1610 g_browser_process->local_state()->SetInteger( |
| 1611 prefs::kDevToolsSplitLocation, contents_split_->divider_offset()); |
| 1612 } |
1610 devtools_container_->SetVisible(devtools_contents != NULL); | 1613 devtools_container_->SetVisible(devtools_contents != NULL); |
1611 contents_split_->Layout(); | 1614 contents_split_->Layout(); |
1612 } | 1615 } |
1613 | 1616 |
1614 void BrowserView::UpdateUIForContents(TabContents* contents) { | 1617 void BrowserView::UpdateUIForContents(TabContents* contents) { |
1615 bool needs_layout = MaybeShowBookmarkBar(contents); | 1618 bool needs_layout = MaybeShowBookmarkBar(contents); |
1616 needs_layout |= MaybeShowInfoBar(contents); | 1619 needs_layout |= MaybeShowInfoBar(contents); |
1617 if (needs_layout) | 1620 if (needs_layout) |
1618 Layout(); | 1621 Layout(); |
1619 } | 1622 } |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1849 | 1852 |
1850 // static | 1853 // static |
1851 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 1854 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
1852 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 1855 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
1853 } | 1856 } |
1854 | 1857 |
1855 // static | 1858 // static |
1856 void BrowserList::AllBrowsersClosed() { | 1859 void BrowserList::AllBrowsersClosed() { |
1857 views::Window::CloseAllSecondaryWindows(); | 1860 views::Window::CloseAllSecondaryWindows(); |
1858 } | 1861 } |
OLD | NEW |