| 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/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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 #include "views/focus/view_storage.h" | 74 #include "views/focus/view_storage.h" |
| 75 #include "views/grid_layout.h" | 75 #include "views/grid_layout.h" |
| 76 #include "views/view.h" | 76 #include "views/view.h" |
| 77 #include "views/widget/root_view.h" | 77 #include "views/widget/root_view.h" |
| 78 #include "views/window/dialog_delegate.h" | 78 #include "views/window/dialog_delegate.h" |
| 79 #include "views/window/non_client_view.h" | 79 #include "views/window/non_client_view.h" |
| 80 #include "views/window/window.h" | 80 #include "views/window/window.h" |
| 81 | 81 |
| 82 #if defined(OS_WIN) | 82 #if defined(OS_WIN) |
| 83 #include "app/win_util.h" | 83 #include "app/win_util.h" |
| 84 #include "chrome/browser/aeropeek_manager.h" |
| 84 #include "chrome/browser/jumplist.h" | 85 #include "chrome/browser/jumplist.h" |
| 85 #elif defined(OS_LINUX) | 86 #elif defined(OS_LINUX) |
| 86 #include "chrome/browser/views/accelerator_table_gtk.h" | 87 #include "chrome/browser/views/accelerator_table_gtk.h" |
| 87 #include "views/window/hit_test.h" | 88 #include "views/window/hit_test.h" |
| 88 #endif | 89 #endif |
| 89 | 90 |
| 90 using base::TimeDelta; | 91 using base::TimeDelta; |
| 91 using views::ColumnSet; | 92 using views::ColumnSet; |
| 92 using views::GridLayout; | 93 using views::GridLayout; |
| 93 | 94 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 last_focused_view_storage_id_( | 420 last_focused_view_storage_id_( |
| 420 views::ViewStorage::GetSharedInstance()->CreateStorageID()) { | 421 views::ViewStorage::GetSharedInstance()->CreateStorageID()) { |
| 421 InitClass(); | 422 InitClass(); |
| 422 browser_->tabstrip_model()->AddObserver(this); | 423 browser_->tabstrip_model()->AddObserver(this); |
| 423 } | 424 } |
| 424 | 425 |
| 425 BrowserView::~BrowserView() { | 426 BrowserView::~BrowserView() { |
| 426 browser_->tabstrip_model()->RemoveObserver(this); | 427 browser_->tabstrip_model()->RemoveObserver(this); |
| 427 | 428 |
| 428 #if defined(OS_WIN) | 429 #if defined(OS_WIN) |
| 430 // Remove this observer. |
| 431 if (aeropeek_manager_.get()) |
| 432 browser_->tabstrip_model()->RemoveObserver(aeropeek_manager_.get()); |
| 433 |
| 429 // Stop hung plugin monitoring. | 434 // Stop hung plugin monitoring. |
| 430 ticker_.Stop(); | 435 ticker_.Stop(); |
| 431 ticker_.UnregisterTickHandler(&hung_window_detector_); | 436 ticker_.UnregisterTickHandler(&hung_window_detector_); |
| 432 #endif | 437 #endif |
| 433 | 438 |
| 434 // We destroy the download shelf before |browser_| to remove its child | 439 // We destroy the download shelf before |browser_| to remove its child |
| 435 // download views from the set of download observers (since the observed | 440 // download views from the set of download observers (since the observed |
| 436 // downloads can be destroyed along with |browser_| and the observer | 441 // downloads can be destroyed along with |browser_| and the observer |
| 437 // notifications will call back into deleted objects). | 442 // notifications will call back into deleted objects). |
| 438 download_shelf_.reset(); | 443 download_shelf_.reset(); |
| (...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 std::string BrowserView::GetClassName() const { | 1569 std::string BrowserView::GetClassName() const { |
| 1565 return kViewClassName; | 1570 return kViewClassName; |
| 1566 } | 1571 } |
| 1567 | 1572 |
| 1568 void BrowserView::Layout() { | 1573 void BrowserView::Layout() { |
| 1569 if (ignore_layout_) | 1574 if (ignore_layout_) |
| 1570 return; | 1575 return; |
| 1571 if (GetLayoutManager()) { | 1576 if (GetLayoutManager()) { |
| 1572 GetLayoutManager()->Layout(this); | 1577 GetLayoutManager()->Layout(this); |
| 1573 SchedulePaint(); | 1578 SchedulePaint(); |
| 1579 #if defined(OS_WIN) |
| 1580 // Send the margins of the "user-perceived content area" of this |
| 1581 // browser window so AeroPeekManager can render a background-tab image in |
| 1582 // the area. |
| 1583 if (aeropeek_manager_.get()) { |
| 1584 gfx::Insets insets(GetFindBarBoundingBox().y() + 1, |
| 1585 GetTabStripBounds().x(), |
| 1586 GetTabStripBounds().x(), |
| 1587 GetTabStripBounds().x()); |
| 1588 aeropeek_manager_->SetContentInsets(insets); |
| 1589 } |
| 1590 #endif |
| 1574 } | 1591 } |
| 1575 } | 1592 } |
| 1576 | 1593 |
| 1577 void BrowserView::ViewHierarchyChanged(bool is_add, | 1594 void BrowserView::ViewHierarchyChanged(bool is_add, |
| 1578 views::View* parent, | 1595 views::View* parent, |
| 1579 views::View* child) { | 1596 views::View* child) { |
| 1580 if (is_add && child == this && GetWidget() && !initialized_) { | 1597 if (is_add && child == this && GetWidget() && !initialized_) { |
| 1581 Init(); | 1598 Init(); |
| 1582 initialized_ = true; | 1599 initialized_ = true; |
| 1583 } | 1600 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1692 | 1709 |
| 1693 #if defined(OS_WIN) | 1710 #if defined(OS_WIN) |
| 1694 InitSystemMenu(); | 1711 InitSystemMenu(); |
| 1695 | 1712 |
| 1696 // Create a custom JumpList and add it to an observer of TabRestoreService | 1713 // Create a custom JumpList and add it to an observer of TabRestoreService |
| 1697 // so we can update the custom JumpList when a tab is added or removed. | 1714 // so we can update the custom JumpList when a tab is added or removed. |
| 1698 if (JumpList::Enabled()) { | 1715 if (JumpList::Enabled()) { |
| 1699 jumplist_.reset(new JumpList); | 1716 jumplist_.reset(new JumpList); |
| 1700 jumplist_->AddObserver(browser_->profile()); | 1717 jumplist_->AddObserver(browser_->profile()); |
| 1701 } | 1718 } |
| 1719 |
| 1720 if (AeroPeekManager::Enabled()) { |
| 1721 gfx::Rect bounds(frame_->GetBoundsForTabStrip(tabstrip())); |
| 1722 aeropeek_manager_.reset(new AeroPeekManager( |
| 1723 frame_->GetWindow()->GetNativeWindow())); |
| 1724 browser_->tabstrip_model()->AddObserver(aeropeek_manager_.get()); |
| 1725 } |
| 1702 #endif | 1726 #endif |
| 1703 | 1727 |
| 1704 browser_extender_.reset(new BrowserExtender()); | 1728 browser_extender_.reset(new BrowserExtender()); |
| 1705 } | 1729 } |
| 1706 | 1730 |
| 1707 #if defined(OS_WIN) | 1731 #if defined(OS_WIN) |
| 1708 void BrowserView::InitSystemMenu() { | 1732 void BrowserView::InitSystemMenu() { |
| 1709 system_menu_contents_.reset(new views::SystemMenuModel(this)); | 1733 system_menu_contents_.reset(new views::SystemMenuModel(this)); |
| 1710 // We add the menu items in reverse order so that insertion_index never needs | 1734 // We add the menu items in reverse order so that insertion_index never needs |
| 1711 // to change. | 1735 // to change. |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 BrowserView* view = new BrowserView(browser); | 2154 BrowserView* view = new BrowserView(browser); |
| 2131 BrowserFrame::Create(view, browser->profile()); | 2155 BrowserFrame::Create(view, browser->profile()); |
| 2132 return view; | 2156 return view; |
| 2133 } | 2157 } |
| 2134 #endif | 2158 #endif |
| 2135 | 2159 |
| 2136 // static | 2160 // static |
| 2137 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2161 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
| 2138 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2162 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
| 2139 } | 2163 } |
| OLD | NEW |