Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/ui/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 #include "ui/accessibility/ax_view_state.h" | 117 #include "ui/accessibility/ax_view_state.h" |
| 118 #include "ui/base/accelerators/accelerator.h" | 118 #include "ui/base/accelerators/accelerator.h" |
| 119 #include "ui/base/hit_test.h" | 119 #include "ui/base/hit_test.h" |
| 120 #include "ui/base/l10n/l10n_util.h" | 120 #include "ui/base/l10n/l10n_util.h" |
| 121 #include "ui/base/resource/resource_bundle.h" | 121 #include "ui/base/resource/resource_bundle.h" |
| 122 #include "ui/base/theme_provider.h" | 122 #include "ui/base/theme_provider.h" |
| 123 #include "ui/events/event_utils.h" | 123 #include "ui/events/event_utils.h" |
| 124 #include "ui/gfx/canvas.h" | 124 #include "ui/gfx/canvas.h" |
| 125 #include "ui/gfx/color_utils.h" | 125 #include "ui/gfx/color_utils.h" |
| 126 #include "ui/gfx/rect_conversions.h" | 126 #include "ui/gfx/rect_conversions.h" |
| 127 #include "ui/gfx/sys_color_change_listener.h" | |
| 128 #include "ui/views/controls/button/menu_button.h" | 127 #include "ui/views/controls/button/menu_button.h" |
| 129 #include "ui/views/controls/textfield/textfield.h" | 128 #include "ui/views/controls/textfield/textfield.h" |
| 130 #include "ui/views/controls/webview/webview.h" | 129 #include "ui/views/controls/webview/webview.h" |
| 131 #include "ui/views/focus/external_focus_tracker.h" | 130 #include "ui/views/focus/external_focus_tracker.h" |
| 132 #include "ui/views/focus/view_storage.h" | 131 #include "ui/views/focus/view_storage.h" |
| 133 #include "ui/views/layout/grid_layout.h" | 132 #include "ui/views/layout/grid_layout.h" |
| 134 #include "ui/views/widget/native_widget.h" | 133 #include "ui/views/widget/native_widget.h" |
| 135 #include "ui/views/widget/root_view.h" | 134 #include "ui/views/widget/root_view.h" |
| 136 #include "ui/views/widget/widget.h" | 135 #include "ui/views/widget/widget.h" |
| 137 #include "ui/views/window/dialog_delegate.h" | 136 #include "ui/views/window/dialog_delegate.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 initialized_(false), | 413 initialized_(false), |
| 415 in_process_fullscreen_(false), | 414 in_process_fullscreen_(false), |
| 416 #if defined(OS_WIN) | 415 #if defined(OS_WIN) |
| 417 hung_window_detector_(&hung_plugin_action_), | 416 hung_window_detector_(&hung_plugin_action_), |
| 418 ticker_(0), | 417 ticker_(0), |
| 419 #endif | 418 #endif |
| 420 force_location_bar_focus_(false), | 419 force_location_bar_focus_(false), |
| 421 #if defined(OS_CHROMEOS) | 420 #if defined(OS_CHROMEOS) |
| 422 scroll_end_effect_controller_(ScrollEndEffectController::Create()), | 421 scroll_end_effect_controller_(ScrollEndEffectController::Create()), |
| 423 #endif | 422 #endif |
| 424 color_change_listener_(this), | |
| 425 activate_modal_dialog_factory_(this) { | 423 activate_modal_dialog_factory_(this) { |
| 426 } | 424 } |
| 427 | 425 |
| 428 BrowserView::~BrowserView() { | 426 BrowserView::~BrowserView() { |
| 429 // All the tabs should have been destroyed already. If we were closed by the | 427 // All the tabs should have been destroyed already. If we were closed by the |
| 430 // OS with some tabs than the NativeBrowserFrame should have destroyed them. | 428 // OS with some tabs than the NativeBrowserFrame should have destroyed them. |
| 431 DCHECK_EQ(0, browser_->tab_strip_model()->count()); | 429 DCHECK_EQ(0, browser_->tab_strip_model()->count()); |
| 432 | 430 |
| 433 // Immersive mode may need to reparent views before they are removed/deleted. | 431 // Immersive mode may need to reparent views before they are removed/deleted. |
| 434 immersive_mode_controller_.reset(); | 432 immersive_mode_controller_.reset(); |
| (...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1836 } | 1834 } |
| 1837 | 1835 |
| 1838 void BrowserView::ChildPreferredSizeChanged(View* child) { | 1836 void BrowserView::ChildPreferredSizeChanged(View* child) { |
| 1839 Layout(); | 1837 Layout(); |
| 1840 } | 1838 } |
| 1841 | 1839 |
| 1842 void BrowserView::GetAccessibleState(ui::AXViewState* state) { | 1840 void BrowserView::GetAccessibleState(ui::AXViewState* state) { |
| 1843 state->role = ui::AX_ROLE_CLIENT; | 1841 state->role = ui::AX_ROLE_CLIENT; |
| 1844 } | 1842 } |
| 1845 | 1843 |
| 1844 void BrowserView::OnNativeThemeChanged(const ui::NativeTheme* theme) { | |
| 1845 ClientView::OnNativeThemeChanged(theme); | |
| 1846 UserChangedTheme(); | |
| 1847 chrome::MaybeShowInvertBubbleView(this); | |
|
sky
2014/04/24 22:52:01
estade's patch made it show that you'll hit this o
msw
2014/04/25 00:14:51
I just ran my local Chromium build with a clean pr
| |
| 1848 } | |
| 1849 | |
| 1846 /////////////////////////////////////////////////////////////////////////////// | 1850 /////////////////////////////////////////////////////////////////////////////// |
| 1847 // BrowserView, ui::AcceleratorTarget overrides: | 1851 // BrowserView, ui::AcceleratorTarget overrides: |
| 1848 | 1852 |
| 1849 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 1853 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 1850 #if defined(OS_CHROMEOS) | 1854 #if defined(OS_CHROMEOS) |
| 1851 // If accessibility is enabled, stop speech and return false so that key | 1855 // If accessibility is enabled, stop speech and return false so that key |
| 1852 // combinations involving Search can be used for extra accessibility | 1856 // combinations involving Search can be used for extra accessibility |
| 1853 // functionality. | 1857 // functionality. |
| 1854 if (accelerator.key_code() == ui::VKEY_LWIN && | 1858 if (accelerator.key_code() == ui::VKEY_LWIN && |
| 1855 g_browser_process->local_state()->GetBoolean( | 1859 g_browser_process->local_state()->GetBoolean( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1893 | 1897 |
| 1894 bool BrowserView::DrawInfoBarArrows(int* x) const { | 1898 bool BrowserView::DrawInfoBarArrows(int* x) const { |
| 1895 if (x) { | 1899 if (x) { |
| 1896 gfx::Point anchor(toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 1900 gfx::Point anchor(toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
| 1897 ConvertPointToTarget(toolbar_->location_bar(), this, &anchor); | 1901 ConvertPointToTarget(toolbar_->location_bar(), this, &anchor); |
| 1898 *x = anchor.x(); | 1902 *x = anchor.x(); |
| 1899 } | 1903 } |
| 1900 return true; | 1904 return true; |
| 1901 } | 1905 } |
| 1902 | 1906 |
| 1903 void BrowserView::OnSysColorChange() { | |
| 1904 chrome::MaybeShowInvertBubbleView(this); | |
| 1905 } | |
| 1906 | |
| 1907 void BrowserView::InitViews() { | 1907 void BrowserView::InitViews() { |
| 1908 GetWidget()->AddObserver(this); | 1908 GetWidget()->AddObserver(this); |
| 1909 | 1909 |
| 1910 // Stow a pointer to this object onto the window handle so that we can get at | 1910 // Stow a pointer to this object onto the window handle so that we can get at |
| 1911 // it later when all we have is a native view. | 1911 // it later when all we have is a native view. |
| 1912 GetWidget()->SetNativeWindowProperty(kBrowserViewKey, this); | 1912 GetWidget()->SetNativeWindowProperty(kBrowserViewKey, this); |
| 1913 | 1913 |
| 1914 // Stow a pointer to the browser's profile onto the window handle so that we | 1914 // Stow a pointer to the browser's profile onto the window handle so that we |
| 1915 // can get it later when all we have is a native view. | 1915 // can get it later when all we have is a native view. |
| 1916 GetWidget()->SetNativeWindowProperty(Profile::kProfileKey, | 1916 GetWidget()->SetNativeWindowProperty(Profile::kProfileKey, |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2556 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2556 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
| 2557 gfx::Point icon_bottom( | 2557 gfx::Point icon_bottom( |
| 2558 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2558 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
| 2559 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2559 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
| 2560 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2560 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2561 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2561 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2562 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2562 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2563 } | 2563 } |
| 2564 return top_arrow_height; | 2564 return top_arrow_height; |
| 2565 } | 2565 } |
| OLD | NEW |