OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_frame.h" | 5 #include "chrome/browser/ui/views/frame/browser_frame.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/themes/theme_service.h" | 8 #include "chrome/browser/themes/theme_service.h" |
9 #include "chrome/browser/themes/theme_service_factory.h" | 9 #include "chrome/browser/themes/theme_service_factory.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_list.h" | 11 #include "chrome/browser/ui/browser_list.h" |
12 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" | 12 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
13 #include "chrome/browser/ui/views/frame/browser_root_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_root_view.h" |
14 #include "chrome/browser/ui/views/frame/browser_view.h" | 14 #include "chrome/browser/ui/views/frame/browser_view.h" |
15 #include "chrome/browser/ui/views/frame/native_browser_frame.h" | 15 #include "chrome/browser/ui/views/frame/native_browser_frame.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "ui/base/theme_provider.h" | 17 #include "ui/base/theme_provider.h" |
| 18 #include "ui/gfx/screen.h" |
18 #include "ui/views/widget/native_widget.h" | 19 #include "ui/views/widget/native_widget.h" |
19 | 20 |
20 #if defined(OS_WIN) && !defined(USE_AURA) | 21 #if defined(OS_WIN) && !defined(USE_AURA) |
21 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" | 22 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" |
22 #elif defined(OS_CHROMEOS) | 23 #elif defined(OS_CHROMEOS) |
23 #include "chrome/browser/chromeos/system/runtime_environment.h" | 24 #include "chrome/browser/chromeos/system/runtime_environment.h" |
24 #endif | 25 #endif |
25 | 26 |
26 #if defined(USE_AURA) | 27 #if defined(USE_AURA) |
27 #include "ui/aura/aura_switches.h" | 28 #include "ui/aura/aura_switches.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // We need to set the top-most bit when the panel window is created. | 61 // We need to set the top-most bit when the panel window is created. |
61 // There is a Windows bug/feature that would very likely prevent the window | 62 // There is a Windows bug/feature that would very likely prevent the window |
62 // from being changed to top-most after the window is created without | 63 // from being changed to top-most after the window is created without |
63 // activation. | 64 // activation. |
64 params.keep_on_top = true; | 65 params.keep_on_top = true; |
65 } | 66 } |
66 #if defined(USE_AURA) | 67 #if defined(USE_AURA) |
67 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 68 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
68 if (command_line->HasSwitch(switches::kAuraTranslucentFrames)) | 69 if (command_line->HasSwitch(switches::kAuraTranslucentFrames)) |
69 params.transparent = true; | 70 params.transparent = true; |
| 71 // Aura laptop mode fills the monitor with with its windows. |
| 72 if (command_line->HasSwitch(switches::kAuraLaptopMode) && |
| 73 browser_view_->IsBrowserTypeNormal()) { |
| 74 params.bounds = gfx::Screen::GetPrimaryMonitorBounds(); |
| 75 params.show_state = ui::SHOW_STATE_MAXIMIZED; |
| 76 } |
70 #endif | 77 #endif |
71 Init(params); | 78 Init(params); |
72 #if defined(OS_CHROMEOS) && !defined(USE_AURA) | 79 |
73 // On ChromeOS we always want top-level windows to appear active. | 80 // On ChromeOS and Aura laptop mode we always want top-level windows |
74 if (!browser_view_->IsBrowserTypePopup()) | 81 // to appear active. |
| 82 bool disable_inactive_rendering = false; |
| 83 #if defined(USE_AURA) |
| 84 disable_inactive_rendering = |
| 85 CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraLaptopMode); |
| 86 #elif defined(OS_CHROMEOS) |
| 87 disable_inactive_rendering = true; |
| 88 #endif |
| 89 if (disable_inactive_rendering && !browser_view_->IsBrowserTypePopup()) |
75 DisableInactiveRendering(); | 90 DisableInactiveRendering(); |
76 #endif | |
77 } | 91 } |
78 | 92 |
79 int BrowserFrame::GetMinimizeButtonOffset() const { | 93 int BrowserFrame::GetMinimizeButtonOffset() const { |
80 return native_browser_frame_->GetMinimizeButtonOffset(); | 94 return native_browser_frame_->GetMinimizeButtonOffset(); |
81 } | 95 } |
82 | 96 |
83 gfx::Rect BrowserFrame::GetBoundsForTabStrip(views::View* tabstrip) const { | 97 gfx::Rect BrowserFrame::GetBoundsForTabStrip(views::View* tabstrip) const { |
84 return browser_frame_view_->GetBoundsForTabStrip(tabstrip); | 98 return browser_frame_view_->GetBoundsForTabStrip(tabstrip); |
85 } | 99 } |
86 | 100 |
(...skipping 11 matching lines...) Expand all Loading... |
98 | 112 |
99 void BrowserFrame::TabStripDisplayModeChanged() { | 113 void BrowserFrame::TabStripDisplayModeChanged() { |
100 if (GetRootView()->has_children()) { | 114 if (GetRootView()->has_children()) { |
101 // Make sure the child of the root view gets Layout again. | 115 // Make sure the child of the root view gets Layout again. |
102 GetRootView()->child_at(0)->InvalidateLayout(); | 116 GetRootView()->child_at(0)->InvalidateLayout(); |
103 } | 117 } |
104 GetRootView()->Layout(); | 118 GetRootView()->Layout(); |
105 native_browser_frame_->TabStripDisplayModeChanged(); | 119 native_browser_frame_->TabStripDisplayModeChanged(); |
106 } | 120 } |
107 | 121 |
| 122 bool BrowserFrame::IsSingleWindowMode() const { |
| 123 bool single_window_mode = false; |
| 124 #if defined(USE_AURA) |
| 125 single_window_mode = |
| 126 CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraLaptopMode); |
| 127 #elif defined(OS_CHROMEOS) |
| 128 single_window_mode = |
| 129 chromeos::system::runtime_environment::IsRunningOnChromeOS(); |
| 130 #endif |
| 131 return single_window_mode; |
| 132 } |
| 133 |
108 /////////////////////////////////////////////////////////////////////////////// | 134 /////////////////////////////////////////////////////////////////////////////// |
109 // BrowserFrameWin, views::Window overrides: | 135 // BrowserFrame, views::Widget overrides: |
110 | 136 |
111 bool BrowserFrame::IsMaximized() const { | 137 bool BrowserFrame::IsMaximized() const { |
112 #if defined(OS_CHROMEOS) && !defined(USE_AURA) | 138 #if defined(OS_CHROMEOS) && !defined(USE_AURA) |
113 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) { | 139 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) { |
114 return !IsFullscreen() && | 140 return !IsFullscreen() && |
115 (!browser_view_->IsBrowserTypePopup() || Widget::IsMaximized()); | 141 (!browser_view_->IsBrowserTypePopup() || Widget::IsMaximized()); |
116 } | 142 } |
117 #endif | 143 #endif |
118 return Widget::IsMaximized(); | 144 return Widget::IsMaximized(); |
119 } | 145 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // set ourselves as the last active browser window to ensure that we get | 182 // set ourselves as the last active browser window to ensure that we get |
157 // treated as such by the rest of Chrome. | 183 // treated as such by the rest of Chrome. |
158 BrowserList::SetLastActive(browser_view_->browser()); | 184 BrowserList::SetLastActive(browser_view_->browser()); |
159 } | 185 } |
160 Widget::OnNativeWidgetActivationChanged(active); | 186 Widget::OnNativeWidgetActivationChanged(active); |
161 } | 187 } |
162 | 188 |
163 AvatarMenuButton* BrowserFrame::GetAvatarMenuButton() { | 189 AvatarMenuButton* BrowserFrame::GetAvatarMenuButton() { |
164 return browser_frame_view_->avatar_button(); | 190 return browser_frame_view_->avatar_button(); |
165 } | 191 } |
OLD | NEW |