-
Notifications
You must be signed in to change notification settings - Fork 149
Implementing Asynchronous Advertising ID Retrieval for H5vccSystem #4794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
c381dea
Add mojom for H5vccSystem.
zhongqiliang 406f7ce
async Get + js injection
zhongqiliang 4089450
Use JNI to call starboardBridge.getAdvertisingId()
zhongqiliang fb58b75
Remove h5vcc_system.js polyfill script.
zhongqiliang abed575
Merge branch 'main' into h5vcc_system_mojom
zhongqiliang fabf42d
Build dependency.
zhongqiliang 94b492c
Add macro #if BUILDFLAG(IS_ANDROID)
zhongqiliang 6114b27
Remove advertising_id_
zhongqiliang 840c91e
Draft web tests.
zhongqiliang 7936935
Merge branch 'main' into h5vcc_system_mojom
zhongqiliang 61e33c8
Add web tests
zhongqiliang 0d36727
Add web_tests to .pre-commit-config.yaml
zhongqiliang 65cf944
Merge branch 'main' into h5vcc_system_mojom
zhongqiliang e6ae353
Rename stub key
zhongqiliang c784b5b
Build rule
zhongqiliang 24a4456
git precommit check
zhongqiliang 272d2a1
Add todo
zhongqiliang e58199e
Revert "Build rule"
zhongqiliang b13a497
TODO
zhongqiliang 1616514
Merge branch 'main' into h5vcc_system_mojom
zhongqiliang 182a1b8
Fix linux build
zhongqiliang 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,31 @@ | ||
# Copyright 2025 The Cobalt Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
source_set("h5vcc_system") { | ||
sources = [ | ||
"h5vcc_system_impl.cc", | ||
"h5vcc_system_impl.h", | ||
] | ||
|
||
deps = [ | ||
"//base", | ||
"//cobalt/browser/h5vcc_system/public/mojom", | ||
"//content/public/browser", | ||
"//mojo/public/cpp/bindings", | ||
] | ||
|
||
if (is_android) { | ||
deps += [ "//starboard/android/shared:starboard_platform" ] | ||
zhongqiliang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
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,46 @@ | ||
// Copyright 2025 The Cobalt Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "cobalt/browser/h5vcc_system/h5vcc_system_impl.h" | ||
#include "base/functional/bind.h" | ||
#include "base/functional/callback.h" | ||
#include "starboard/android/shared/starboard_bridge.h" | ||
|
||
using starboard::android::shared::StarboardBridge; | ||
|
||
namespace h5vcc_system { | ||
|
||
H5vccSystemImpl::H5vccSystemImpl( | ||
content::RenderFrameHost& render_frame_host, | ||
mojo::PendingReceiver<mojom::H5vccSystem> receiver) | ||
: content::DocumentService<mojom::H5vccSystem>(render_frame_host, | ||
std::move(receiver)) {} | ||
|
||
void H5vccSystemImpl::Create( | ||
content::RenderFrameHost* render_frame_host, | ||
mojo::PendingReceiver<mojom::H5vccSystem> receiver) { | ||
new H5vccSystemImpl(*render_frame_host, std::move(receiver)); | ||
} | ||
|
||
void H5vccSystemImpl::GetAdvertisingId(GetAdvertisingIdCallback callback) { | ||
std::string advertising_id; | ||
#if BUILDFLAG(IS_ANDROID) | ||
JNIEnv* env = base::android::AttachCurrentThread(); | ||
zhongqiliang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
StarboardBridge* starbooard_bridge = StarboardBridge::GetInstance(); | ||
advertising_id = starbooard_bridge->GetAdvertisingId(env); | ||
#endif | ||
std::move(callback).Run(advertising_id); | ||
} | ||
|
||
} // namespace h5vcc_system |
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,52 @@ | ||
// Copyright 2025 The Cobalt Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef COBALT_BROWSER_H5VCC_SYSTEM_H5VCC_SYSTEM_IMPL_H_ | ||
#define COBALT_BROWSER_H5VCC_SYSTEM_H5VCC_SYSTEM_IMPL_H_ | ||
|
||
#include <string> | ||
|
||
#include "cobalt/browser/h5vcc_system/public/mojom/h5vcc_system.mojom.h" | ||
#include "content/public/browser/document_service.h" | ||
#include "mojo/public/cpp/bindings/pending_receiver.h" | ||
|
||
namespace content { | ||
class RenderFrameHost; | ||
} // namespace content | ||
|
||
namespace h5vcc_system { | ||
|
||
// Implements the H5vccSystem Mojo interface and extends | ||
// DocumentService so that an object's lifetime is scoped to the corresponding | ||
// document / RenderFrameHost (see DocumentService for details). | ||
class H5vccSystemImpl : public content::DocumentService<mojom::H5vccSystem> { | ||
andrewsavage1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public: | ||
// Creates a H5vccSystemImpl. The H5vccSystemImpl is bound to the | ||
// receiver and its lifetime is scoped to the render_frame_host. | ||
static void Create(content::RenderFrameHost* render_frame_host, | ||
mojo::PendingReceiver<mojom::H5vccSystem> receiver); | ||
|
||
H5vccSystemImpl(const H5vccSystemImpl&) = delete; | ||
H5vccSystemImpl& operator=(const H5vccSystemImpl&) = delete; | ||
|
||
void GetAdvertisingId(GetAdvertisingIdCallback) override; | ||
|
||
private: | ||
H5vccSystemImpl(content::RenderFrameHost& render_frame_host, | ||
mojo::PendingReceiver<mojom::H5vccSystem> receiver); | ||
}; | ||
|
||
} // namespace h5vcc_system | ||
|
||
#endif // COBALT_BROWSER_H5VCC_SYSTEM_H5VCC_SYSTEM_IMPL_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2025 The Cobalt Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import("//mojo/public/tools/bindings/mojom.gni") | ||
|
||
mojom("mojom") { | ||
sources = [ "h5vcc_system.mojom" ] | ||
} |
22 changes: 22 additions & 0 deletions
22
cobalt/browser/h5vcc_system/public/mojom/h5vcc_system.mojom
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,22 @@ | ||
// Copyright 2025 The Cobalt Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
module h5vcc_system.mojom; | ||
|
||
// The browser process must provide an implementation of this interface so that | ||
// the renderer process can implement the H5vccSystem Blink API. | ||
interface H5vccSystem { | ||
// Get the GetAdvertisingId for the device. | ||
GetAdvertisingId() => (string advertising_id); | ||
}; |
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
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
16 changes: 0 additions & 16 deletions
16
third_party/blink/web_tests/external/wpt/cobalt/h5vcc-system/h5vcc-system.https.sub.html
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.