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