Index: chrome/browser/android/vr_shell/ui_scene.cc |
diff --git a/chrome/browser/android/vr_shell/ui_scene.cc b/chrome/browser/android/vr_shell/ui_scene.cc |
index eaba9e7346a49480d251651dc7f897d660626daa..3aabca979282ff43964dc2f1def7087c1c57a32f 100644 |
--- a/chrome/browser/android/vr_shell/ui_scene.cc |
+++ b/chrome/browser/android/vr_shell/ui_scene.cc |
@@ -390,6 +390,75 @@ bool UiScene::GetWebVrRenderingEnabled() const { |
return webvr_rendering_enabled_; |
} |
+std::unique_ptr<base::DictionaryValue> UiScene::CreateUiElementInfo( |
+ int element_id) { |
+ auto result = base::MakeUnique<base::DictionaryValue>(); |
+ const ContentRectangle* element = GetUiElementById(element_id); |
+ CHECK_NE(element, nullptr); |
+ |
+ result->SetBoolean("isVisible", element->IsVisible()); |
+ result->SetBoolean("isHitTestable", element->IsHitTestable()); |
+ result->SetInteger("id", element->id); |
+ result->SetInteger("parentId", element->parent_id); |
+ result->SetBoolean("lockToFov", element->lock_to_fov); |
+ result->SetDouble("opacity", element->opacity); |
+ result->SetDouble("computedOpacity", element->computed_opacity); |
+ result->SetBoolean("computedLockToFov", element->computed_lock_to_fov); |
+ result->SetInteger("xAnchoring", element->x_anchoring); |
+ result->SetInteger("yAnchoring", element->y_anchoring); |
+ result->SetInteger("fill", element->fill); |
+ result->SetInteger("gridlineCount", element->gridline_count); |
+ result->SetInteger("drawPhase", element->draw_phase); |
+ |
+ auto temp_dictionary = base::MakeUnique<base::DictionaryValue>(); |
+ temp_dictionary->SetInteger("x", element->copy_rect.x); |
+ temp_dictionary->SetInteger("y", element->copy_rect.y); |
+ temp_dictionary->SetInteger("width", element->copy_rect.width); |
+ temp_dictionary->SetInteger("height", element->copy_rect.height); |
+ result->Set("copyRect", std::move(temp_dictionary)); |
+ |
+ temp_dictionary = base::MakeUnique<base::DictionaryValue>(); |
+ temp_dictionary->SetDouble("x", element->size.x); |
+ temp_dictionary->SetDouble("y", element->size.y); |
+ temp_dictionary->SetDouble("z", element->size.z); |
+ result->Set("size", std::move(temp_dictionary)); |
+ |
+ temp_dictionary = base::MakeUnique<base::DictionaryValue>(); |
+ temp_dictionary->SetDouble("x", element->scale.x); |
+ temp_dictionary->SetDouble("y", element->scale.y); |
+ temp_dictionary->SetDouble("z", element->scale.z); |
+ result->Set("scale", std::move(temp_dictionary)); |
+ |
+ temp_dictionary = base::MakeUnique<base::DictionaryValue>(); |
+ temp_dictionary->SetDouble("x", element->rotation.x); |
+ temp_dictionary->SetDouble("y", element->rotation.y); |
+ temp_dictionary->SetDouble("z", element->rotation.z); |
+ temp_dictionary->SetDouble("angle", element->rotation.angle); |
+ result->Set("rotation", std::move(temp_dictionary)); |
+ |
+ temp_dictionary = base::MakeUnique<base::DictionaryValue>(); |
+ temp_dictionary->SetDouble("x", element->translation.x); |
+ temp_dictionary->SetDouble("y", element->translation.y); |
+ temp_dictionary->SetDouble("z", element->translation.z); |
+ result->Set("translation", std::move(temp_dictionary)); |
+ |
+ temp_dictionary = base::MakeUnique<base::DictionaryValue>(); |
+ temp_dictionary->SetDouble("r", element->edge_color.r); |
+ temp_dictionary->SetDouble("g", element->edge_color.g); |
+ temp_dictionary->SetDouble("b", element->edge_color.b); |
+ temp_dictionary->SetDouble("a", element->edge_color.a); |
+ result->Set("edgeColor", std::move(temp_dictionary)); |
+ |
+ temp_dictionary = base::MakeUnique<base::DictionaryValue>(); |
+ temp_dictionary->SetDouble("r", element->center_color.r); |
+ temp_dictionary->SetDouble("g", element->center_color.g); |
+ temp_dictionary->SetDouble("b", element->center_color.b); |
+ temp_dictionary->SetDouble("a", element->center_color.a); |
+ result->Set("centerColor", std::move(temp_dictionary)); |
+ |
+ return result; |
+} |
+ |
const std::vector<std::unique_ptr<ContentRectangle>>& UiScene::GetUiElements() |
const { |
return ui_elements_; |