Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feedback: Display localized suggested help contents
There is a language field in the search request that indicates what language to return response in. Set it to the locale of the application. Add OsFeedbackDelegate to allow Feedback UI to access chrome/browser/. unit_tests --gtest_filter=ChromeOsFeedbackDelegateTest* Bug: b:185624798 Test: browser_tests --gtest_filter=OSFeedbackBrowserTest.* \ Change-Id: Iaefaf94ffb0be67333bd493ecccce3430d0ef09a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3540653 Reviewed-by: Gavin Williams <gavinwill@chromium.org> Reviewed-by: Achuith Bhandarkar <achuith@chromium.org> Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org> Commit-Queue: Xiangdong Kong <xiangdongkong@google.com> Cr-Commit-Position: refs/heads/main@{#984366}
- Loading branch information
xiangdong kong
authored and
Chromium LUCI CQ
committed
Mar 23, 2022
1 parent
1af111a
commit 01ae532
Showing
13 changed files
with
143 additions
and
18 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
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 2022 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_WEBUI_OS_FEEDBACK_UI_OS_FEEDBACK_DELEGATE_H_ | ||
#define ASH_WEBUI_OS_FEEDBACK_UI_OS_FEEDBACK_DELEGATE_H_ | ||
|
||
namespace ash { | ||
|
||
// A delegate which exposes browser functionality from //chrome to the OS | ||
// Feedback UI. | ||
class OsFeedbackDelegate { | ||
public: | ||
virtual ~OsFeedbackDelegate() = default; | ||
|
||
// Gets the application locale so that suggested help contents can display | ||
// localized titles when available. | ||
virtual std::string GetApplicationLocale() = 0; | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_WEBUI_OS_FEEDBACK_UI_OS_FEEDBACK_DELEGATE_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
file://ash/webui/os_feedback_ui/OWNERS |
20 changes: 20 additions & 0 deletions
20
chrome/browser/ash/os_feedback/chrome_os_feedback_delegate.cc
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,20 @@ | ||
// Copyright 2022 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 "chrome/browser/ash/os_feedback/chrome_os_feedback_delegate.h" | ||
|
||
#include <string> | ||
|
||
#include "chrome/browser/browser_process.h" | ||
|
||
namespace ash { | ||
|
||
ChromeOsFeedbackDelegate::ChromeOsFeedbackDelegate() = default; | ||
ChromeOsFeedbackDelegate::~ChromeOsFeedbackDelegate() = default; | ||
|
||
std::string ChromeOsFeedbackDelegate::GetApplicationLocale() { | ||
return g_browser_process->GetApplicationLocale(); | ||
} | ||
|
||
} // namespace ash |
28 changes: 28 additions & 0 deletions
28
chrome/browser/ash/os_feedback/chrome_os_feedback_delegate.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,28 @@ | ||
// Copyright 2022 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 CHROME_BROWSER_ASH_OS_FEEDBACK_CHROME_OS_FEEDBACK_DELEGATE_H_ | ||
#define CHROME_BROWSER_ASH_OS_FEEDBACK_CHROME_OS_FEEDBACK_DELEGATE_H_ | ||
|
||
#include <string> | ||
|
||
#include "ash/webui/os_feedback_ui/os_feedback_delegate.h" | ||
|
||
namespace ash { | ||
|
||
class ChromeOsFeedbackDelegate : public OsFeedbackDelegate { | ||
public: | ||
ChromeOsFeedbackDelegate(); | ||
~ChromeOsFeedbackDelegate() override; | ||
|
||
ChromeOsFeedbackDelegate(const ChromeOsFeedbackDelegate&) = delete; | ||
ChromeOsFeedbackDelegate& operator=(const ChromeOsFeedbackDelegate&) = delete; | ||
|
||
// OsFeedbackDelegate: | ||
std::string GetApplicationLocale() override; | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // CHROME_BROWSER_ASH_OS_FEEDBACK_CHROME_OS_FEEDBACK_DELEGATE_H_ |
26 changes: 26 additions & 0 deletions
26
chrome/browser/ash/os_feedback/chrome_os_feedback_delegate_unittest.cc
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 2022 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 "chrome/browser/ash/os_feedback/chrome_os_feedback_delegate.h" | ||
|
||
#include "chrome/browser/browser_process.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
namespace ash { | ||
|
||
class ChromeOsFeedbackDelegateTest : public testing::Test { | ||
public: | ||
ChromeOsFeedbackDelegateTest() {} | ||
~ChromeOsFeedbackDelegateTest() override = default; | ||
|
||
protected: | ||
ChromeOsFeedbackDelegate feedback_delegate_; | ||
}; | ||
|
||
// Test GetApplicationLocale returns a valid locale. | ||
TEST_F(ChromeOsFeedbackDelegateTest, GetApplicationLocale) { | ||
EXPECT_EQ(feedback_delegate_.GetApplicationLocale(), "en"); | ||
} | ||
|
||
} // 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
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