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

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

Issue 2726823003: Remove WmLookup. (Closed)
Patch Set: Clean up include and modify comment. 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"
17 #include "ash/common/wm_shell.h" 16 #include "ash/common/wm_shell.h"
18 #include "ash/common/wm_window.h" 17 #include "ash/common/wm_window.h"
19 #include "ash/common/wm_window_property.h" 18 #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"
22 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
23 #include "ui/aura/window_observer.h" 22 #include "ui/aura/window_observer.h"
24 #include "ui/gfx/geometry/rect.h" 23 #include "ui/gfx/geometry/rect.h"
25 #include "ui/gfx/geometry/rect_conversions.h" 24 #include "ui/gfx/geometry/rect_conversions.h"
26 #include "ui/gfx/geometry/size.h" 25 #include "ui/gfx/geometry/size.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 const char CustomFrameViewAsh::kViewClassName[] = "CustomFrameViewAsh"; 183 const char CustomFrameViewAsh::kViewClassName[] = "CustomFrameViewAsh";
185 184
186 CustomFrameViewAsh::CustomFrameViewAsh( 185 CustomFrameViewAsh::CustomFrameViewAsh(
187 views::Widget* frame, 186 views::Widget* frame,
188 ImmersiveFullscreenControllerDelegate* immersive_delegate, 187 ImmersiveFullscreenControllerDelegate* immersive_delegate,
189 bool enable_immersive) 188 bool enable_immersive)
190 : frame_(frame), 189 : frame_(frame),
191 header_view_(new HeaderView(frame)), 190 header_view_(new HeaderView(frame)),
192 immersive_delegate_(immersive_delegate ? immersive_delegate 191 immersive_delegate_(immersive_delegate ? immersive_delegate
193 : header_view_) { 192 : header_view_) {
194 WmWindow* frame_window = WmLookup::Get()->GetWindowForWidget(frame); 193 WmWindow* frame_window = WmWindow::Get(frame->GetNativeWindow());
195 frame_window->InstallResizeHandleWindowTargeter(nullptr); 194 frame_window->InstallResizeHandleWindowTargeter(nullptr);
196 // |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
197 // overlay the web contents in immersive fullscreen. 196 // overlay the web contents in immersive fullscreen.
198 frame->non_client_view()->SetOverlayView(new OverlayView(header_view_)); 197 frame->non_client_view()->SetOverlayView(new OverlayView(header_view_));
199 frame_window->SetColorProperty(WmWindowProperty::TOP_VIEW_COLOR, 198 frame_window->SetColorProperty(WmWindowProperty::TOP_VIEW_COLOR,
200 header_view_->GetInactiveFrameColor()); 199 header_view_->GetInactiveFrameColor());
201 200
202 // 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
203 // be set. This is the case for packaged apps. 202 // be set. This is the case for packaged apps.
204 wm::WindowState* window_state = frame_window->GetWindowState(); 203 wm::WindowState* window_state = frame_window->GetWindowState();
205 if (!window_state->HasDelegate()) { 204 if (!window_state->HasDelegate()) {
206 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>( 205 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>(
207 new CustomFrameViewAshWindowStateDelegate(window_state, this, 206 new CustomFrameViewAshWindowStateDelegate(window_state, this,
208 enable_immersive))); 207 enable_immersive)));
209 } 208 }
210 } 209 }
211 210
212 CustomFrameViewAsh::~CustomFrameViewAsh() {} 211 CustomFrameViewAsh::~CustomFrameViewAsh() {}
213 212
214 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( 213 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView(
215 ImmersiveFullscreenController* immersive_fullscreen_controller) { 214 ImmersiveFullscreenController* immersive_fullscreen_controller) {
216 immersive_fullscreen_controller->Init(immersive_delegate_, frame_, 215 immersive_fullscreen_controller->Init(immersive_delegate_, frame_,
217 header_view_); 216 header_view_);
218 } 217 }
219 218
220 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color, 219 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color,
221 SkColor inactive_frame_color) { 220 SkColor inactive_frame_color) {
222 header_view_->SetFrameColors(active_frame_color, inactive_frame_color); 221 header_view_->SetFrameColors(active_frame_color, inactive_frame_color);
223 WmWindow* frame_window = WmLookup::Get()->GetWindowForWidget(frame_); 222 WmWindow* frame_window = WmWindow::Get(frame_->GetNativeWindow());
224 frame_window->SetColorProperty(WmWindowProperty::TOP_VIEW_COLOR, 223 frame_window->SetColorProperty(WmWindowProperty::TOP_VIEW_COLOR,
225 header_view_->GetInactiveFrameColor()); 224 header_view_->GetInactiveFrameColor());
226 } 225 }
227 226
228 //////////////////////////////////////////////////////////////////////////////// 227 ////////////////////////////////////////////////////////////////////////////////
229 // CustomFrameViewAsh, views::NonClientFrameView overrides: 228 // CustomFrameViewAsh, views::NonClientFrameView overrides:
230 229
231 gfx::Rect CustomFrameViewAsh::GetBoundsForClientView() const { 230 gfx::Rect CustomFrameViewAsh::GetBoundsForClientView() const {
232 gfx::Rect client_bounds = bounds(); 231 gfx::Rect client_bounds = bounds();
233 client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0); 232 client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 gfx::Size CustomFrameViewAsh::GetPreferredSize() const { 275 gfx::Size CustomFrameViewAsh::GetPreferredSize() const {
277 gfx::Size pref = frame_->client_view()->GetPreferredSize(); 276 gfx::Size pref = frame_->client_view()->GetPreferredSize();
278 gfx::Rect bounds(0, 0, pref.width(), pref.height()); 277 gfx::Rect bounds(0, 0, pref.width(), pref.height());
279 return frame_->non_client_view() 278 return frame_->non_client_view()
280 ->GetWindowBoundsForClientBounds(bounds) 279 ->GetWindowBoundsForClientBounds(bounds)
281 .size(); 280 .size();
282 } 281 }
283 282
284 void CustomFrameViewAsh::Layout() { 283 void CustomFrameViewAsh::Layout() {
285 views::NonClientFrameView::Layout(); 284 views::NonClientFrameView::Layout();
286 WmWindow* frame_window = WmLookup::Get()->GetWindowForWidget(frame_); 285 WmWindow* frame_window = WmWindow::Get(frame_->GetNativeWindow());
287 frame_window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, 286 frame_window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET,
288 NonClientTopBorderHeight()); 287 NonClientTopBorderHeight());
289 } 288 }
290 289
291 const char* CustomFrameViewAsh::GetClassName() const { 290 const char* CustomFrameViewAsh::GetClassName() const {
292 return kViewClassName; 291 return kViewClassName;
293 } 292 }
294 293
295 gfx::Size CustomFrameViewAsh::GetMinimumSize() const { 294 gfx::Size CustomFrameViewAsh::GetMinimumSize() const {
296 gfx::Size min_client_view_size(frame_->client_view()->GetMinimumSize()); 295 gfx::Size min_client_view_size(frame_->client_view()->GetMinimumSize());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 FrameCaptionButtonContainerView* 353 FrameCaptionButtonContainerView*
355 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() { 354 CustomFrameViewAsh::GetFrameCaptionButtonContainerViewForTest() {
356 return header_view_->caption_button_container(); 355 return header_view_->caption_button_container();
357 } 356 }
358 357
359 int CustomFrameViewAsh::NonClientTopBorderHeight() const { 358 int CustomFrameViewAsh::NonClientTopBorderHeight() const {
360 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); 359 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight();
361 } 360 }
362 361
363 } // namespace ash 362 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/frame/caption_buttons/frame_size_button.cc ('k') | ash/common/frame/header_painter_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698