Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: bind spellchecker receivers correctly in the renderer (#22015)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
- Loading branch information
1 parent
f658c1a
commit 9f2371f
Showing
5 changed files
with
76 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) 2020 Slack Technologies, Inc. | ||
// Use of this source code is governed by the MIT license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "shell/renderer/browser_exposed_renderer_interfaces.h" | ||
|
||
#include <utility> | ||
|
||
#include "base/bind.h" | ||
#include "base/threading/sequenced_task_runner_handle.h" | ||
#include "build/build_config.h" | ||
#include "electron/buildflags/buildflags.h" | ||
#include "mojo/public/cpp/bindings/binder_map.h" | ||
#include "shell/renderer/renderer_client_base.h" | ||
|
||
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER) | ||
#include "components/spellcheck/renderer/spellcheck.h" | ||
#endif | ||
|
||
namespace { | ||
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER) | ||
void BindSpellChecker( | ||
electron::RendererClientBase* client, | ||
mojo::PendingReceiver<spellcheck::mojom::SpellChecker> receiver) { | ||
if (client->GetSpellCheck()) | ||
client->GetSpellCheck()->BindReceiver(std::move(receiver)); | ||
} | ||
#endif | ||
|
||
} // namespace | ||
|
||
void ExposeElectronRendererInterfacesToBrowser( | ||
electron::RendererClientBase* client, | ||
mojo::BinderMap* binders) { | ||
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER) | ||
binders->Add(base::BindRepeating(&BindSpellChecker, client), | ||
base::SequencedTaskRunnerHandle::Get()); | ||
#endif | ||
} |
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,22 @@ | ||
// Copyright (c) 2020 Slack Technologies, Inc. | ||
// Use of this source code is governed by the MIT license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef SHELL_RENDERER_BROWSER_EXPOSED_RENDERER_INTERFACES_H_ | ||
#define SHELL_RENDERER_BROWSER_EXPOSED_RENDERER_INTERFACES_H_ | ||
|
||
namespace mojo { | ||
class BinderMap; | ||
} // namespace mojo | ||
|
||
namespace electron { | ||
class RendererClientBase; | ||
} // namespace electron | ||
|
||
class ChromeContentRendererClient; | ||
|
||
void ExposeElectronRendererInterfacesToBrowser( | ||
electron::RendererClientBase* client, | ||
mojo::BinderMap* binders); | ||
|
||
#endif // SHELL_RENDERER_BROWSER_EXPOSED_RENDERER_INTERFACES_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