Commit 52124e93 authored by James Cook's avatar James Cook Committed by Commit Bot

ash: Minor style guide fixes to //ash/accelerators

* Fix a couple of incorrect include guards.
* Use "return std::make_unique<T>(...)" instead of
  "return std::unique_ptr<T>(...)" because the latter is banned by a
  presubmit.

https://source.chromium.org/chromium/chromium/src/+/master:PRESUBMIT.py;drc=9c1f87c53ca0d29afdd5763b50cb26341ba1fd64;l=2596

I just noticed these incidentally while investigating another issue.

Bug: none
Change-Id: Id5ea994517ff41641a724cf0832da80f8ac7b680
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2530900
Commit-Queue: James Cook <jamescook@chromium.org>
Auto-Submit: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826401}
parent 20823499
...@@ -358,4 +358,4 @@ class ASH_EXPORT AcceleratorControllerImpl : public ui::AcceleratorTarget, ...@@ -358,4 +358,4 @@ class ASH_EXPORT AcceleratorControllerImpl : public ui::AcceleratorTarget,
} // namespace ash } // namespace ash
#endif // ASH_ACCELERATOR_CONTROLLER_IMPL_H_ #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_IMPL_H_
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ASH_ACCELERATOR_KEY_HOLD_DETECTOR_H_ #ifndef ASH_ACCELERATORS_KEY_HOLD_DETECTOR_H_
#define ASH_ACCELERATOR_KEY_HOLD_DETECTOR_H_ #define ASH_ACCELERATORS_KEY_HOLD_DETECTOR_H_
#include <memory> #include <memory>
...@@ -69,4 +69,4 @@ class ASH_EXPORT KeyHoldDetector : public ui::EventHandler { ...@@ -69,4 +69,4 @@ class ASH_EXPORT KeyHoldDetector : public ui::EventHandler {
} // namespace ash } // namespace ash
#endif // ASH_ACCELERATOR_KEY_HOLD_DETECTOR_H_ #endif // ASH_ACCELERATORS_KEY_HOLD_DETECTOR_H_
...@@ -35,10 +35,10 @@ void MagnifierKeyScroller::SetEnabled(bool enabled) { ...@@ -35,10 +35,10 @@ void MagnifierKeyScroller::SetEnabled(bool enabled) {
// static // static
std::unique_ptr<ui::EventHandler> MagnifierKeyScroller::CreateHandler() { std::unique_ptr<ui::EventHandler> MagnifierKeyScroller::CreateHandler() {
// Uses `new` due to private constructor.
std::unique_ptr<KeyHoldDetector::Delegate> delegate( std::unique_ptr<KeyHoldDetector::Delegate> delegate(
new MagnifierKeyScroller()); new MagnifierKeyScroller());
return std::unique_ptr<ui::EventHandler>( return std::make_unique<KeyHoldDetector>(std::move(delegate));
new KeyHoldDetector(std::move(delegate)));
} }
bool MagnifierKeyScroller::ShouldProcessEvent(const ui::KeyEvent* event) const { bool MagnifierKeyScroller::ShouldProcessEvent(const ui::KeyEvent* event) const {
......
...@@ -28,10 +28,10 @@ void SpokenFeedbackToggler::SetEnabled(bool enabled) { ...@@ -28,10 +28,10 @@ void SpokenFeedbackToggler::SetEnabled(bool enabled) {
// static // static
std::unique_ptr<ui::EventHandler> SpokenFeedbackToggler::CreateHandler() { std::unique_ptr<ui::EventHandler> SpokenFeedbackToggler::CreateHandler() {
// Uses `new` due to private constructor.
std::unique_ptr<KeyHoldDetector::Delegate> delegate( std::unique_ptr<KeyHoldDetector::Delegate> delegate(
new SpokenFeedbackToggler()); new SpokenFeedbackToggler());
return std::unique_ptr<ui::EventHandler>( return std::make_unique<KeyHoldDetector>(std::move(delegate));
new KeyHoldDetector(std::move(delegate)));
} }
bool SpokenFeedbackToggler::ShouldProcessEvent( bool SpokenFeedbackToggler::ShouldProcessEvent(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment