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

Side by Side Diff: chrome/browser/android/vr_shell/ui_scene.cc

Issue 2773903003: Add way to get native VR UI information from Java (Closed)
Patch Set: Cleanup Created 3 years, 9 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
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 "chrome/browser/android/vr_shell/ui_scene.h" 5 #include "chrome/browser/android/vr_shell/ui_scene.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 383 }
384 384
385 float UiScene::GetBackgroundDistance() const { 385 float UiScene::GetBackgroundDistance() const {
386 return background_distance_; 386 return background_distance_;
387 } 387 }
388 388
389 bool UiScene::GetWebVrRenderingEnabled() const { 389 bool UiScene::GetWebVrRenderingEnabled() const {
390 return webvr_rendering_enabled_; 390 return webvr_rendering_enabled_;
391 } 391 }
392 392
393 std::unique_ptr<base::DictionaryValue> UiScene::CreateUiElementInfo(
394 int element_id) {
395 auto result = base::MakeUnique<base::DictionaryValue>();
396 const ContentRectangle* element = GetUiElementById(element_id);
397 CHECK_NE(element, nullptr);
398
399 result->SetBoolean("isVisible", element->IsVisible());
400 result->SetBoolean("isHitTestable", element->IsHitTestable());
401 result->SetInteger("id", element->id);
402 result->SetInteger("parentId", element->parent_id);
403 result->SetBoolean("lockToFov", element->lock_to_fov);
404 result->SetDouble("opacity", element->opacity);
405 result->SetDouble("computedOpacity", element->computed_opacity);
406 result->SetBoolean("computedLockToFov", element->computed_lock_to_fov);
407 result->SetInteger("xAnchoring", element->x_anchoring);
408 result->SetInteger("yAnchoring", element->y_anchoring);
409 result->SetInteger("fill", element->fill);
410 result->SetInteger("gridlineCount", element->gridline_count);
411 result->SetInteger("drawPhase", element->draw_phase);
412
413 auto temp_dictionary = base::MakeUnique<base::DictionaryValue>();
414 temp_dictionary->SetInteger("x", element->copy_rect.x);
415 temp_dictionary->SetInteger("y", element->copy_rect.y);
416 temp_dictionary->SetInteger("width", element->copy_rect.width);
417 temp_dictionary->SetInteger("height", element->copy_rect.height);
418 result->Set("copyRect", std::move(temp_dictionary));
419
420 temp_dictionary = base::MakeUnique<base::DictionaryValue>();
421 temp_dictionary->SetDouble("x", element->size.x);
422 temp_dictionary->SetDouble("y", element->size.y);
423 temp_dictionary->SetDouble("z", element->size.z);
424 result->Set("size", std::move(temp_dictionary));
425
426 temp_dictionary = base::MakeUnique<base::DictionaryValue>();
427 temp_dictionary->SetDouble("x", element->scale.x);
428 temp_dictionary->SetDouble("y", element->scale.y);
429 temp_dictionary->SetDouble("z", element->scale.z);
430 result->Set("scale", std::move(temp_dictionary));
431
432 temp_dictionary = base::MakeUnique<base::DictionaryValue>();
433 temp_dictionary->SetDouble("x", element->rotation.x);
434 temp_dictionary->SetDouble("y", element->rotation.y);
435 temp_dictionary->SetDouble("z", element->rotation.z);
436 temp_dictionary->SetDouble("angle", element->rotation.angle);
437 result->Set("rotation", std::move(temp_dictionary));
438
439 temp_dictionary = base::MakeUnique<base::DictionaryValue>();
440 temp_dictionary->SetDouble("x", element->translation.x);
441 temp_dictionary->SetDouble("y", element->translation.y);
442 temp_dictionary->SetDouble("z", element->translation.z);
443 result->Set("translation", std::move(temp_dictionary));
444
445 temp_dictionary = base::MakeUnique<base::DictionaryValue>();
446 temp_dictionary->SetDouble("r", element->edge_color.r);
447 temp_dictionary->SetDouble("g", element->edge_color.g);
448 temp_dictionary->SetDouble("b", element->edge_color.b);
449 temp_dictionary->SetDouble("a", element->edge_color.a);
450 result->Set("edgeColor", std::move(temp_dictionary));
451
452 temp_dictionary = base::MakeUnique<base::DictionaryValue>();
453 temp_dictionary->SetDouble("r", element->center_color.r);
454 temp_dictionary->SetDouble("g", element->center_color.g);
455 temp_dictionary->SetDouble("b", element->center_color.b);
456 temp_dictionary->SetDouble("a", element->center_color.a);
457 result->Set("centerColor", std::move(temp_dictionary));
458
459 return result;
460 }
461
393 const std::vector<std::unique_ptr<ContentRectangle>>& UiScene::GetUiElements() 462 const std::vector<std::unique_ptr<ContentRectangle>>& UiScene::GetUiElements()
394 const { 463 const {
395 return ui_elements_; 464 return ui_elements_;
396 } 465 }
397 466
398 UiScene::UiScene() = default; 467 UiScene::UiScene() = default;
399 468
400 UiScene::~UiScene() = default; 469 UiScene::~UiScene() = default;
401 470
402 void UiScene::ApplyRecursiveTransforms(const ContentRectangle& element, 471 void UiScene::ApplyRecursiveTransforms(const ContentRectangle& element,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 content_element_ = element; 558 content_element_ = element;
490 break; 559 break;
491 default: 560 default:
492 element->fill = Fill::NONE; 561 element->fill = Fill::NONE;
493 break; 562 break;
494 } 563 }
495 } 564 }
496 } 565 }
497 566
498 } // namespace vr_shell 567 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698