| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_elements/exit_prompt_backplane.h" | 5 #include "chrome/browser/android/vr_shell/ui_elements/exit_prompt_backplane.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 | 8 |
| 9 namespace vr_shell { | 9 namespace vr_shell { |
| 10 | 10 |
| 11 ExitPromptBackplane::ExitPromptBackplane( | 11 ExitPromptBackplane::ExitPromptBackplane( |
| 12 int id, |
| 12 const base::Callback<void()>& click_callback) | 13 const base::Callback<void()>& click_callback) |
| 13 : click_callback_(click_callback) {} | 14 : UiElement(id), click_callback_(click_callback) {} |
| 14 | 15 |
| 15 ExitPromptBackplane::~ExitPromptBackplane() = default; | 16 ExitPromptBackplane::~ExitPromptBackplane() = default; |
| 16 | 17 |
| 17 void ExitPromptBackplane::OnButtonUp(const gfx::PointF& position) { | 18 void ExitPromptBackplane::OnButtonUp(const gfx::PointF& position) { |
| 18 // We always run the callback. That is, if the user clicks the controller | 19 // We always run the callback. That is, if the user clicks the controller |
| 19 // button on the backplane and releases it on another element in front of the | 20 // button on the backplane and releases it on another element in front of the |
| 20 // backplane, this callback will still be called. Elements are input locked | 21 // backplane, this callback will still be called. Elements are input locked |
| 21 // on button down and it's probably not worth special-casing the backplane. | 22 // on button down and it's probably not worth special-casing the backplane. |
| 22 click_callback_.Run(); | 23 click_callback_.Run(); |
| 23 } | 24 } |
| 24 | 25 |
| 25 } // namespace vr_shell | 26 } // namespace vr_shell |
| OLD | NEW |