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

Side by Side Diff: ash/aura/wm_window_aura.cc

Issue 2480713003: Window prerequisites for ShelfWindowWatcher panel support. (Closed)
Patch Set: Support and test pre-widget exo ShellSurface::SetApplicationId. Created 4 years, 1 month 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/aura/wm_window_aura.h ('k') | ash/common/test/test_shelf_item_delegate.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 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/aura/wm_window_aura.h" 5 #include "ash/aura/wm_window_aura.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_root_window_controller_aura.h" 8 #include "ash/aura/wm_root_window_controller_aura.h"
9 #include "ash/aura/wm_shell_aura.h" 9 #include "ash/aura/wm_shell_aura.h"
10 #include "ash/common/ash_constants.h" 10 #include "ash/common/ash_constants.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 gfx::Transform WmWindowAura::GetTargetTransform() const { 285 gfx::Transform WmWindowAura::GetTargetTransform() const {
286 return window_->layer()->GetTargetTransform(); 286 return window_->layer()->GetTargetTransform();
287 } 287 }
288 288
289 bool WmWindowAura::IsSystemModal() const { 289 bool WmWindowAura::IsSystemModal() const {
290 return window_->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM; 290 return window_->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM;
291 } 291 }
292 292
293 bool WmWindowAura::GetBoolProperty(WmWindowProperty key) { 293 bool WmWindowAura::GetBoolProperty(WmWindowProperty key) {
294 switch (key) { 294 switch (key) {
295 case WmWindowProperty::DRAW_ATTENTION:
296 return window_->GetProperty(aura::client::kDrawAttentionKey);
297
295 case WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY: 298 case WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY:
296 return window_->GetProperty(kSnapChildrenToPixelBoundary); 299 return window_->GetProperty(kSnapChildrenToPixelBoundary);
297 300
298 case WmWindowProperty::ALWAYS_ON_TOP: 301 case WmWindowProperty::ALWAYS_ON_TOP:
299 return window_->GetProperty(aura::client::kAlwaysOnTopKey); 302 return window_->GetProperty(aura::client::kAlwaysOnTopKey);
300 303
301 case WmWindowProperty::EXCLUDE_FROM_MRU: 304 case WmWindowProperty::EXCLUDE_FROM_MRU:
302 return window_->GetProperty(aura::client::kExcludeFromMruKey); 305 return window_->GetProperty(aura::client::kExcludeFromMruKey);
303 306
304 default: 307 default:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 return; 363 return;
361 } 364 }
362 if (key == WmWindowProperty::TOP_VIEW_INSET) { 365 if (key == WmWindowProperty::TOP_VIEW_INSET) {
363 window_->SetProperty(aura::client::kTopViewInset, value); 366 window_->SetProperty(aura::client::kTopViewInset, value);
364 return; 367 return;
365 } 368 }
366 369
367 NOTREACHED(); 370 NOTREACHED();
368 } 371 }
369 372
373 std::string WmWindowAura::GetStringProperty(WmWindowProperty key) {
374 if (key == WmWindowProperty::APP_ID) {
375 std::string* value = window_->GetProperty(aura::client::kAppIdKey);
376 return value ? *value : std::string();
377 }
378
379 NOTREACHED();
380 return std::string();
381 }
382
383 void WmWindowAura::SetStringProperty(WmWindowProperty key,
384 const std::string& value) {
385 if (key == WmWindowProperty::APP_ID) {
386 window_->SetProperty(aura::client::kAppIdKey, new std::string(value));
387 return;
388 }
389
390 NOTREACHED();
391 }
392
393 gfx::ImageSkia WmWindowAura::GetWindowIcon() {
394 gfx::ImageSkia* image = window_->GetProperty(aura::client::kWindowIconKey);
395 return image ? *image : gfx::ImageSkia();
396 }
397
398 gfx::ImageSkia WmWindowAura::GetAppIcon() {
399 gfx::ImageSkia* image = window_->GetProperty(aura::client::kAppIconKey);
400 return image ? *image : gfx::ImageSkia();
401 }
402
370 const wm::WindowState* WmWindowAura::GetWindowState() const { 403 const wm::WindowState* WmWindowAura::GetWindowState() const {
371 return ash::wm::GetWindowState(window_); 404 return ash::wm::GetWindowState(window_);
372 } 405 }
373 406
374 WmWindow* WmWindowAura::GetToplevelWindow() { 407 WmWindow* WmWindowAura::GetToplevelWindow() {
375 return Get(window_->GetToplevelWindow()); 408 return Get(window_->GetToplevelWindow());
376 } 409 }
377 410
378 WmWindow* WmWindowAura::GetToplevelWindowForFocus() { 411 WmWindow* WmWindowAura::GetToplevelWindowForFocus() {
379 return Get(::wm::GetToplevelWindow(window_)); 412 return Get(::wm::GetToplevelWindow(window_));
(...skipping 18 matching lines...) Expand all
398 } 431 }
399 432
400 const WmWindow* WmWindowAura::GetTransientParent() const { 433 const WmWindow* WmWindowAura::GetTransientParent() const {
401 return Get(::wm::GetTransientParent(window_)); 434 return Get(::wm::GetTransientParent(window_));
402 } 435 }
403 436
404 std::vector<WmWindow*> WmWindowAura::GetTransientChildren() { 437 std::vector<WmWindow*> WmWindowAura::GetTransientChildren() {
405 return FromAuraWindows(::wm::GetTransientChildren(window_)); 438 return FromAuraWindows(::wm::GetTransientChildren(window_));
406 } 439 }
407 440
441 bool WmWindowAura::MoveToEventRoot(const ui::Event& event) {
442 return ash::wm::MoveWindowToEventRoot(window_, event);
443 }
444
408 void WmWindowAura::SetLayoutManager( 445 void WmWindowAura::SetLayoutManager(
409 std::unique_ptr<WmLayoutManager> layout_manager) { 446 std::unique_ptr<WmLayoutManager> layout_manager) {
410 // See ~AuraLayoutManagerAdapter for why SetLayoutManager(nullptr) is called. 447 // See ~AuraLayoutManagerAdapter for why SetLayoutManager(nullptr) is called.
411 window_->SetLayoutManager(nullptr); 448 window_->SetLayoutManager(nullptr);
412 if (!layout_manager) 449 if (!layout_manager)
413 return; 450 return;
414 451
415 // |window_| takes ownership of AuraLayoutManagerAdapter. 452 // |window_| takes ownership of AuraLayoutManagerAdapter.
416 window_->SetLayoutManager( 453 window_->SetLayoutManager(
417 new AuraLayoutManagerAdapter(window_, std::move(layout_manager))); 454 new AuraLayoutManagerAdapter(window_, std::move(layout_manager)));
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 void WmWindowAura::OnWindowPropertyChanged(aura::Window* window, 869 void WmWindowAura::OnWindowPropertyChanged(aura::Window* window,
833 const void* key, 870 const void* key,
834 intptr_t old) { 871 intptr_t old) {
835 if (key == aura::client::kShowStateKey) { 872 if (key == aura::client::kShowStateKey) {
836 ash::wm::GetWindowState(window_)->OnWindowShowStateChanged(); 873 ash::wm::GetWindowState(window_)->OnWindowShowStateChanged();
837 return; 874 return;
838 } 875 }
839 WmWindowProperty wm_property; 876 WmWindowProperty wm_property;
840 if (key == aura::client::kAlwaysOnTopKey) { 877 if (key == aura::client::kAlwaysOnTopKey) {
841 wm_property = WmWindowProperty::ALWAYS_ON_TOP; 878 wm_property = WmWindowProperty::ALWAYS_ON_TOP;
879 } else if (key == aura::client::kAppIconKey) {
880 wm_property = WmWindowProperty::APP_ICON;
881 } else if (key == aura::client::kDrawAttentionKey) {
882 wm_property = WmWindowProperty::DRAW_ATTENTION;
842 } else if (key == aura::client::kExcludeFromMruKey) { 883 } else if (key == aura::client::kExcludeFromMruKey) {
843 wm_property = WmWindowProperty::EXCLUDE_FROM_MRU; 884 wm_property = WmWindowProperty::EXCLUDE_FROM_MRU;
844 } else if (key == aura::client::kModalKey) { 885 } else if (key == aura::client::kModalKey) {
845 wm_property = WmWindowProperty::MODAL_TYPE; 886 wm_property = WmWindowProperty::MODAL_TYPE;
846 } else if (key == kShelfIconResourceIdKey) { 887 } else if (key == kShelfIconResourceIdKey) {
847 wm_property = WmWindowProperty::SHELF_ICON_RESOURCE_ID; 888 wm_property = WmWindowProperty::SHELF_ICON_RESOURCE_ID;
848 } else if (key == kShelfIDKey) { 889 } else if (key == kShelfIDKey) {
849 wm_property = WmWindowProperty::SHELF_ID; 890 wm_property = WmWindowProperty::SHELF_ID;
850 } else if (key == kShelfItemTypeKey) { 891 } else if (key == kShelfItemTypeKey) {
851 wm_property = WmWindowProperty::SHELF_ITEM_TYPE; 892 wm_property = WmWindowProperty::SHELF_ITEM_TYPE;
852 } else if (key == kSnapChildrenToPixelBoundary) { 893 } else if (key == kSnapChildrenToPixelBoundary) {
853 wm_property = WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY; 894 wm_property = WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY;
854 } else if (key == aura::client::kTopViewInset) { 895 } else if (key == aura::client::kTopViewInset) {
855 wm_property = WmWindowProperty::TOP_VIEW_INSET; 896 wm_property = WmWindowProperty::TOP_VIEW_INSET;
897 } else if (key == aura::client::kWindowIconKey) {
898 wm_property = WmWindowProperty::WINDOW_ICON;
856 } else { 899 } else {
857 return; 900 return;
858 } 901 }
859 for (auto& observer : observers_) 902 for (auto& observer : observers_)
860 observer.OnWindowPropertyChanged(this, wm_property); 903 observer.OnWindowPropertyChanged(this, wm_property);
861 } 904 }
862 905
863 void WmWindowAura::OnWindowBoundsChanged(aura::Window* window, 906 void WmWindowAura::OnWindowBoundsChanged(aura::Window* window,
864 const gfx::Rect& old_bounds, 907 const gfx::Rect& old_bounds,
865 const gfx::Rect& new_bounds) { 908 const gfx::Rect& new_bounds) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 observer.OnTransientChildAdded(this, Get(transient)); 944 observer.OnTransientChildAdded(this, Get(transient));
902 } 945 }
903 946
904 void WmWindowAura::OnTransientChildRemoved(aura::Window* window, 947 void WmWindowAura::OnTransientChildRemoved(aura::Window* window,
905 aura::Window* transient) { 948 aura::Window* transient) {
906 for (auto& observer : transient_observers_) 949 for (auto& observer : transient_observers_)
907 observer.OnTransientChildRemoved(this, Get(transient)); 950 observer.OnTransientChildRemoved(this, Get(transient));
908 } 951 }
909 952
910 } // namespace ash 953 } // namespace ash
OLDNEW
« no previous file with comments | « ash/aura/wm_window_aura.h ('k') | ash/common/test/test_shelf_item_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698