This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Add shell api to set default for windows data #14002
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7daabf4
Add shell api to set default for windows data
chunhtai 552403c
update
chunhtai fb5d3e6
fix build
chunhtai d022162
update
chunhtai 636aa1f
update
chunhtai cd3c18c
refactor and addressing comment
chunhtai 1d1e3a3
addressing comment
chunhtai 366e45d
fix format
chunhtai 4d36fc0
reformat
chunhtai 641c6f0
addressing comment
chunhtai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,12 @@ | ||
| // Copyright 2013 The Flutter 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 "flutter/runtime/window_data.h" | ||
|
|
||
| namespace flutter { | ||
| WindowData::WindowData() = default; | ||
|
|
||
| WindowData::~WindowData() = default; | ||
|
|
||
| } // namespace flutter |
This file contains hidden or 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,49 @@ | ||
| // Copyright 2013 The Flutter 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 FLUTTER_RUNTIME_WINDOW_DATA_H_ | ||
| #define FLUTTER_RUNTIME_WINDOW_DATA_H_ | ||
|
|
||
| #include "flutter/lib/ui/window/viewport_metrics.h" | ||
|
|
||
| #include <memory> | ||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| namespace flutter { | ||
|
|
||
| //------------------------------------------------------------------------------ | ||
| /// The struct of platform-specific data used for initializing ui.Window. | ||
| /// | ||
| /// framework may request data from ui.Window before platform is properly | ||
| /// configured. Engine this struct to set the desired default value for | ||
| /// ui.Window when creating Shell before platform is ready to send the real | ||
| /// data. | ||
| /// | ||
| /// See also: | ||
| /// | ||
| /// * flutter::Shell::Create, which takes a window_data to initialize the | ||
| /// ui.Window | ||
| /// attached to it. | ||
|
||
| struct WindowData { | ||
| WindowData(); | ||
|
|
||
| ~WindowData(); | ||
|
|
||
| ViewportMetrics viewport_metrics; | ||
| std::string language_code; | ||
| std::string country_code; | ||
| std::string script_code; | ||
| std::string variant_code; | ||
| std::vector<std::string> locale_data; | ||
| std::string user_settings_data = "{}"; | ||
| std::string lifecycle_state; | ||
| bool semantics_enabled = false; | ||
| bool assistive_technology_enabled = false; | ||
| int32_t accessibility_feature_flags_ = 0; | ||
| }; | ||
|
|
||
| } // namespace flutter | ||
|
|
||
| #endif // FLUTTER_RUNTIME_WINDOW_DATA_H_ | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -126,6 +126,44 @@ class Shell final : public PlatformView::Delegate, | |
| const CreateCallback<PlatformView>& on_create_platform_view, | ||
| const CreateCallback<Rasterizer>& on_create_rasterizer); | ||
|
|
||
| //---------------------------------------------------------------------------- | ||
| /// @brief Creates a shell instance using the provided settings. The | ||
| /// callbacks to create the various shell subcomponents will be | ||
| /// called on the appropriate threads before this method returns. | ||
| /// Unlike the simpler variant of this factory method, this method | ||
| /// allows for specification of window data. If this is the first | ||
| /// instance of a shell in the process, this | ||
| /// call also bootstraps the Dart VM. | ||
|
||
| /// | ||
| /// @param[in] task_runners The task runners | ||
| /// @param[in] window_data The default data for setting up | ||
| /// ui.Window that attached to this | ||
| /// intance. | ||
| /// @param[in] settings The settings | ||
| /// @param[in] on_create_platform_view The callback that must return a | ||
| /// platform view. This will be called on | ||
| /// the platform task runner before this | ||
| /// method returns. | ||
| /// @param[in] on_create_rasterizer That callback that must provide a | ||
| /// valid rasterizer. This will be called | ||
| /// on the render task runner before this | ||
| /// method returns. | ||
| /// | ||
| /// @return A full initialized shell if the settings and callbacks are | ||
| /// valid. The root isolate has been created but not yet launched. | ||
| /// It may be launched by obtaining the engine weak pointer and | ||
| /// posting a task onto the UI task runner with a valid run | ||
| /// configuration to run the isolate. The embedder must always | ||
| /// check the validity of the shell (using the IsSetup call) | ||
| /// immediately after getting a pointer to it. | ||
| /// | ||
| static std::unique_ptr<Shell> Create( | ||
| TaskRunners task_runners, | ||
| const WindowData window_data, | ||
| Settings settings, | ||
| CreateCallback<PlatformView> on_create_platform_view, | ||
| CreateCallback<Rasterizer> on_create_rasterizer); | ||
|
|
||
| //---------------------------------------------------------------------------- | ||
| /// @brief Creates a shell instance using the provided settings. The | ||
| /// callbacks to create the various shell subcomponents will be | ||
|
|
@@ -136,6 +174,9 @@ class Shell final : public PlatformView::Delegate, | |
| /// requires the specification of a running VM instance. | ||
| /// | ||
| /// @param[in] task_runners The task runners | ||
| /// @param[in] window_data The default data for setting up | ||
| /// ui.Window that attached to this | ||
| /// intance. | ||
| /// @param[in] settings The settings | ||
| /// @param[in] isolate_snapshot A custom isolate snapshot. Takes | ||
| /// precedence over any snapshots | ||
|
|
@@ -160,6 +201,7 @@ class Shell final : public PlatformView::Delegate, | |
| /// | ||
| static std::unique_ptr<Shell> Create( | ||
| TaskRunners task_runners, | ||
| const WindowData window_data, | ||
| Settings settings, | ||
| fml::RefPtr<const DartSnapshot> isolate_snapshot, | ||
| const CreateCallback<PlatformView>& on_create_platform_view, | ||
|
|
@@ -371,6 +413,7 @@ class Shell final : public PlatformView::Delegate, | |
| static std::unique_ptr<Shell> CreateShellOnPlatformThread( | ||
| DartVMRef vm, | ||
| TaskRunners task_runners, | ||
| const WindowData window_data, | ||
| Settings settings, | ||
| fml::RefPtr<const DartSnapshot> isolate_snapshot, | ||
| const Shell::CreateCallback<PlatformView>& on_create_platform_view, | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RuntimeController constructor will always need window data.