Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: ash/frame/custom_frame_view_ash.cc

Issue 2908333003: [mus+ash] Removes WmWindow from ash (app_list, frame, metrics, session, system, wallpaper) (Closed)
Patch Set: [mus+ash] Removes WmWindow from ash (cleaning remaining wm_window.h in c/b/ui) Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/frame/custom_frame_view_ash.h" 5 #include "ash/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/frame/caption_buttons/frame_caption_button_container_view.h" 10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
11 #include "ash/frame/frame_border_hit_test.h" 11 #include "ash/frame/frame_border_hit_test.h"
12 #include "ash/frame/header_view.h" 12 #include "ash/frame/header_view.h"
13 #include "ash/shared/immersive_fullscreen_controller.h" 13 #include "ash/shared/immersive_fullscreen_controller.h"
14 #include "ash/shared/immersive_fullscreen_controller_delegate.h" 14 #include "ash/shared/immersive_fullscreen_controller_delegate.h"
15 #include "ash/shell_port.h" 15 #include "ash/shell_port.h"
16 #include "ash/wm/resize_handle_window_targeter.h"
16 #include "ash/wm/window_state.h" 17 #include "ash/wm/window_state.h"
17 #include "ash/wm/window_state_delegate.h" 18 #include "ash/wm/window_state_delegate.h"
18 #include "ash/wm/window_state_observer.h" 19 #include "ash/wm/window_state_observer.h"
19 #include "ash/wm_window.h"
20 #include "ui/aura/client/aura_constants.h" 20 #include "ui/aura/client/aura_constants.h"
21 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
22 #include "ui/aura/window_observer.h" 22 #include "ui/aura/window_observer.h"
23 #include "ui/gfx/geometry/rect.h" 23 #include "ui/gfx/geometry/rect.h"
24 #include "ui/gfx/geometry/rect_conversions.h" 24 #include "ui/gfx/geometry/rect_conversions.h"
25 #include "ui/gfx/geometry/size.h" 25 #include "ui/gfx/geometry/size.h"
26 #include "ui/views/view.h" 26 #include "ui/views/view.h"
27 #include "ui/views/view_targeter.h" 27 #include "ui/views/view_targeter.h"
28 #include "ui/views/widget/widget.h" 28 #include "ui/views/widget/widget.h"
29 #include "ui/views/widget/widget_delegate.h" 29 #include "ui/views/widget/widget_delegate.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 CustomFrameViewAsh::CustomFrameViewAsh( 207 CustomFrameViewAsh::CustomFrameViewAsh(
208 views::Widget* frame, 208 views::Widget* frame,
209 ImmersiveFullscreenControllerDelegate* immersive_delegate, 209 ImmersiveFullscreenControllerDelegate* immersive_delegate,
210 bool enable_immersive, 210 bool enable_immersive,
211 mojom::WindowStyle window_style) 211 mojom::WindowStyle window_style)
212 : frame_(frame), 212 : frame_(frame),
213 header_view_(new HeaderView(frame, window_style)), 213 header_view_(new HeaderView(frame, window_style)),
214 overlay_view_(new OverlayView(header_view_)), 214 overlay_view_(new OverlayView(header_view_)),
215 immersive_delegate_(immersive_delegate ? immersive_delegate 215 immersive_delegate_(immersive_delegate ? immersive_delegate
216 : header_view_) { 216 : header_view_) {
217 WmWindow* frame_window = WmWindow::Get(frame->GetNativeWindow()); 217 aura::Window* frame_window = frame->GetNativeWindow();
218 frame_window->InstallResizeHandleWindowTargeter(nullptr); 218 frame_window->SetEventTargeter(
219 base::MakeUnique<ResizeHandleWindowTargeter>(frame_window, nullptr));
219 // |header_view_| is set as the non client view's overlay view so that it can 220 // |header_view_| is set as the non client view's overlay view so that it can
220 // overlay the web contents in immersive fullscreen. 221 // overlay the web contents in immersive fullscreen.
221 frame->non_client_view()->SetOverlayView(overlay_view_); 222 frame->non_client_view()->SetOverlayView(overlay_view_);
222 frame_window->aura_window()->SetProperty( 223 frame_window->SetProperty(aura::client::kTopViewColor,
223 aura::client::kTopViewColor, header_view_->GetInactiveFrameColor()); 224 header_view_->GetInactiveFrameColor());
224 225
225 // A delegate for a more complex way of fullscreening the window may already 226 // A delegate for a more complex way of fullscreening the window may already
226 // be set. This is the case for packaged apps. 227 // be set. This is the case for packaged apps.
227 wm::WindowState* window_state = frame_window->GetWindowState(); 228 wm::WindowState* window_state = wm::GetWindowState(frame_window);
228 if (!window_state->HasDelegate()) { 229 if (!window_state->HasDelegate()) {
229 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>( 230 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>(
230 new CustomFrameViewAshWindowStateDelegate(window_state, this, 231 new CustomFrameViewAshWindowStateDelegate(window_state, this,
231 enable_immersive))); 232 enable_immersive)));
232 } 233 }
233 } 234 }
234 235
235 CustomFrameViewAsh::~CustomFrameViewAsh() {} 236 CustomFrameViewAsh::~CustomFrameViewAsh() {}
236 237
237 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( 238 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView(
238 ImmersiveFullscreenController* immersive_fullscreen_controller) { 239 ImmersiveFullscreenController* immersive_fullscreen_controller) {
239 immersive_fullscreen_controller->Init(immersive_delegate_, frame_, 240 immersive_fullscreen_controller->Init(immersive_delegate_, frame_,
240 header_view_); 241 header_view_);
241 } 242 }
242 243
243 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color, 244 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color,
244 SkColor inactive_frame_color) { 245 SkColor inactive_frame_color) {
245 header_view_->SetFrameColors(active_frame_color, inactive_frame_color); 246 header_view_->SetFrameColors(active_frame_color, inactive_frame_color);
246 WmWindow* frame_window = WmWindow::Get(frame_->GetNativeWindow()); 247 aura::Window* frame_window = frame_->GetNativeWindow();
247 frame_window->aura_window()->SetProperty( 248 frame_window->SetProperty(aura::client::kTopViewColor,
248 aura::client::kTopViewColor, header_view_->GetInactiveFrameColor()); 249 header_view_->GetInactiveFrameColor());
249 } 250 }
250 251
251 void CustomFrameViewAsh::SetHeaderHeight(base::Optional<int> height) { 252 void CustomFrameViewAsh::SetHeaderHeight(base::Optional<int> height) {
252 overlay_view_->SetHeaderHeight(height); 253 overlay_view_->SetHeaderHeight(height);
253 } 254 }
254 255
255 views::View* CustomFrameViewAsh::header_view() { 256 views::View* CustomFrameViewAsh::header_view() {
256 return header_view_; 257 return header_view_;
257 } 258 }
258 259
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 gfx::Size CustomFrameViewAsh::CalculatePreferredSize() const { 308 gfx::Size CustomFrameViewAsh::CalculatePreferredSize() const {
308 gfx::Size pref = frame_->client_view()->GetPreferredSize(); 309 gfx::Size pref = frame_->client_view()->GetPreferredSize();
309 gfx::Rect bounds(0, 0, pref.width(), pref.height()); 310 gfx::Rect bounds(0, 0, pref.width(), pref.height());
310 return frame_->non_client_view() 311 return frame_->non_client_view()
311 ->GetWindowBoundsForClientBounds(bounds) 312 ->GetWindowBoundsForClientBounds(bounds)
312 .size(); 313 .size();
313 } 314 }
314 315
315 void CustomFrameViewAsh::Layout() { 316 void CustomFrameViewAsh::Layout() {
316 views::NonClientFrameView::Layout(); 317 views::NonClientFrameView::Layout();
317 WmWindow* frame_window = WmWindow::Get(frame_->GetNativeWindow()); 318 aura::Window* frame_window = frame_->GetNativeWindow();
318 frame_window->aura_window()->SetProperty(aura::client::kTopViewInset, 319 frame_window->SetProperty(aura::client::kTopViewInset,
319 NonClientTopBorderHeight()); 320 NonClientTopBorderHeight());
320 } 321 }
321 322
322 const char* CustomFrameViewAsh::GetClassName() const { 323 const char* CustomFrameViewAsh::GetClassName() const {
323 return kViewClassName; 324 return kViewClassName;
324 } 325 }
325 326
326 gfx::Size CustomFrameViewAsh::GetMinimumSize() const { 327 gfx::Size CustomFrameViewAsh::GetMinimumSize() const {
327 if (use_empty_minimum_size_for_test_) 328 if (use_empty_minimum_size_for_test_)
328 return gfx::Size(); 329 return gfx::Size();
329 330
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 FrameCaptionButtonContainerView* 389 FrameCaptionButtonContainerView*
389 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { 390 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() {
390 return header_view_->caption_button_container(); 391 return header_view_->caption_button_container();
391 } 392 }
392 393
393 int CustomFrameViewAsh::NonClientTopBorderHeight() const { 394 int CustomFrameViewAsh::NonClientTopBorderHeight() const {
394 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); 395 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight();
395 } 396 }
396 397
397 } // namespace ash 398 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698