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

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

Issue 2479353003: Revert of Window prerequisites for ShelfWindowWatcher panel support. (Closed)
Patch Set: 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
298 case WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY: 295 case WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY:
299 return window_->GetProperty(kSnapChildrenToPixelBoundary); 296 return window_->GetProperty(kSnapChildrenToPixelBoundary);
300 297
301 case WmWindowProperty::ALWAYS_ON_TOP: 298 case WmWindowProperty::ALWAYS_ON_TOP:
302 return window_->GetProperty(aura::client::kAlwaysOnTopKey); 299 return window_->GetProperty(aura::client::kAlwaysOnTopKey);
303 300
304 case WmWindowProperty::EXCLUDE_FROM_MRU: 301 case WmWindowProperty::EXCLUDE_FROM_MRU:
305 return window_->GetProperty(aura::client::kExcludeFromMruKey); 302 return window_->GetProperty(aura::client::kExcludeFromMruKey);
306 303
307 default: 304 default:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 return; 360 return;
364 } 361 }
365 if (key == WmWindowProperty::TOP_VIEW_INSET) { 362 if (key == WmWindowProperty::TOP_VIEW_INSET) {
366 window_->SetProperty(aura::client::kTopViewInset, value); 363 window_->SetProperty(aura::client::kTopViewInset, value);
367 return; 364 return;
368 } 365 }
369 366
370 NOTREACHED(); 367 NOTREACHED();
371 } 368 }
372 369
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
403 const wm::WindowState* WmWindowAura::GetWindowState() const { 370 const wm::WindowState* WmWindowAura::GetWindowState() const {
404 return ash::wm::GetWindowState(window_); 371 return ash::wm::GetWindowState(window_);
405 } 372 }
406 373
407 WmWindow* WmWindowAura::GetToplevelWindow() { 374 WmWindow* WmWindowAura::GetToplevelWindow() {
408 return Get(window_->GetToplevelWindow()); 375 return Get(window_->GetToplevelWindow());
409 } 376 }
410 377
411 WmWindow* WmWindowAura::GetToplevelWindowForFocus() { 378 WmWindow* WmWindowAura::GetToplevelWindowForFocus() {
412 return Get(::wm::GetToplevelWindow(window_)); 379 return Get(::wm::GetToplevelWindow(window_));
(...skipping 18 matching lines...) Expand all
431 } 398 }
432 399
433 const WmWindow* WmWindowAura::GetTransientParent() const { 400 const WmWindow* WmWindowAura::GetTransientParent() const {
434 return Get(::wm::GetTransientParent(window_)); 401 return Get(::wm::GetTransientParent(window_));
435 } 402 }
436 403
437 std::vector<WmWindow*> WmWindowAura::GetTransientChildren() { 404 std::vector<WmWindow*> WmWindowAura::GetTransientChildren() {
438 return FromAuraWindows(::wm::GetTransientChildren(window_)); 405 return FromAuraWindows(::wm::GetTransientChildren(window_));
439 } 406 }
440 407
441 bool WmWindowAura::MoveToEventRoot(const ui::Event& event) {
442 return ash::wm::MoveWindowToEventRoot(window_, event);
443 }
444
445 void WmWindowAura::SetLayoutManager( 408 void WmWindowAura::SetLayoutManager(
446 std::unique_ptr<WmLayoutManager> layout_manager) { 409 std::unique_ptr<WmLayoutManager> layout_manager) {
447 // See ~AuraLayoutManagerAdapter for why SetLayoutManager(nullptr) is called. 410 // See ~AuraLayoutManagerAdapter for why SetLayoutManager(nullptr) is called.
448 window_->SetLayoutManager(nullptr); 411 window_->SetLayoutManager(nullptr);
449 if (!layout_manager) 412 if (!layout_manager)
450 return; 413 return;
451 414
452 // |window_| takes ownership of AuraLayoutManagerAdapter. 415 // |window_| takes ownership of AuraLayoutManagerAdapter.
453 window_->SetLayoutManager( 416 window_->SetLayoutManager(
454 new AuraLayoutManagerAdapter(window_, std::move(layout_manager))); 417 new AuraLayoutManagerAdapter(window_, std::move(layout_manager)));
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 void WmWindowAura::OnWindowPropertyChanged(aura::Window* window, 832 void WmWindowAura::OnWindowPropertyChanged(aura::Window* window,
870 const void* key, 833 const void* key,
871 intptr_t old) { 834 intptr_t old) {
872 if (key == aura::client::kShowStateKey) { 835 if (key == aura::client::kShowStateKey) {
873 ash::wm::GetWindowState(window_)->OnWindowShowStateChanged(); 836 ash::wm::GetWindowState(window_)->OnWindowShowStateChanged();
874 return; 837 return;
875 } 838 }
876 WmWindowProperty wm_property; 839 WmWindowProperty wm_property;
877 if (key == aura::client::kAlwaysOnTopKey) { 840 if (key == aura::client::kAlwaysOnTopKey) {
878 wm_property = WmWindowProperty::ALWAYS_ON_TOP; 841 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;
883 } else if (key == aura::client::kExcludeFromMruKey) { 842 } else if (key == aura::client::kExcludeFromMruKey) {
884 wm_property = WmWindowProperty::EXCLUDE_FROM_MRU; 843 wm_property = WmWindowProperty::EXCLUDE_FROM_MRU;
885 } else if (key == aura::client::kModalKey) { 844 } else if (key == aura::client::kModalKey) {
886 wm_property = WmWindowProperty::MODAL_TYPE; 845 wm_property = WmWindowProperty::MODAL_TYPE;
887 } else if (key == kShelfIconResourceIdKey) { 846 } else if (key == kShelfIconResourceIdKey) {
888 wm_property = WmWindowProperty::SHELF_ICON_RESOURCE_ID; 847 wm_property = WmWindowProperty::SHELF_ICON_RESOURCE_ID;
889 } else if (key == kShelfIDKey) { 848 } else if (key == kShelfIDKey) {
890 wm_property = WmWindowProperty::SHELF_ID; 849 wm_property = WmWindowProperty::SHELF_ID;
891 } else if (key == kShelfItemTypeKey) { 850 } else if (key == kShelfItemTypeKey) {
892 wm_property = WmWindowProperty::SHELF_ITEM_TYPE; 851 wm_property = WmWindowProperty::SHELF_ITEM_TYPE;
893 } else if (key == kSnapChildrenToPixelBoundary) { 852 } else if (key == kSnapChildrenToPixelBoundary) {
894 wm_property = WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY; 853 wm_property = WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY;
895 } else if (key == aura::client::kTopViewInset) { 854 } else if (key == aura::client::kTopViewInset) {
896 wm_property = WmWindowProperty::TOP_VIEW_INSET; 855 wm_property = WmWindowProperty::TOP_VIEW_INSET;
897 } else if (key == aura::client::kWindowIconKey) {
898 wm_property = WmWindowProperty::WINDOW_ICON;
899 } else { 856 } else {
900 return; 857 return;
901 } 858 }
902 for (auto& observer : observers_) 859 for (auto& observer : observers_)
903 observer.OnWindowPropertyChanged(this, wm_property); 860 observer.OnWindowPropertyChanged(this, wm_property);
904 } 861 }
905 862
906 void WmWindowAura::OnWindowBoundsChanged(aura::Window* window, 863 void WmWindowAura::OnWindowBoundsChanged(aura::Window* window,
907 const gfx::Rect& old_bounds, 864 const gfx::Rect& old_bounds,
908 const gfx::Rect& new_bounds) { 865 const gfx::Rect& new_bounds) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 observer.OnTransientChildAdded(this, Get(transient)); 901 observer.OnTransientChildAdded(this, Get(transient));
945 } 902 }
946 903
947 void WmWindowAura::OnTransientChildRemoved(aura::Window* window, 904 void WmWindowAura::OnTransientChildRemoved(aura::Window* window,
948 aura::Window* transient) { 905 aura::Window* transient) {
949 for (auto& observer : transient_observers_) 906 for (auto& observer : transient_observers_)
950 observer.OnTransientChildRemoved(this, Get(transient)); 907 observer.OnTransientChildRemoved(this, Get(transient));
951 } 908 }
952 909
953 } // namespace ash 910 } // 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