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

Side by Side Diff: ash/common/wm_window.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/wm_window.h ('k') | ash/common/wm_window_property.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/wm_window.h" 5 #include "ash/common/wm_window.h"
6 6
7 #include "ash/aura/aura_layout_manager_adapter.h" 7 #include "ash/aura/aura_layout_manager_adapter.h"
8 #include "ash/aura/wm_shell_aura.h" 8 #include "ash/aura/wm_shell_aura.h"
9 #include "ash/common/ash_constants.h" 9 #include "ash/common/ash_constants.h"
10 #include "ash/common/shelf/shelf_item_types.h" 10 #include "ash/common/shelf/shelf_item_types.h"
11 #include "ash/common/wm/window_state.h" 11 #include "ash/common/wm/window_state.h"
12 #include "ash/common/wm_layout_manager.h" 12 #include "ash/common/wm_layout_manager.h"
13 #include "ash/common/wm_transient_window_observer.h" 13 #include "ash/common/wm_transient_window_observer.h"
14 #include "ash/common/wm_window_property.h"
15 #include "ash/public/cpp/shell_window_ids.h" 14 #include "ash/public/cpp/shell_window_ids.h"
16 #include "ash/public/cpp/window_properties.h" 15 #include "ash/public/cpp/window_properties.h"
17 #include "ash/root_window_controller.h" 16 #include "ash/root_window_controller.h"
18 #include "ash/shell.h" 17 #include "ash/shell.h"
19 #include "ash/wm/resize_handle_window_targeter.h" 18 #include "ash/wm/resize_handle_window_targeter.h"
20 #include "ash/wm/resize_shadow_controller.h" 19 #include "ash/wm/resize_shadow_controller.h"
21 #include "ash/wm/window_animations.h" 20 #include "ash/wm/window_animations.h"
22 #include "ash/wm/window_mirror_view.h" 21 #include "ash/wm/window_mirror_view.h"
23 #include "ash/wm/window_properties.h" 22 #include "ash/wm/window_properties.h"
24 #include "ash/wm/window_state_aura.h" 23 #include "ash/wm/window_state_aura.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 289 }
291 290
292 gfx::Transform WmWindow::GetTargetTransform() const { 291 gfx::Transform WmWindow::GetTargetTransform() const {
293 return window_->layer()->GetTargetTransform(); 292 return window_->layer()->GetTargetTransform();
294 } 293 }
295 294
296 bool WmWindow::IsSystemModal() const { 295 bool WmWindow::IsSystemModal() const {
297 return window_->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM; 296 return window_->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM;
298 } 297 }
299 298
300 bool WmWindow::GetBoolProperty(WmWindowProperty key) {
301 switch (key) {
302 case WmWindowProperty::DRAW_ATTENTION:
303 return window_->GetProperty(aura::client::kDrawAttentionKey);
304
305 case WmWindowProperty::PANEL_ATTACHED:
306 return window_->GetProperty(kPanelAttachedKey);
307
308 case WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY:
309 return window_->GetProperty(kSnapChildrenToPixelBoundary);
310
311 case WmWindowProperty::ALWAYS_ON_TOP:
312 return window_->GetProperty(aura::client::kAlwaysOnTopKey);
313
314 default:
315 NOTREACHED();
316 break;
317 }
318
319 return false;
320 }
321
322 void WmWindow::SetBoolProperty(WmWindowProperty key, bool value) {
323 switch (key) {
324 case WmWindowProperty::PANEL_ATTACHED:
325 window_->SetProperty(kPanelAttachedKey, value);
326 break;
327 default:
328 NOTREACHED();
329 break;
330 }
331 }
332
333 SkColor WmWindow::GetColorProperty(WmWindowProperty key) {
334 if (key == WmWindowProperty::TOP_VIEW_COLOR)
335 return window_->GetProperty(aura::client::kTopViewColor);
336
337 NOTREACHED();
338 return 0;
339 }
340
341 void WmWindow::SetColorProperty(WmWindowProperty key, SkColor value) {
342 if (key == WmWindowProperty::TOP_VIEW_COLOR) {
343 window_->SetProperty(aura::client::kTopViewColor, value);
344 return;
345 }
346
347 NOTREACHED();
348 }
349
350 int WmWindow::GetIntProperty(WmWindowProperty key) {
351 if (key == WmWindowProperty::MODAL_TYPE)
352 return window_->GetProperty(aura::client::kModalKey);
353
354 if (key == WmWindowProperty::SHELF_ID)
355 return window_->GetProperty(kShelfIDKey);
356
357 if (key == WmWindowProperty::SHELF_ITEM_TYPE) {
358 if (aura::Env::GetInstance()->mode() == aura::Env::Mode::LOCAL ||
359 window_->GetProperty(kShelfItemTypeKey) != TYPE_UNDEFINED) {
360 return window_->GetProperty(kShelfItemTypeKey);
361 }
362 // Mash provides a default shelf item type for non-ignored windows.
363 return GetWindowState()->ignored_by_shelf() ? TYPE_UNDEFINED : TYPE_APP;
364 }
365
366 if (key == WmWindowProperty::TOP_VIEW_INSET)
367 return window_->GetProperty(aura::client::kTopViewInset);
368
369 NOTREACHED();
370 return 0;
371 }
372
373 void WmWindow::SetIntProperty(WmWindowProperty key, int value) {
374 if (key == WmWindowProperty::SHELF_ID) {
375 window_->SetProperty(kShelfIDKey, value);
376 return;
377 }
378 if (key == WmWindowProperty::SHELF_ITEM_TYPE) {
379 window_->SetProperty(kShelfItemTypeKey, value);
380 return;
381 }
382 if (key == WmWindowProperty::TOP_VIEW_INSET) {
383 window_->SetProperty(aura::client::kTopViewInset, value);
384 return;
385 }
386
387 NOTREACHED();
388 }
389
390 std::string WmWindow::GetStringProperty(WmWindowProperty key) {
391 if (key == WmWindowProperty::APP_ID) {
392 std::string* value = window_->GetProperty(aura::client::kAppIdKey);
393 return value ? *value : std::string();
394 }
395
396 NOTREACHED();
397 return std::string();
398 }
399
400 void WmWindow::SetStringProperty(WmWindowProperty key,
401 const std::string& value) {
402 if (key == WmWindowProperty::APP_ID) {
403 window_->SetProperty(aura::client::kAppIdKey, new std::string(value));
404 return;
405 }
406
407 NOTREACHED();
408 }
409
410 gfx::ImageSkia WmWindow::GetWindowIcon() {
411 gfx::ImageSkia* image = window_->GetProperty(aura::client::kWindowIconKey);
412 return image ? *image : gfx::ImageSkia();
413 }
414
415 gfx::ImageSkia WmWindow::GetAppIcon() {
416 gfx::ImageSkia* image = window_->GetProperty(aura::client::kAppIconKey);
417 return image ? *image : gfx::ImageSkia();
418 }
419
420 const wm::WindowState* WmWindow::GetWindowState() const { 299 const wm::WindowState* WmWindow::GetWindowState() const {
421 return ash::wm::GetWindowState(window_); 300 return ash::wm::GetWindowState(window_);
422 } 301 }
423 302
424 WmWindow* WmWindow::GetToplevelWindow() { 303 WmWindow* WmWindow::GetToplevelWindow() {
425 return Get(window_->GetToplevelWindow()); 304 return Get(window_->GetToplevelWindow());
426 } 305 }
427 306
428 WmWindow* WmWindow::GetToplevelWindowForFocus() { 307 WmWindow* WmWindow::GetToplevelWindowForFocus() {
429 return Get(::wm::GetToplevelWindow(window_)); 308 return Get(::wm::GetToplevelWindow(window_));
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 observer.OnTransientChildAdded(this, Get(transient)); 796 observer.OnTransientChildAdded(this, Get(transient));
918 } 797 }
919 798
920 void WmWindow::OnTransientChildRemoved(aura::Window* window, 799 void WmWindow::OnTransientChildRemoved(aura::Window* window,
921 aura::Window* transient) { 800 aura::Window* transient) {
922 for (auto& observer : transient_observers_) 801 for (auto& observer : transient_observers_)
923 observer.OnTransientChildRemoved(this, Get(transient)); 802 observer.OnTransientChildRemoved(this, Get(transient));
924 } 803 }
925 804
926 } // namespace ash 805 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm_window.h ('k') | ash/common/wm_window_property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698