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" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 // from being changed to top-most after the window is created without | 62 // from being changed to top-most after the window is created without |
63 // activation. | 63 // activation. |
64 params.keep_on_top = true; | 64 params.keep_on_top = true; |
65 } | 65 } |
66 #if defined(USE_AURA) | 66 #if defined(USE_AURA) |
67 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 67 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
68 if (command_line->HasSwitch(switches::kAuraTranslucentFrames)) | 68 if (command_line->HasSwitch(switches::kAuraTranslucentFrames)) |
69 params.transparent = true; | 69 params.transparent = true; |
70 #endif | 70 #endif |
71 Init(params); | 71 Init(params); |
72 // TODO(jamescook): Do this for Aura laptop mode? | |
oshima
2011/12/13 00:47:47
you probably want to do this for laptop mode.
James Cook
2011/12/13 18:19:13
Done.
| |
72 #if defined(OS_CHROMEOS) && !defined(USE_AURA) | 73 #if defined(OS_CHROMEOS) && !defined(USE_AURA) |
73 // On ChromeOS we always want top-level windows to appear active. | 74 // On ChromeOS we always want top-level windows to appear active. |
74 if (!browser_view_->IsBrowserTypePopup()) | 75 if (!browser_view_->IsBrowserTypePopup()) |
75 DisableInactiveRendering(); | 76 DisableInactiveRendering(); |
76 #endif | 77 #endif |
77 } | 78 } |
78 | 79 |
79 int BrowserFrame::GetMinimizeButtonOffset() const { | 80 int BrowserFrame::GetMinimizeButtonOffset() const { |
80 return native_browser_frame_->GetMinimizeButtonOffset(); | 81 return native_browser_frame_->GetMinimizeButtonOffset(); |
81 } | 82 } |
(...skipping 16 matching lines...) Expand all Loading... | |
98 | 99 |
99 void BrowserFrame::TabStripDisplayModeChanged() { | 100 void BrowserFrame::TabStripDisplayModeChanged() { |
100 if (GetRootView()->has_children()) { | 101 if (GetRootView()->has_children()) { |
101 // Make sure the child of the root view gets Layout again. | 102 // Make sure the child of the root view gets Layout again. |
102 GetRootView()->child_at(0)->InvalidateLayout(); | 103 GetRootView()->child_at(0)->InvalidateLayout(); |
103 } | 104 } |
104 GetRootView()->Layout(); | 105 GetRootView()->Layout(); |
105 native_browser_frame_->TabStripDisplayModeChanged(); | 106 native_browser_frame_->TabStripDisplayModeChanged(); |
106 } | 107 } |
107 | 108 |
109 bool BrowserFrame::IsSingleWindowMode() const { | |
110 bool single_window_mode = false; | |
111 #if defined(USE_AURA) | |
112 single_window_mode = | |
113 CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraLaptopMode); | |
114 #elif defined(OS_CHROMEOS) | |
115 single_window_mode = | |
116 chromeos::system::runtime_environment::IsRunningOnChromeOS(); | |
117 #endif | |
118 return single_window_mode; | |
119 } | |
120 | |
108 /////////////////////////////////////////////////////////////////////////////// | 121 /////////////////////////////////////////////////////////////////////////////// |
109 // BrowserFrameWin, views::Window overrides: | 122 // BrowserFrame, views::Widget overrides: |
110 | 123 |
111 bool BrowserFrame::IsMaximized() const { | 124 bool BrowserFrame::IsMaximized() const { |
James Cook
2011/12/13 18:19:13
I reverted this to the old way, and made it so tab
| |
112 #if defined(OS_CHROMEOS) && !defined(USE_AURA) | 125 if (IsSingleWindowMode()) { |
113 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) { | |
114 return !IsFullscreen() && | 126 return !IsFullscreen() && |
115 (!browser_view_->IsBrowserTypePopup() || Widget::IsMaximized()); | 127 (!browser_view_->IsBrowserTypePopup() || Widget::IsMaximized()); |
116 } | 128 } |
117 #endif | |
118 return Widget::IsMaximized(); | 129 return Widget::IsMaximized(); |
119 } | 130 } |
120 | 131 |
121 views::internal::RootView* BrowserFrame::CreateRootView() { | 132 views::internal::RootView* BrowserFrame::CreateRootView() { |
122 root_view_ = new BrowserRootView(browser_view_, this); | 133 root_view_ = new BrowserRootView(browser_view_, this); |
123 return root_view_; | 134 return root_view_; |
124 } | 135 } |
125 | 136 |
126 views::NonClientFrameView* BrowserFrame::CreateNonClientFrameView() { | 137 views::NonClientFrameView* BrowserFrame::CreateNonClientFrameView() { |
127 #if defined(OS_WIN) && !defined(USE_AURA) | 138 #if defined(OS_WIN) && !defined(USE_AURA) |
(...skipping 28 matching lines...) Expand all Loading... | |
156 // set ourselves as the last active browser window to ensure that we get | 167 // set ourselves as the last active browser window to ensure that we get |
157 // treated as such by the rest of Chrome. | 168 // treated as such by the rest of Chrome. |
158 BrowserList::SetLastActive(browser_view_->browser()); | 169 BrowserList::SetLastActive(browser_view_->browser()); |
159 } | 170 } |
160 Widget::OnNativeWidgetActivationChanged(active); | 171 Widget::OnNativeWidgetActivationChanged(active); |
161 } | 172 } |
162 | 173 |
163 AvatarMenuButton* BrowserFrame::GetAvatarMenuButton() { | 174 AvatarMenuButton* BrowserFrame::GetAvatarMenuButton() { |
164 return browser_frame_view_->avatar_button(); | 175 return browser_frame_view_->avatar_button(); |
165 } | 176 } |
OLD | NEW |