OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ash/common/frame/custom_frame_view_ash.h" | 5 #include "ash/common/frame/custom_frame_view_ash.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 bool enable_immersive) | 189 bool enable_immersive) |
190 : frame_(frame), | 190 : frame_(frame), |
191 header_view_(new HeaderView(frame)), | 191 header_view_(new HeaderView(frame)), |
192 immersive_delegate_(immersive_delegate ? immersive_delegate | 192 immersive_delegate_(immersive_delegate ? immersive_delegate |
193 : header_view_) { | 193 : header_view_) { |
194 WmWindow* frame_window = WmLookup::Get()->GetWindowForWidget(frame); | 194 WmWindow* frame_window = WmLookup::Get()->GetWindowForWidget(frame); |
195 frame_window->InstallResizeHandleWindowTargeter(nullptr); | 195 frame_window->InstallResizeHandleWindowTargeter(nullptr); |
196 // |header_view_| is set as the non client view's overlay view so that it can | 196 // |header_view_| is set as the non client view's overlay view so that it can |
197 // overlay the web contents in immersive fullscreen. | 197 // overlay the web contents in immersive fullscreen. |
198 frame->non_client_view()->SetOverlayView(new OverlayView(header_view_)); | 198 frame->non_client_view()->SetOverlayView(new OverlayView(header_view_)); |
| 199 frame_window->SetColorProperty(WmWindowProperty::TOP_VIEW_COLOR, |
| 200 header_view_->GetInactiveFrameColor()); |
199 | 201 |
200 // A delegate for a more complex way of fullscreening the window may already | 202 // A delegate for a more complex way of fullscreening the window may already |
201 // be set. This is the case for packaged apps. | 203 // be set. This is the case for packaged apps. |
202 wm::WindowState* window_state = frame_window->GetWindowState(); | 204 wm::WindowState* window_state = frame_window->GetWindowState(); |
203 if (!window_state->HasDelegate()) { | 205 if (!window_state->HasDelegate()) { |
204 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>( | 206 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>( |
205 new CustomFrameViewAshWindowStateDelegate(window_state, this, | 207 new CustomFrameViewAshWindowStateDelegate(window_state, this, |
206 enable_immersive))); | 208 enable_immersive))); |
207 } | 209 } |
208 } | 210 } |
209 | 211 |
210 CustomFrameViewAsh::~CustomFrameViewAsh() {} | 212 CustomFrameViewAsh::~CustomFrameViewAsh() {} |
211 | 213 |
212 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( | 214 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( |
213 ImmersiveFullscreenController* immersive_fullscreen_controller) { | 215 ImmersiveFullscreenController* immersive_fullscreen_controller) { |
214 immersive_fullscreen_controller->Init(immersive_delegate_, frame_, | 216 immersive_fullscreen_controller->Init(immersive_delegate_, frame_, |
215 header_view_); | 217 header_view_); |
216 } | 218 } |
217 | 219 |
218 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color, | 220 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color, |
219 SkColor inactive_frame_color) { | 221 SkColor inactive_frame_color) { |
220 header_view_->SetFrameColors(active_frame_color, inactive_frame_color); | 222 header_view_->SetFrameColors(active_frame_color, inactive_frame_color); |
| 223 WmWindow* frame_window = WmLookup::Get()->GetWindowForWidget(frame_); |
| 224 frame_window->SetColorProperty(WmWindowProperty::TOP_VIEW_COLOR, |
| 225 header_view_->GetInactiveFrameColor()); |
221 } | 226 } |
222 | 227 |
223 //////////////////////////////////////////////////////////////////////////////// | 228 //////////////////////////////////////////////////////////////////////////////// |
224 // CustomFrameViewAsh, views::NonClientFrameView overrides: | 229 // CustomFrameViewAsh, views::NonClientFrameView overrides: |
225 | 230 |
226 gfx::Rect CustomFrameViewAsh::GetBoundsForClientView() const { | 231 gfx::Rect CustomFrameViewAsh::GetBoundsForClientView() const { |
227 gfx::Rect client_bounds = bounds(); | 232 gfx::Rect client_bounds = bounds(); |
228 client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0); | 233 client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0); |
229 return client_bounds; | 234 return client_bounds; |
230 } | 235 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 FrameCaptionButtonContainerView* | 354 FrameCaptionButtonContainerView* |
350 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { | 355 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { |
351 return header_view_->caption_button_container(); | 356 return header_view_->caption_button_container(); |
352 } | 357 } |
353 | 358 |
354 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 359 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
355 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 360 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
356 } | 361 } |
357 | 362 |
358 } // namespace ash | 363 } // namespace ash |
OLD | NEW |