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

Unified Diff: ui/wm/core/shadow_types.cc

Issue 2702423004: Validate incoming window properties. (Closed)
Patch Set: rebase to tot Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« ui/wm/core/shadow_types.h ('K') | « ui/wm/core/shadow_types.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/shadow_types.cc
diff --git a/ui/wm/core/shadow_types.cc b/ui/wm/core/shadow_types.cc
index bf08bbec57e5b72081f292049f2ed898906fac4c..54c5b8c32a323eaa7a136377a97a98da91274dfd 100644
--- a/ui/wm/core/shadow_types.cc
+++ b/ui/wm/core/shadow_types.cc
@@ -4,12 +4,25 @@
#include "ui/wm/core/shadow_types.h"
+#include "base/callback.h"
#include "ui/base/class_property.h"
DECLARE_EXPORTED_UI_CLASS_PROPERTY_TYPE(WM_EXPORT, ::wm::ShadowElevation);
namespace wm {
+namespace {
+
+bool DoValidateShadowElevation(int32_t i) {
+ return i == int32_t(ShadowElevation::DEFAULT) ||
+ i == int32_t(ShadowElevation::NONE) ||
+ i == int32_t(ShadowElevation::SMALL) ||
+ i == int32_t(ShadowElevation::MEDIUM) ||
+ i == int32_t(ShadowElevation::LARGE);
+}
+
+} // namespace
+
DEFINE_UI_CLASS_PROPERTY_KEY(ShadowElevation,
kShadowElevationKey,
ShadowElevation::DEFAULT);
@@ -18,4 +31,8 @@ void SetShadowElevation(aura::Window* window, ShadowElevation elevation) {
window->SetProperty(kShadowElevationKey, elevation);
}
+base::RepeatingCallback<bool(int32_t)> ValidateShadowElevation() {
+ return base::Bind(&DoValidateShadowElevation);
+}
+
} // namespace wm
« ui/wm/core/shadow_types.h ('K') | « ui/wm/core/shadow_types.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698