Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feedback] initial skeleton WebUI for feedback tool new UX
With this CL, a non-functional new Feedback Tool UX for ChromeOS is served under chrome://os-feedback as a WebUI. This is the starting point to implement the UX change (go/cros-feedback-tool). A follow up CL will convert this into an SWA. Bug: b/185624798 Change-Id: Ibd410ee2fbb9c71e281e0edc314a79d53d2ef67d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2851539 Reviewed-by: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Jimmy Gong <jimmyxgong@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Kyle Horimoto <khorimoto@chromium.org> Commit-Queue: Xiangdong Kong <xiangdongkong@google.com> Cr-Commit-Position: refs/heads/master@{#879887}
- Loading branch information
Xiangdong Kong
authored and
Chromium LUCI CQ
committed
May 6, 2021
1 parent
2d0d0f5
commit cf4df37
Showing
17 changed files
with
189 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2021 The Chromium Authors.All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
import("//build/config/chromeos/ui_mode.gni") | ||
import("//ui/webui/resources/tools/generate_grd.gni") | ||
|
||
assert(is_chromeos_ash, "Non-ChromeOS builds cannot depend on //ash") | ||
|
||
static_library("os_feedback_ui") { | ||
sources = [ | ||
"os_feedback_ui.cc", | ||
"os_feedback_ui.h", | ||
"url_constants.cc", | ||
"url_constants.h", | ||
] | ||
|
||
deps = [ | ||
"//ash/components/resources:os_feedback_resources", | ||
"//content/public/browser", | ||
"//ui/webui", | ||
] | ||
} |
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 @@ | ||
include_rules = [ | ||
"+content/public/browser", | ||
"+ui/webui", | ||
] |
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,3 @@ | ||
monorail { | ||
component: "OS>Apps>Feedback" | ||
} |
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 @@ | ||
file://components/feedback/OWNERS |
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,44 @@ | ||
// Copyright 2021 The Chromium 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 "ash/components/os_feedback_ui/os_feedback_ui.h" | ||
|
||
#include "ash/components/os_feedback_ui/url_constants.h" | ||
#include "ash/grit/ash_os_feedback_resources.h" | ||
#include "ash/grit/ash_os_feedback_resources_map.h" | ||
#include "base/memory/ptr_util.h" | ||
#include "content/public/browser/web_contents.h" | ||
#include "content/public/browser/web_ui.h" | ||
#include "content/public/browser/web_ui_data_source.h" | ||
#include "ui/webui/mojo_web_ui_controller.h" | ||
|
||
namespace ash { | ||
|
||
namespace { | ||
|
||
void SetUpWebUIDataSource(content::WebUIDataSource* source, | ||
base::span<const webui::ResourcePath> resources, | ||
int default_resource) { | ||
source->AddResourcePaths(resources); | ||
source->SetDefaultResource(default_resource); | ||
} | ||
|
||
} // namespace | ||
|
||
OSFeedbackUI::OSFeedbackUI(content::WebUI* web_ui) | ||
: MojoWebUIController(web_ui) { | ||
auto source = base::WrapUnique( | ||
content::WebUIDataSource::Create(kChromeUIOSFeedbackHost)); | ||
|
||
const auto resources = | ||
base::make_span(kAshOsFeedbackResources, kAshOsFeedbackResourcesSize); | ||
SetUpWebUIDataSource(source.get(), resources, IDR_ASH_OS_FEEDBACK_INDEX_HTML); | ||
|
||
auto* browser_context = web_ui->GetWebContents()->GetBrowserContext(); | ||
content::WebUIDataSource::Add(browser_context, source.release()); | ||
} | ||
|
||
OSFeedbackUI::~OSFeedbackUI() = default; | ||
|
||
} // namespace ash |
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 2021 The Chromium 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 ASH_COMPONENTS_OS_FEEDBACK_UI_OS_FEEDBACK_UI_H_ | ||
#define ASH_COMPONENTS_OS_FEEDBACK_UI_OS_FEEDBACK_UI_H_ | ||
|
||
#include "ui/webui/mojo_web_ui_controller.h" | ||
|
||
namespace content { | ||
class WebUI; | ||
} // namespace content | ||
|
||
namespace ash { | ||
|
||
class OSFeedbackUI : public ui::MojoWebUIController { | ||
public: | ||
explicit OSFeedbackUI(content::WebUI* web_ui); | ||
OSFeedbackUI(const OSFeedbackUI&) = delete; | ||
OSFeedbackUI& operator=(const OSFeedbackUI&) = delete; | ||
~OSFeedbackUI() override; | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_COMPONENTS_OS_FEEDBACK_UI_OS_FEEDBACK_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2021 The Chromium Authors.All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
import("//build/config/chromeos/ui_mode.gni") | ||
import("//ui/webui/resources/tools/generate_grd.gni") | ||
|
||
assert(is_chromeos_ash, "Non-ChromeOS builds cannot depend on //ash") | ||
|
||
generate_grd("build_grd") { | ||
input_files_base_dir = rebase_path(".", "//") | ||
input_files = [ "index.html" ] | ||
manifest_files = [] | ||
grd_prefix = "ash_os_feedback" | ||
out_grd = "$target_gen_dir/${grd_prefix}_resources.grd" | ||
} |
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,15 @@ | ||
<!-- Copyright 2021 The Chromium Authors. All rights reserved. | ||
Use of this source code is governed by a BSD-style license that can be | ||
found in the LICENSE file. --> | ||
<!doctype html> | ||
<html dir="$i18n{textdirection}" lang="$i18n{language}"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
</head> | ||
|
||
<body> | ||
<div>Hello, World!</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,11 @@ | ||
// Copyright 2021 The Chromium 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 "ash/components/os_feedback_ui/url_constants.h" | ||
|
||
namespace ash { | ||
|
||
const char kChromeUIOSFeedbackHost[] = "os-feedback"; | ||
|
||
} // namespace ash |
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,14 @@ | ||
// Copyright 2021 The Chromium 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 ASH_COMPONENTS_OS_FEEDBACK_UI_URL_CONSTANTS_H_ | ||
#define ASH_COMPONENTS_OS_FEEDBACK_UI_URL_CONSTANTS_H_ | ||
|
||
namespace ash { | ||
|
||
extern const char kChromeUIOSFeedbackHost[]; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_COMPONENTS_OS_FEEDBACK_UI_URL_CONSTANTS_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
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