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

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

Issue 2731663002: Remove WmWindowProperty (Closed)
Patch Set: rebase 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
« no previous file with comments | « ash/common/accelerators/debug_commands.cc ('k') | ash/common/shelf/shelf_widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_shell.h" 16 #include "ash/common/wm_shell.h"
17 #include "ash/common/wm_window.h" 17 #include "ash/common/wm_window.h"
18 #include "ash/common/wm_window_property.h"
19 #include "ash/shared/immersive_fullscreen_controller.h" 18 #include "ash/shared/immersive_fullscreen_controller.h"
20 #include "ash/shared/immersive_fullscreen_controller_delegate.h" 19 #include "ash/shared/immersive_fullscreen_controller_delegate.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"
30 30
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = WmWindow::Get(frame->GetNativeWindow()); 193 WmWindow* frame_window = WmWindow::Get(frame->GetNativeWindow());
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, 198 frame_window->aura_window()->SetProperty(
199 header_view_->GetInactiveFrameColor()); 199 aura::client::kTopViewColor, header_view_->GetInactiveFrameColor());
200 200
201 // 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
202 // be set. This is the case for packaged apps. 202 // be set. This is the case for packaged apps.
203 wm::WindowState* window_state = frame_window->GetWindowState(); 203 wm::WindowState* window_state = frame_window->GetWindowState();
204 if (!window_state->HasDelegate()) { 204 if (!window_state->HasDelegate()) {
205 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>( 205 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>(
206 new CustomFrameViewAshWindowStateDelegate(window_state, this, 206 new CustomFrameViewAshWindowStateDelegate(window_state, this,
207 enable_immersive))); 207 enable_immersive)));
208 } 208 }
209 } 209 }
210 210
211 CustomFrameViewAsh::~CustomFrameViewAsh() {} 211 CustomFrameViewAsh::~CustomFrameViewAsh() {}
212 212
213 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( 213 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView(
214 ImmersiveFullscreenController* immersive_fullscreen_controller) { 214 ImmersiveFullscreenController* immersive_fullscreen_controller) {
215 immersive_fullscreen_controller->Init(immersive_delegate_, frame_, 215 immersive_fullscreen_controller->Init(immersive_delegate_, frame_,
216 header_view_); 216 header_view_);
217 } 217 }
218 218
219 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color, 219 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color,
220 SkColor inactive_frame_color) { 220 SkColor inactive_frame_color) {
221 header_view_->SetFrameColors(active_frame_color, inactive_frame_color); 221 header_view_->SetFrameColors(active_frame_color, inactive_frame_color);
222 WmWindow* frame_window = WmWindow::Get(frame_->GetNativeWindow()); 222 WmWindow* frame_window = WmWindow::Get(frame_->GetNativeWindow());
223 frame_window->SetColorProperty(WmWindowProperty::TOP_VIEW_COLOR, 223 frame_window->aura_window()->SetProperty(
224 header_view_->GetInactiveFrameColor()); 224 aura::client::kTopViewColor, header_view_->GetInactiveFrameColor());
225 } 225 }
226 226
227 //////////////////////////////////////////////////////////////////////////////// 227 ////////////////////////////////////////////////////////////////////////////////
228 // CustomFrameViewAsh, views::NonClientFrameView overrides: 228 // CustomFrameViewAsh, views::NonClientFrameView overrides:
229 229
230 gfx::Rect CustomFrameViewAsh::GetBoundsForClientView() const { 230 gfx::Rect CustomFrameViewAsh::GetBoundsForClientView() const {
231 gfx::Rect client_bounds = bounds(); 231 gfx::Rect client_bounds = bounds();
232 client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0); 232 client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0);
233 return client_bounds; 233 return client_bounds;
234 } 234 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 gfx::Size pref = frame_->client_view()->GetPreferredSize(); 276 gfx::Size pref = frame_->client_view()->GetPreferredSize();
277 gfx::Rect bounds(0, 0, pref.width(), pref.height()); 277 gfx::Rect bounds(0, 0, pref.width(), pref.height());
278 return frame_->non_client_view() 278 return frame_->non_client_view()
279 ->GetWindowBoundsForClientBounds(bounds) 279 ->GetWindowBoundsForClientBounds(bounds)
280 .size(); 280 .size();
281 } 281 }
282 282
283 void CustomFrameViewAsh::Layout() { 283 void CustomFrameViewAsh::Layout() {
284 views::NonClientFrameView::Layout(); 284 views::NonClientFrameView::Layout();
285 WmWindow* frame_window = WmWindow::Get(frame_->GetNativeWindow()); 285 WmWindow* frame_window = WmWindow::Get(frame_->GetNativeWindow());
286 frame_window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, 286 frame_window->aura_window()->SetProperty(aura::client::kTopViewInset,
287 NonClientTopBorderHeight()); 287 NonClientTopBorderHeight());
288 } 288 }
289 289
290 const char* CustomFrameViewAsh::GetClassName() const { 290 const char* CustomFrameViewAsh::GetClassName() const {
291 return kViewClassName; 291 return kViewClassName;
292 } 292 }
293 293
294 gfx::Size CustomFrameViewAsh::GetMinimumSize() const { 294 gfx::Size CustomFrameViewAsh::GetMinimumSize() const {
295 gfx::Size min_client_view_size(frame_->client_view()->GetMinimumSize()); 295 gfx::Size min_client_view_size(frame_->client_view()->GetMinimumSize());
296 return gfx::Size( 296 return gfx::Size(
297 std::max(header_view_->GetMinimumWidth(), min_client_view_size.width()), 297 std::max(header_view_->GetMinimumWidth(), min_client_view_size.width()),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 FrameCaptionButtonContainerView* 353 FrameCaptionButtonContainerView*
354 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { 354 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() {
355 return header_view_->caption_button_container(); 355 return header_view_->caption_button_container();
356 } 356 }
357 357
358 int CustomFrameViewAsh::NonClientTopBorderHeight() const { 358 int CustomFrameViewAsh::NonClientTopBorderHeight() const {
359 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); 359 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight();
360 } 360 }
361 361
362 } // namespace ash 362 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/accelerators/debug_commands.cc ('k') | ash/common/shelf/shelf_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698