Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: content/renderer/input/frame_input_handler_impl.h

Issue 2884243003: Add a mojo channel for frame messages. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_INPUT_FRAME_INPUT_HANDLER_IMPL_H_
6 #define CONTENT_RENDERER_INPUT_FRAME_INPUT_HANDLER_IMPL_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "content/common/input/input_handler.mojom.h"
10 #include "content/renderer/render_frame_impl.h"
11 #include "mojo/public/cpp/bindings/binding.h"
12
13 namespace content {
14 class MainThreadEventQueue;
15
16 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.
17 : public mojom::FrameInputHandler,
18 public base::RefCountedThreadSafe<FrameInputHandlerImpl> {
19 public:
20 static void CreateMojoService(
21 RenderFrameImpl* render_frame,
22 const service_manager::BindSourceInfo& source_info,
23 mojom::FrameInputHandlerRequest request);
24
25 void SetCompositionFromExistingText(
26 int32_t start,
27 int32_t end,
28 const std::vector<ui::CompositionUnderline>& underlines) override;
29 void ExtendSelectionAndDelete(int32_t before, int32_t after) override;
30 void DeleteSurroundingText(int32_t before, int32_t after) override;
31 void DeleteSurroundingTextInCodePoints(int32_t before,
32 int32_t after) override;
33 void SetEditableSelectionOffsets(int32_t start, int32_t end) override;
34 void ExecuteEditCommand(const std::string& command,
35 const base::Optional<std::string>& value) override;
36 void Undo() override;
37 void Redo() override;
38 void Cut() override;
39 void Copy() override;
40 void CopyToFindPboard() override;
41 void Paste() override;
42 void PasteAndMatchStyle() override;
43 void Replace(const std::string& word) override;
44 void ReplaceMisspelling(const std::string& word) override;
45 void Delete() override;
46 void SelectAll() override;
47 void CollapseSelection() override;
48 void SelectRange(const gfx::Point& base, const gfx::Point& extent) override;
49 void AdjustSelectionByCharacterOffset(int32_t start, int32_t end) override;
50 void MoveRangeSelectionExtent(const gfx::Point& extent) override;
51
52 protected:
53 friend class base::RefCountedThreadSafe<FrameInputHandlerImpl>;
54 ~FrameInputHandlerImpl() override;
55
56 private:
57 enum class UpdateState { kNone, kIsPasting, kIsSelectingRange };
58
59 class HandlingState {
60 public:
61 HandlingState(RenderFrameImpl* render_frame, UpdateState state);
62 ~HandlingState();
63
64 private:
65 RenderFrameImpl* render_frame_;
66 bool original_select_range_value_;
67 bool original_pasting_value_;
68 };
69
70 FrameInputHandlerImpl(RenderFrameImpl* render_frame,
71 mojom::FrameInputHandlerRequest request);
72
73 void RunOnMainThread(const base::Closure& closure);
74 void BindOnCompositor(mojom::FrameInputHandlerRequest request);
75 void BindNow(mojom::FrameInputHandlerRequest request);
76 void ExecuteCommandOnMainThread(const std::string& command,
77 UpdateState state);
78
79 RenderFrameImpl* GetRenderFrame();
80
81 mojo::Binding<mojom::FrameInputHandler> binding_;
82
83 // |render_frame_| should only be accessed on the main thread. Use
84 // GetRenderFrame so that it will DCHECK this for you.
85 RenderFrameImpl* render_frame_;
86
87 scoped_refptr<MainThreadEventQueue> input_event_queue_;
88 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
89
90 DISALLOW_COPY_AND_ASSIGN(FrameInputHandlerImpl);
91 };
92
93 } // namespace content
94
95 #endif // CONTENT_RENDERER_INPUT_FRAME_INPUT_HANDLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698