-
Notifications
You must be signed in to change notification settings - Fork 920
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18356 from brave/skus_internals_stub_code
brave://skus-internals stub code
- Loading branch information
Showing
18 changed files
with
199 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,39 @@ | ||
// Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#include "brave/browser/ui/webui/skus_internals_ui.h" | ||
|
||
#include <utility> | ||
|
||
#include "base/notreached.h" | ||
#include "brave/browser/ui/webui/brave_webui_source.h" | ||
#include "brave/components/skus/browser/resources/grit/skus_internals_generated_map.h" | ||
#include "components/grit/brave_components_resources.h" | ||
|
||
SkusInternalsUI::SkusInternalsUI(content::WebUI* web_ui, | ||
const std::string& name) | ||
: content::WebUIController(web_ui) { | ||
CreateAndAddWebUIDataSource(web_ui, name, kSkusInternalsGenerated, | ||
kSkusInternalsGeneratedSize, | ||
IDR_SKUS_INTERNALS_HTML); | ||
} | ||
|
||
SkusInternalsUI::~SkusInternalsUI() = default; | ||
|
||
void SkusInternalsUI::BindInterface( | ||
mojo::PendingReceiver<skus::mojom::SkusInternals> pending_receiver) { | ||
if (skus_internals_receiver_.is_bound()) { | ||
skus_internals_receiver_.reset(); | ||
} | ||
|
||
skus_internals_receiver_.Bind(std::move(pending_receiver)); | ||
} | ||
|
||
void SkusInternalsUI::GetEventLog(GetEventLogCallback callback) { | ||
// TODO(simonhong): Ask log to SkusService | ||
NOTIMPLEMENTED_LOG_ONCE(); | ||
} | ||
|
||
WEB_UI_CONTROLLER_TYPE_IMPL(SkusInternalsUI) |
This file contains 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,34 @@ | ||
// Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#ifndef BRAVE_BROWSER_UI_WEBUI_SKUS_INTERNALS_UI_H_ | ||
#define BRAVE_BROWSER_UI_WEBUI_SKUS_INTERNALS_UI_H_ | ||
|
||
#include <string> | ||
|
||
#include "brave/components/skus/common/skus_internals.mojom.h" | ||
#include "content/public/browser/web_ui_controller.h" | ||
|
||
class SkusInternalsUI : public content::WebUIController, | ||
public skus::mojom::SkusInternals { | ||
public: | ||
SkusInternalsUI(content::WebUI* web_ui, const std::string& host); | ||
~SkusInternalsUI() override; | ||
SkusInternalsUI(const SkusInternalsUI&) = delete; | ||
SkusInternalsUI& operator=(const SkusInternalsUI&) = delete; | ||
|
||
void BindInterface( | ||
mojo::PendingReceiver<skus::mojom::SkusInternals> pending_receiver); | ||
|
||
private: | ||
// skus::mojom::SkusInternals overrides: | ||
void GetEventLog(GetEventLogCallback callback) override; | ||
|
||
mojo::Receiver<skus::mojom::SkusInternals> skus_internals_receiver_{this}; | ||
|
||
WEB_UI_CONTROLLER_TYPE_DECL(); | ||
}; | ||
|
||
#endif // BRAVE_BROWSER_UI_WEBUI_SKUS_INTERNALS_UI_H_ |
This file contains 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 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 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 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 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 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,26 @@ | ||
# Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
# You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
import("//brave/components/common/typescript.gni") | ||
|
||
transpile_web_ui("skus_internals_ui") { | ||
entry_points = [ [ | ||
"skus_internals", | ||
rebase_path("skus_internals.tsx"), | ||
] ] | ||
|
||
public_deps = [ | ||
"//brave/components/skus/common:mojom_js", | ||
"//mojo/public/mojom/base", | ||
] | ||
|
||
resource_name = "skus_internals" | ||
} | ||
|
||
pack_web_resources("generated_resources") { | ||
resource_name = "skus_internals" | ||
output_dir = "$root_gen_dir/brave/components/skus/browser/resources" | ||
deps = [ ":skus_internals_ui" ] | ||
} |
This file contains 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,28 @@ | ||
<!-- | ||
Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
You can obtain one at https://mozilla.org/MPL/2.0/. | ||
--> | ||
|
||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Skus internals</title> | ||
<link rel="stylesheet" href="chrome://resources/css/text_defaults.css"> | ||
<script src="/skus_internals.bundle.js"></script> | ||
<style> | ||
body { | ||
margin: 0; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
</body> | ||
|
||
</html> |
This file contains 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,17 @@ | ||
// Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
import * as React from 'react' | ||
import { render } from 'react-dom' | ||
|
||
function App() { | ||
return ( | ||
<div>Log here</div> | ||
) | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
render(<App />, document.getElementById('root')) | ||
}) |
4 changes: 4 additions & 0 deletions
4
components/skus/browser/resources/skus_internals_resources.grdp
This file contains 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,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<grit-part> | ||
<include name="IDR_SKUS_INTERNALS_HTML" file="../skus/browser/resources/skus_internals.html" type="BINDATA" /> | ||
</grit-part> |
This file contains 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,9 @@ | ||
{ | ||
"extends": "../../../tsconfig", | ||
"include": [ | ||
"**/*.ts", | ||
"**/*.tsx", | ||
"**/*.d.ts", | ||
"../../definitions/*.d.ts" | ||
] | ||
} |
This file contains 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 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,10 @@ | ||
// Copyright (c) 2023 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
module skus.mojom; | ||
|
||
interface SkusInternals { | ||
GetEventLog() => (string response); | ||
}; |
This file contains 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