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

Side by Side Diff: mash/wm/property_util.cc

Issue 1848653006: Random wm frame painting fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: override Created 4 years, 8 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 | « mash/wm/property_util.h ('k') | mash/wm/window_manager.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "mash/wm/property_util.h" 5 #include "mash/wm/property_util.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "components/mus/public/cpp/property_type_converters.h" 9 #include "components/mus/public/cpp/property_type_converters.h"
10 #include "components/mus/public/cpp/window_property.h" 10 #include "components/mus/public/cpp/window_property.h"
11 #include "mash/wm/shadow.h" 11 #include "mash/wm/shadow.h"
12 #include "ui/gfx/geometry/rect.h" 12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/geometry/size.h" 13 #include "ui/gfx/geometry/size.h"
14 14
15 namespace mash { 15 namespace mash {
16 namespace wm { 16 namespace wm {
17 namespace { 17 namespace {
18 18
19 MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(Shadow*, kLocalShadowProperty, nullptr); 19 MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(Shadow*, kLocalShadowProperty, nullptr);
20 20
21 } // namespace 21 } // namespace
22 22
23 void SetWindowShowState(mus::Window* window, mus::mojom::ShowState show_state) {
24 window->SetSharedProperty<int32_t>(
25 mus::mojom::WindowManager::kShowState_Property,
26 static_cast<uint32_t>(show_state));
27 }
28
23 mus::mojom::ShowState GetWindowShowState(const mus::Window* window) { 29 mus::mojom::ShowState GetWindowShowState(const mus::Window* window) {
24 if (window->HasSharedProperty( 30 if (window->HasSharedProperty(
25 mus::mojom::WindowManager::kShowState_Property)) { 31 mus::mojom::WindowManager::kShowState_Property)) {
26 return static_cast<mus::mojom::ShowState>( 32 return static_cast<mus::mojom::ShowState>(
27 window->GetSharedProperty<int32_t>( 33 window->GetSharedProperty<int32_t>(
28 mus::mojom::WindowManager::kShowState_Property)); 34 mus::mojom::WindowManager::kShowState_Property));
29 } 35 }
30 return mus::mojom::ShowState::RESTORED; 36 return mus::mojom::ShowState::RESTORED;
31 } 37 }
32 38
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return window->GetSharedProperty<gfx::Rect>( 97 return window->GetSharedProperty<gfx::Rect>(
92 mus::mojom::WindowManager::kRestoreBounds_Property); 98 mus::mojom::WindowManager::kRestoreBounds_Property);
93 } 99 }
94 return gfx::Rect(); 100 return gfx::Rect();
95 } 101 }
96 102
97 void SetShadow(mus::Window* window, Shadow* shadow) { 103 void SetShadow(mus::Window* window, Shadow* shadow) {
98 window->SetLocalProperty(kLocalShadowProperty, shadow); 104 window->SetLocalProperty(kLocalShadowProperty, shadow);
99 } 105 }
100 106
101 Shadow* GetShadow(mus::Window* window) { 107 Shadow* GetShadow(const mus::Window* window) {
102 return window->GetLocalProperty(kLocalShadowProperty); 108 return window->GetLocalProperty(kLocalShadowProperty);
103 } 109 }
104 110
105 mus::mojom::WindowType GetWindowType(mus::Window* window) { 111 mus::mojom::WindowType GetWindowType(const mus::Window* window) {
106 return GetWindowType(window->shared_properties()); 112 if (window->HasSharedProperty(
113 mus::mojom::WindowManager::kWindowType_Property)) {
114 return static_cast<mus::mojom::WindowType>(
115 window->GetSharedProperty<int32_t>(
116 mus::mojom::WindowManager::kWindowType_Property));
117 }
118 return mus::mojom::WindowType::POPUP;
107 } 119 }
108 120
109 mus::mojom::WindowType GetWindowType( 121 mus::mojom::WindowType GetWindowType(
110 const mus::Window::SharedProperties& properties) { 122 const mus::Window::SharedProperties& properties) {
111 const auto iter = 123 const auto iter =
112 properties.find(mus::mojom::WindowManager::kWindowType_Property); 124 properties.find(mus::mojom::WindowManager::kWindowType_Property);
113 if (iter != properties.end()) { 125 if (iter != properties.end()) {
114 return static_cast<mus::mojom::WindowType>( 126 return static_cast<mus::mojom::WindowType>(
115 mojo::ConvertTo<int32_t>(iter->second)); 127 mojo::ConvertTo<int32_t>(iter->second));
116 } 128 }
117 return mus::mojom::WindowType::POPUP; 129 return mus::mojom::WindowType::POPUP;
118 } 130 }
119 131
132 base::string16 GetWindowTitle(const mus::Window* window) {
133 if (!window->HasSharedProperty(
134 mus::mojom::WindowManager::kWindowTitle_Property)) {
135 return base::string16();
136 }
137
138 return window->GetSharedProperty<base::string16>(
139 mus::mojom::WindowManager::kWindowTitle_Property);
140 }
141
120 } // namespace wm 142 } // namespace wm
121 } // namespace mash 143 } // namespace mash
OLDNEW
« no previous file with comments | « mash/wm/property_util.h ('k') | mash/wm/window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698