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()); | |
201 | 199 |
202 // A delegate for a more complex way of fullscreening the window may already | 200 // A delegate for a more complex way of fullscreening the window may already |
203 // be set. This is the case for packaged apps. | 201 // be set. This is the case for packaged apps. |
204 wm::WindowState* window_state = frame_window->GetWindowState(); | 202 wm::WindowState* window_state = frame_window->GetWindowState(); |
205 if (!window_state->HasDelegate()) { | 203 if (!window_state->HasDelegate()) { |
206 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>( | 204 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>( |
207 new CustomFrameViewAshWindowStateDelegate(window_state, this, | 205 new CustomFrameViewAshWindowStateDelegate(window_state, this, |
208 enable_immersive))); | 206 enable_immersive))); |
209 } | 207 } |
210 } | 208 } |
211 | 209 |
212 CustomFrameViewAsh::~CustomFrameViewAsh() {} | 210 CustomFrameViewAsh::~CustomFrameViewAsh() {} |
213 | 211 |
214 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( | 212 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( |
215 ImmersiveFullscreenController* immersive_fullscreen_controller) { | 213 ImmersiveFullscreenController* immersive_fullscreen_controller) { |
216 immersive_fullscreen_controller->Init(immersive_delegate_, frame_, | 214 immersive_fullscreen_controller->Init(immersive_delegate_, frame_, |
217 header_view_); | 215 header_view_); |
218 } | 216 } |
219 | 217 |
220 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color, | 218 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color, |
221 SkColor inactive_frame_color) { | 219 SkColor inactive_frame_color) { |
222 header_view_->SetFrameColors(active_frame_color, inactive_frame_color); | 220 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()); | |
226 } | 221 } |
227 | 222 |
228 //////////////////////////////////////////////////////////////////////////////// | 223 //////////////////////////////////////////////////////////////////////////////// |
229 // CustomFrameViewAsh, views::NonClientFrameView overrides: | 224 // CustomFrameViewAsh, views::NonClientFrameView overrides: |
230 | 225 |
231 gfx::Rect CustomFrameViewAsh::GetBoundsForClientView() const { | 226 gfx::Rect CustomFrameViewAsh::GetBoundsForClientView() const { |
232 gfx::Rect client_bounds = bounds(); | 227 gfx::Rect client_bounds = bounds(); |
233 client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0); | 228 client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0); |
234 return client_bounds; | 229 return client_bounds; |
235 } | 230 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 FrameCaptionButtonContainerView* | 349 FrameCaptionButtonContainerView* |
355 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { | 350 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { |
356 return header_view_->caption_button_container(); | 351 return header_view_->caption_button_container(); |
357 } | 352 } |
358 | 353 |
359 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 354 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
360 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 355 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
361 } | 356 } |
362 | 357 |
363 } // namespace ash | 358 } // namespace ash |
OLD | NEW |