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

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

Issue 2731663002: Remove WmWindowProperty (Closed)
Patch Set: Created 3 years, 9 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/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 "
11 #include "ash/common/frame/frame_border_hit_test.h" 11 #include "ash/common/frame/frame_border_hit_test.h"
12 #include "ash/common/frame/header_view.h" 12 #include "ash/common/frame/header_view.h"
13 #include "ash/common/wm/window_state.h" 13 #include "ash/common/wm/window_state.h"
14 #include "ash/common/wm/window_state_delegate.h" 14 #include "ash/common/wm/window_state_delegate.h"
15 #include "ash/common/wm/window_state_observer.h" 15 #include "ash/common/wm/window_state_observer.h"
16 #include "ash/common/wm_lookup.h" 16 #include "ash/common/wm_lookup.h"
17 #include "ash/common/wm_shell.h" 17 #include "ash/common/wm_shell.h"
18 #include "ash/common/wm_window.h" 18 #include "ash/common/wm_window.h"
19 #include "ash/common/wm_window_property.h"
20 #include "ash/shared/immersive_fullscreen_controller.h" 19 #include "ash/shared/immersive_fullscreen_controller.h"
21 #include "ash/shared/immersive_fullscreen_controller_delegate.h" 20 #include "ash/shared/immersive_fullscreen_controller_delegate.h"
21 #include "ui/aura/client/aura_constants.h"
22 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
23 #include "ui/aura/window_observer.h" 23 #include "ui/aura/window_observer.h"
24 #include "ui/gfx/geometry/rect.h" 24 #include "ui/gfx/geometry/rect.h"
25 #include "ui/gfx/geometry/rect_conversions.h" 25 #include "ui/gfx/geometry/rect_conversions.h"
26 #include "ui/gfx/geometry/size.h" 26 #include "ui/gfx/geometry/size.h"
27 #include "ui/views/view.h" 27 #include "ui/views/view.h"
28 #include "ui/views/view_targeter.h" 28 #include "ui/views/view_targeter.h"
29 #include "ui/views/widget/widget.h" 29 #include "ui/views/widget/widget.h"
30 #include "ui/views/widget/widget_delegate.h" 30 #include "ui/views/widget/widget_delegate.h"
31 31
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, 199 frame_window->aura_window()->SetProperty(
200 header_view_->GetInactiveFrameColor()); 200 aura::client::kTopViewColor, header_view_->GetInactiveFrameColor());
201 201
202 // 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
203 // be set. This is the case for packaged apps. 203 // be set. This is the case for packaged apps.
204 wm::WindowState* window_state = frame_window->GetWindowState(); 204 wm::WindowState* window_state = frame_window->GetWindowState();
205 if (!window_state->HasDelegate()) { 205 if (!window_state->HasDelegate()) {
206 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>( 206 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>(
207 new CustomFrameViewAshWindowStateDelegate(window_state, this, 207 new CustomFrameViewAshWindowStateDelegate(window_state, this,
208 enable_immersive))); 208 enable_immersive)));
209 } 209 }
210 } 210 }
211 211
212 CustomFrameViewAsh::~CustomFrameViewAsh() {} 212 CustomFrameViewAsh::~CustomFrameViewAsh() {}
213 213
214 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( 214 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView(
215 ImmersiveFullscreenController* immersive_fullscreen_controller) { 215 ImmersiveFullscreenController* immersive_fullscreen_controller) {
216 immersive_fullscreen_controller->Init(immersive_delegate_, frame_, 216 immersive_fullscreen_controller->Init(immersive_delegate_, frame_,
217 header_view_); 217 header_view_);
218 } 218 }
219 219
220 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color, 220 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color,
221 SkColor inactive_frame_color) { 221 SkColor inactive_frame_color) {
222 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_); 223 WmWindow* frame_window = WmLookup::Get()->GetWindowForWidget(frame_);
224 frame_window->SetColorProperty(WmWindowProperty::TOP_VIEW_COLOR, 224 frame_window->aura_window()->SetProperty(
225 header_view_->GetInactiveFrameColor()); 225 aura::client::kTopViewColor, header_view_->GetInactiveFrameColor());
226 } 226 }
227 227
228 //////////////////////////////////////////////////////////////////////////////// 228 ////////////////////////////////////////////////////////////////////////////////
229 // CustomFrameViewAsh, views::NonClientFrameView overrides: 229 // CustomFrameViewAsh, views::NonClientFrameView overrides:
230 230
231 gfx::Rect CustomFrameViewAsh::GetBoundsForClientView() const { 231 gfx::Rect CustomFrameViewAsh::GetBoundsForClientView() const {
232 gfx::Rect client_bounds = bounds(); 232 gfx::Rect client_bounds = bounds();
233 client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0); 233 client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0);
234 return client_bounds; 234 return client_bounds;
235 } 235 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 gfx::Size pref = frame_->client_view()->GetPreferredSize(); 277 gfx::Size pref = frame_->client_view()->GetPreferredSize();
278 gfx::Rect bounds(0, 0, pref.width(), pref.height()); 278 gfx::Rect bounds(0, 0, pref.width(), pref.height());
279 return frame_->non_client_view() 279 return frame_->non_client_view()
280 ->GetWindowBoundsForClientBounds(bounds) 280 ->GetWindowBoundsForClientBounds(bounds)
281 .size(); 281 .size();
282 } 282 }
283 283
284 void CustomFrameViewAsh::Layout() { 284 void CustomFrameViewAsh::Layout() {
285 views::NonClientFrameView::Layout(); 285 views::NonClientFrameView::Layout();
286 WmWindow* frame_window = WmLookup::Get()->GetWindowForWidget(frame_); 286 WmWindow* frame_window = WmLookup::Get()->GetWindowForWidget(frame_);
287 frame_window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, 287 frame_window->aura_window()->SetProperty(aura::client::kTopViewInset,
288 NonClientTopBorderHeight()); 288 NonClientTopBorderHeight());
289 } 289 }
290 290
291 const char* CustomFrameViewAsh::GetClassName() const { 291 const char* CustomFrameViewAsh::GetClassName() const {
292 return kViewClassName; 292 return kViewClassName;
293 } 293 }
294 294
295 gfx::Size CustomFrameViewAsh::GetMinimumSize() const { 295 gfx::Size CustomFrameViewAsh::GetMinimumSize() const {
296 gfx::Size min_client_view_size(frame_->client_view()->GetMinimumSize()); 296 gfx::Size min_client_view_size(frame_->client_view()->GetMinimumSize());
297 return gfx::Size( 297 return gfx::Size(
298 std::max(header_view_->GetMinimumWidth(), min_client_view_size.width()), 298 std::max(header_view_->GetMinimumWidth(), min_client_view_size.width()),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 FrameCaptionButtonContainerView* 354 FrameCaptionButtonContainerView*
355 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { 355 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() {
356 return header_view_->caption_button_container(); 356 return header_view_->caption_button_container();
357 } 357 }
358 358
359 int CustomFrameViewAsh::NonClientTopBorderHeight() const { 359 int CustomFrameViewAsh::NonClientTopBorderHeight() const {
360 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); 360 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight();
361 } 361 }
362 362
363 } // namespace ash 363 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698