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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #include "views/grid_layout.h" | 62 #include "views/grid_layout.h" |
63 #include "views/widget/root_view.h" | 63 #include "views/widget/root_view.h" |
64 #include "views/window/dialog_delegate.h" | 64 #include "views/window/dialog_delegate.h" |
65 #include "views/window/window.h" | 65 #include "views/window/window.h" |
66 | 66 |
67 #if defined(OS_WIN) | 67 #if defined(OS_WIN) |
68 #include "app/win_util.h" | 68 #include "app/win_util.h" |
69 #include "chrome/browser/aeropeek_manager.h" | 69 #include "chrome/browser/aeropeek_manager.h" |
70 #include "chrome/browser/jumplist_win.h" | 70 #include "chrome/browser/jumplist_win.h" |
71 #elif defined(OS_LINUX) | 71 #elif defined(OS_LINUX) |
72 #include "chrome/browser/gtk/accessible_widget_helper_gtk.h" | |
73 #include "chrome/browser/views/accelerator_table_gtk.h" | 72 #include "chrome/browser/views/accelerator_table_gtk.h" |
74 #include "views/window/hit_test.h" | 73 #include "views/window/hit_test.h" |
75 #endif | 74 #endif |
76 | 75 |
77 using base::TimeDelta; | 76 using base::TimeDelta; |
78 using views::ColumnSet; | 77 using views::ColumnSet; |
79 using views::GridLayout; | 78 using views::GridLayout; |
80 | 79 |
81 // The height of the status bubble. | 80 // The height of the status bubble. |
82 static const int kStatusBubbleHeight = 20; | 81 static const int kStatusBubbleHeight = 20; |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 } | 656 } |
658 | 657 |
659 bool BrowserView::IsPositionInWindowCaption(const gfx::Point& point) { | 658 bool BrowserView::IsPositionInWindowCaption(const gfx::Point& point) { |
660 return GetBrowserViewLayout()->IsPositionInWindowCaption(point); | 659 return GetBrowserViewLayout()->IsPositionInWindowCaption(point); |
661 } | 660 } |
662 | 661 |
663 /////////////////////////////////////////////////////////////////////////////// | 662 /////////////////////////////////////////////////////////////////////////////// |
664 // BrowserView, BrowserWindow implementation: | 663 // BrowserView, BrowserWindow implementation: |
665 | 664 |
666 void BrowserView::Show() { | 665 void BrowserView::Show() { |
667 accessible_view_helper_.reset(new AccessibleViewHelper( | |
668 this, browser_->profile())); | |
669 | |
670 #if defined(OS_LINUX) | |
671 if (!accessible_widget_helper_.get()) { | |
672 accessible_widget_helper_.reset(new AccessibleWidgetHelper( | |
673 GTK_WIDGET(GetWindow()->GetNativeWindow()), browser_->profile())); | |
674 } | |
675 #endif | |
676 | |
677 // If the window is already visible, just activate it. | 666 // If the window is already visible, just activate it. |
678 if (frame_->GetWindow()->IsVisible()) { | 667 if (frame_->GetWindow()->IsVisible()) { |
679 frame_->GetWindow()->Activate(); | 668 frame_->GetWindow()->Activate(); |
680 return; | 669 return; |
681 } | 670 } |
682 | 671 |
683 // Setting the focus doesn't work when the window is invisible, so any focus | 672 // Setting the focus doesn't work when the window is invisible, so any focus |
684 // initialization that happened before this will be lost. | 673 // initialization that happened before this will be lost. |
685 // | 674 // |
686 // We really "should" restore the focus whenever the window becomes unhidden, | 675 // We really "should" restore the focus whenever the window becomes unhidden, |
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 tabstrip_->AsTabStrip()->set_new_tab_button_enabled(false); | 1736 tabstrip_->AsTabStrip()->set_new_tab_button_enabled(false); |
1748 AddChildView(tabstrip_); | 1737 AddChildView(tabstrip_); |
1749 | 1738 |
1750 tabstrip_controller->InitFromModel(tabstrip_); | 1739 tabstrip_controller->InitFromModel(tabstrip_); |
1751 } | 1740 } |
1752 | 1741 |
1753 /////////////////////////////////////////////////////////////////////////////// | 1742 /////////////////////////////////////////////////////////////////////////////// |
1754 // BrowserView, private: | 1743 // BrowserView, private: |
1755 | 1744 |
1756 void BrowserView::Init() { | 1745 void BrowserView::Init() { |
| 1746 accessible_view_helper_.reset(new AccessibleViewHelper( |
| 1747 this, browser_->profile())); |
| 1748 |
1757 SetLayoutManager(CreateLayoutManager()); | 1749 SetLayoutManager(CreateLayoutManager()); |
1758 // Stow a pointer to this object onto the window handle so that we can get | 1750 // Stow a pointer to this object onto the window handle so that we can get |
1759 // at it later when all we have is a native view. | 1751 // at it later when all we have is a native view. |
1760 #if defined(OS_WIN) | 1752 #if defined(OS_WIN) |
1761 SetProp(GetWidget()->GetNativeView(), kBrowserViewKey, this); | 1753 SetProp(GetWidget()->GetNativeView(), kBrowserViewKey, this); |
1762 #else | 1754 #else |
1763 g_object_set_data(G_OBJECT(GetWidget()->GetNativeView()), | 1755 g_object_set_data(G_OBJECT(GetWidget()->GetNativeView()), |
1764 kBrowserViewKey, this); | 1756 kBrowserViewKey, this); |
1765 #endif | 1757 #endif |
1766 | 1758 |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2301 SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); | 2293 SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); |
2302 | 2294 |
2303 return view; | 2295 return view; |
2304 } | 2296 } |
2305 #endif | 2297 #endif |
2306 | 2298 |
2307 // static | 2299 // static |
2308 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2300 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
2309 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2301 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
2310 } | 2302 } |
OLD | NEW |