Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Projector] Add ProjectorControllerClient in chrome/browser
There will be some dependencies between ash/ and chrome/browser/ code. An example of these dependencies is speech recognition that takes place in chrome/browser/speech/cros_speech_recognition* path. This cl creates a client in chrome for the ProjectorController in ash to handle the dependencies. Bug: 1165437 Change-Id: Iacc6ca33a29c394db7276dc224fbe7395af0267e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2699030 Commit-Queue: Yilkal Abe <yilkal@chromium.org> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Reviewed-by: Li Lin <llin@chromium.org> Cr-Commit-Position: refs/heads/master@{#855028}
- Loading branch information
yilkal
authored and
Chromium LUCI CQ
committed
Feb 18, 2021
1 parent
b74ba5b
commit 378bd67
Showing
18 changed files
with
208 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ASH_PUBLIC_CPP_PROJECTOR_PROJECTOR_CLIENT_H_ | ||
#define ASH_PUBLIC_CPP_PROJECTOR_PROJECTOR_CLIENT_H_ | ||
|
||
#include "ash/public/cpp/ash_public_export.h" | ||
|
||
namespace ash { | ||
|
||
// Creates interface to access Browser side functionalities for the | ||
// ProjectorControllerImpl. | ||
class ASH_PUBLIC_EXPORT ProjectorClient { | ||
public: | ||
ProjectorClient() = default; | ||
ProjectorClient(const ProjectorClient&) = delete; | ||
ProjectorClient& operator=(const ProjectorClient&) = delete; | ||
virtual ~ProjectorClient() = default; | ||
|
||
virtual void StartSpeechRecognition() = 0; | ||
virtual void StopSpeechRecognition() = 0; | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_PUBLIC_CPP_PROJECTOR_PROJECTOR_CLIENT_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ash/public/cpp/projector/projector_controller.h" | ||
|
||
#include "base/check_op.h" | ||
|
||
namespace ash { | ||
|
||
namespace { | ||
ProjectorController* g_instance = nullptr; | ||
} | ||
|
||
ProjectorController::ProjectorController() { | ||
DCHECK_EQ(nullptr, g_instance); | ||
g_instance = this; | ||
} | ||
|
||
ProjectorController::~ProjectorController() { | ||
DCHECK_EQ(g_instance, this); | ||
g_instance = nullptr; | ||
} | ||
|
||
// static | ||
ProjectorController* ProjectorController::Get() { | ||
return g_instance; | ||
} | ||
|
||
} // namespace ash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ASH_PUBLIC_CPP_PROJECTOR_PROJECTOR_CONTROLLER_H_ | ||
#define ASH_PUBLIC_CPP_PROJECTOR_PROJECTOR_CONTROLLER_H_ | ||
|
||
#include "ash/public/cpp/ash_public_export.h" | ||
|
||
namespace ash { | ||
|
||
class ProjectorClient; | ||
|
||
// Interface to control projector in ash. | ||
class ASH_PUBLIC_EXPORT ProjectorController { | ||
public: | ||
ProjectorController(); | ||
ProjectorController(const ProjectorController&) = delete; | ||
ProjectorController& operator=(const ProjectorController&) = delete; | ||
virtual ~ProjectorController(); | ||
|
||
static ProjectorController* Get(); | ||
|
||
// Make sure the client is set before attempting to use to the | ||
// ProjectorController. | ||
virtual void SetClient(ProjectorClient* client) = 0; | ||
|
||
// TODO(ylkal): Add OnTranscriptionResult method to receive transcription | ||
// results here. | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_PUBLIC_CPP_PROJECTOR_PROJECTOR_CONTROLLER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.