Chromium Code Reviews| Index: content/renderer/input/frame_input_handler_impl.h |
| diff --git a/content/renderer/input/frame_input_handler_impl.h b/content/renderer/input/frame_input_handler_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8f8af665872a83c33e240a4e47f2d51966f0059f |
| --- /dev/null |
| +++ b/content/renderer/input/frame_input_handler_impl.h |
| @@ -0,0 +1,95 @@ |
| +// Copyright 2017 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 CONTENT_RENDERER_INPUT_FRAME_INPUT_HANDLER_IMPL_H_ |
| +#define CONTENT_RENDERER_INPUT_FRAME_INPUT_HANDLER_IMPL_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "content/common/input/input_handler.mojom.h" |
| +#include "content/renderer/render_frame_impl.h" |
| +#include "mojo/public/cpp/bindings/binding.h" |
| + |
| +namespace content { |
| +class MainThreadEventQueue; |
| + |
| +class FrameInputHandlerImpl |
|
dcheng
2017/05/17 04:49:06
I think this class could probably use a class-leve
dtapuska
2017/05/17 17:08:08
Done.
|
| + : public mojom::FrameInputHandler, |
| + public base::RefCountedThreadSafe<FrameInputHandlerImpl> { |
| + public: |
| + static void CreateMojoService( |
| + RenderFrameImpl* render_frame, |
| + const service_manager::BindSourceInfo& source_info, |
| + mojom::FrameInputHandlerRequest request); |
| + |
| + void SetCompositionFromExistingText( |
| + int32_t start, |
| + int32_t end, |
| + const std::vector<ui::CompositionUnderline>& underlines) override; |
| + void ExtendSelectionAndDelete(int32_t before, int32_t after) override; |
| + void DeleteSurroundingText(int32_t before, int32_t after) override; |
| + void DeleteSurroundingTextInCodePoints(int32_t before, |
| + int32_t after) override; |
| + void SetEditableSelectionOffsets(int32_t start, int32_t end) override; |
| + void ExecuteEditCommand(const std::string& command, |
| + const base::Optional<std::string>& value) override; |
| + void Undo() override; |
| + void Redo() override; |
| + void Cut() override; |
| + void Copy() override; |
| + void CopyToFindPboard() override; |
| + void Paste() override; |
| + void PasteAndMatchStyle() override; |
| + void Replace(const std::string& word) override; |
| + void ReplaceMisspelling(const std::string& word) override; |
| + void Delete() override; |
| + void SelectAll() override; |
| + void CollapseSelection() override; |
| + void SelectRange(const gfx::Point& base, const gfx::Point& extent) override; |
| + void AdjustSelectionByCharacterOffset(int32_t start, int32_t end) override; |
| + void MoveRangeSelectionExtent(const gfx::Point& extent) override; |
| + |
| + protected: |
| + friend class base::RefCountedThreadSafe<FrameInputHandlerImpl>; |
| + ~FrameInputHandlerImpl() override; |
| + |
| + private: |
| + enum class UpdateState { kNone, kIsPasting, kIsSelectingRange }; |
| + |
| + class HandlingState { |
| + public: |
| + HandlingState(RenderFrameImpl* render_frame, UpdateState state); |
| + ~HandlingState(); |
| + |
| + private: |
| + RenderFrameImpl* render_frame_; |
| + bool original_select_range_value_; |
| + bool original_pasting_value_; |
| + }; |
| + |
| + FrameInputHandlerImpl(RenderFrameImpl* render_frame, |
| + mojom::FrameInputHandlerRequest request); |
| + |
| + void RunOnMainThread(const base::Closure& closure); |
| + void BindOnCompositor(mojom::FrameInputHandlerRequest request); |
| + void BindNow(mojom::FrameInputHandlerRequest request); |
| + void ExecuteCommandOnMainThread(const std::string& command, |
| + UpdateState state); |
| + |
| + RenderFrameImpl* GetRenderFrame(); |
| + |
| + mojo::Binding<mojom::FrameInputHandler> binding_; |
| + |
| + // |render_frame_| should only be accessed on the main thread. Use |
| + // GetRenderFrame so that it will DCHECK this for you. |
| + RenderFrameImpl* render_frame_; |
| + |
| + scoped_refptr<MainThreadEventQueue> input_event_queue_; |
| + scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FrameInputHandlerImpl); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_INPUT_FRAME_INPUT_HANDLER_IMPL_H_ |