| Flutter Windows Embedder |

platform_view_manager.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 FLUTTER_SHELL_PLATFORM_WINDOWS_PLATFORM_VIEW_MANAGER_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_PLATFORM_VIEW_MANAGER_H_
7
8 #include <memory>
9
10 #include "flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h"
11 #include "flutter/shell/platform/windows/flutter_windows_internal.h"
12 #include "flutter/shell/platform/windows/task_runner.h"
13
14 namespace flutter {
15
16 // Possible reasons for change of keyboard focus.
17 enum class FocusChangeDirection {
18 kProgrammatic, // Un-directed focus change.
19 kForward, // Keyboard focus moves forwards, e.g. TAB key.
20 kBackward // Keyboard focus moves backwards, e.g. Shift+TAB.
21 };
22
23 // The platform method handler for platform view related communication between
24 // the engine and the framework. This base class is derived by a concrete class
25 // (i.e. PlatformViewPlugin) to provide implementation of its abstract virtual
26 // methods.
27 class PlatformViewManager {
28 public:
29 PlatformViewManager(BinaryMessenger* binary_messenger);
30
31 virtual ~PlatformViewManager();
32
33 // Add a new platform view instance to be lazily instantiated when it is next
34 // composited. The manager will invoke Success when this method returns true,
35 // and invoke Error otherwise.
36 virtual bool AddPlatformView(PlatformViewId id,
37 std::string_view type_name) = 0;
38
39 // The framework may invoke this method when keyboard focus must be given to
40 // the platform view. The manager will invoke Success when this method returns
41 // true, and invoke Error otherwise.
42 virtual bool FocusPlatformView(PlatformViewId id,
43 FocusChangeDirection direction,
44 bool focus) = 0;
45
46 private:
47 std::unique_ptr<MethodChannel<EncodableValue>> channel_;
48 };
49
50 } // namespace flutter
51
52 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_PLATFORM_VIEW_MANAGER_H_
flutter::BinaryMessenger
Definition: binary_messenger.h:28
flutter::PlatformViewManager
Definition: platform_view_manager.h:27
flutter::PlatformViewManager::~PlatformViewManager
virtual ~PlatformViewManager()
Definition: platform_view_manager.cc:82
flutter::PlatformViewManager::FocusPlatformView
virtual bool FocusPlatformView(PlatformViewId id, FocusChangeDirection direction, bool focus)=0
flutter::PlatformViewManager::PlatformViewManager
PlatformViewManager(BinaryMessenger *binary_messenger)
Definition: platform_view_manager.cc:21
flutter::PlatformViewManager::AddPlatformView
virtual bool AddPlatformView(PlatformViewId id, std::string_view type_name)=0
flutter_windows_internal.h
PlatformViewId
int64_t PlatformViewId
Definition: flutter_windows_internal.h:42
method_channel.h
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::FocusChangeDirection
FocusChangeDirection
Definition: platform_view_manager.h:17
flutter::FocusChangeDirection::kProgrammatic
@ kProgrammatic
flutter::FocusChangeDirection::kBackward
@ kBackward
flutter::FocusChangeDirection::kForward
@ kForward
task_runner.h