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

Unified Diff: ui/aura/mus/property_converter.cc

Issue 2513753003: Add string16 and name/title support to aura::PropertyConverter. (Closed)
Patch Set: Update failing test to ack all changes as failed. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/mus/property_converter.h ('k') | ui/aura/mus/property_converter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/property_converter.cc
diff --git a/ui/aura/mus/property_converter.cc b/ui/aura/mus/property_converter.cc
index c4122a3f899ef4a94109f78531249ccae85136fe..6837d506e425d91130e572d0c882a4647ebecb31 100644
--- a/ui/aura/mus/property_converter.cc
+++ b/ui/aura/mus/property_converter.cc
@@ -36,8 +36,11 @@ PropertyConverter::PropertyConverter() {
ui::mojom::WindowManager::kAppID_Property);
RegisterProperty(client::kExcludeFromMruKey,
ui::mojom::WindowManager::kExcludeFromMru_Property);
+ RegisterProperty(client::kNameKey, ui::mojom::WindowManager::kName_Property);
RegisterProperty(client::kRestoreBoundsKey,
ui::mojom::WindowManager::kRestoreBounds_Property);
+ RegisterProperty(client::kTitleKey,
+ ui::mojom::WindowManager::kWindowTitle_Property);
}
PropertyConverter::~PropertyConverter() {}
@@ -63,6 +66,12 @@ bool PropertyConverter::ConvertPropertyForTransport(
return true;
}
+ auto string16_key = static_cast<const WindowProperty<base::string16*>*>(key);
+ if (string16_properties_.count(string16_key) > 0) {
+ *transport_value = GetArray(window, string16_key);
+ return true;
+ }
+
// Handle primitive property types generically.
DCHECK_GT(primitive_properties_.count(key), 0u);
// TODO(msw): Using the int64_t accessor is wasteful for smaller types.
@@ -84,6 +93,10 @@ std::string PropertyConverter::GetTransportNameForPropertyKey(const void* key) {
if (string_properties_.count(string_key) > 0)
return string_properties_[string_key];
+ auto string16_key = static_cast<const WindowProperty<base::string16*>*>(key);
+ if (string16_properties_.count(string16_key) > 0)
+ return string16_properties_[string16_key];
+
return std::string();
}
@@ -128,6 +141,15 @@ void PropertyConverter::SetPropertyFromTransportValue(
}
}
+ for (const auto& string16_property : string16_properties_) {
+ if (string16_property.second == transport_name) {
+ // TODO(msw): Validate the data somehow, before trying to convert?
+ const base::string16 value = mojo::ConvertTo<base::string16>(*data);
+ window->SetProperty(string16_property.first, new base::string16(value));
+ return;
+ }
+ }
+
DVLOG(2) << "Unknown mus property name: " << transport_name;
}
@@ -143,4 +165,10 @@ void PropertyConverter::RegisterProperty(
string_properties_[property] = transport_name;
}
+void PropertyConverter::RegisterProperty(
+ const WindowProperty<base::string16*>* property,
+ const char* transport_name) {
+ string16_properties_[property] = transport_name;
+}
+
} // namespace aura
« no previous file with comments | « ui/aura/mus/property_converter.h ('k') | ui/aura/mus/property_converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698