Commit fdfd0e24 authored by Mike Wasserman's avatar Mike Wasserman Committed by Commit Bot

NativeFS: Update dialog, icon, and tooltip string resources

Update the strings in accordance with the latest UX specs.
Remove bold emphasis in omnibox usage bubbles (keep it for prompts).
Update screenshots and sha1 files.

Consolidate IDS_NATIVE_FILE_SYSTEM_WRITE_PERMISSION_*_TITLE
Remove now unused |NativeFileSystemPermissionView::is_directory_|.

See updated screenshots in the associated bugs.

Bug: 995897, 996336
Change-Id: I0063b80e2a0fa4fe1442b90029011016d2d808b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1764267Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Commit-Queue: Michael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689506}
parent f54f60c5
......@@ -9582,52 +9582,49 @@ Please help our engineers fix this problem. Tell us what happened right before y
</message>
<!-- Native File System permission dialog -->
<message name="IDS_NATIVE_FILE_SYSTEM_WRITE_PERMISSION_FILE_TITLE" desc="Title of dialog for confirming write access to a file using the Native File System API">
Save changes to <ph name="FILENAME">$1<ex>README.md</ex></ph>?
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_WRITE_PERMISSION_DIRECTORY_TITLE" desc="Title of dialog for confirming write access to a directory and the files it contains using the Native File System API">
Save changes to files?
<message name="IDS_NATIVE_FILE_SYSTEM_WRITE_PERMISSION_TITLE" desc="Title of dialog for confirming write access to a file, or a directory and the files it contains, using the Native File System API">
Save changes to <ph name="FILE_OR_FOLDER_NAME">$1<ex>README.md</ex></ph>?
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_WRITE_PERMISSION_FILE_TEXT" desc="Text of the dialog for confirming write access to files using the Native File System API">
<ph name="ORIGIN">$1<ex>example.com</ex></ph> will be able to save your changes directly to <ph name="FILENAME">$2<ex>README.md</ex></ph>. The site can save changes until you close this tab.
<ph name="ORIGIN">$1<ex>example.com</ex></ph> will be able to edit <ph name="FILENAME">$2<ex>README.md</ex></ph> until you close this tab
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_WRITE_PERMISSION_DIRECTORY_TEXT" desc="Text of the dialog for confirming write access to a directory using the Native File System API">
<ph name="ORIGIN">$1<ex>example.com</ex></ph> will be able to save your changes directly to the files in <ph name="FOLDERNAME">$2<ex>My Project</ex></ph>. The site can save changes until you close this tab.
<ph name="ORIGIN">$1<ex>example.com</ex></ph> will be able to edit files in <ph name="FOLDERNAME">$2<ex>My Project</ex></ph> until you close this tab
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_WRITE_PERMISSION_ALLOW_TEXT" desc="Text of the 'allow' button in the dialog for confirming write access to files or directories using the Native File System API">
Save changes
</message>
<!-- Native File System usage indicator -->
<message name="IDS_NATIVE_FILE_SYSTEM_WRITE_USAGE_TOOLTIP" desc="Tooltip for native file system omnibox usage indicator.">
This page is allowed to save to files.
<message name="IDS_NATIVE_FILE_SYSTEM_WRITE_USAGE_TOOLTIP" desc="Tooltip for the omnibox Native File System API file write access usage indicator.">
This page is allowed to edit files
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_DIRECTORY_USAGE_TOOLTIP" desc="Tooltip for native file system omnibox usage indicator.">
This page is allowed to view all the files in a folder on your device.
<message name="IDS_NATIVE_FILE_SYSTEM_DIRECTORY_USAGE_TOOLTIP" desc="Tooltip for the omnibox Native File System API directory read access usage indicator.">
This page is allowed to view files
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_USAGE_BUBBLE_SINGLE_WRITABLE_FILE_TEXT" desc="Text of the bubble showing what file an origin can currently write to">
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can save your changes directly to <ph name="FILENAME">$2<ex>README.md</ex></ph>
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can edit <ph name="FILENAME">$2<ex>README.md</ex></ph>
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_USAGE_BUBBLE_WRITABLE_FILES_TEXT" desc="Text of the bubble showing what files an origin can currently write to">
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can save your changes directly to the following files
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can edit the following files
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_USAGE_BUBBLE_SINGLE_WRITABLE_DIRECTORY_TEXT" desc="Text of the bubble showing what file an origin can currently write to">
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can save your changes directly to the files in <ph name="FOLDERNAME">$2<ex>My Project</ex></ph>
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can edit files in <ph name="FOLDERNAME">$2<ex>My Project</ex></ph>
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_USAGE_BUBBLE_WRITABLE_DIRECTORIES_TEXT" desc="Text of the bubble showing what files an origin can currently write to">
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can save your changes directly to the following folders
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can edit files in the following folders
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_USAGE_BUBBLE_WRITABLE_FILES_AND_DIRECTORIES_TEXT" desc="Text of the bubble showing what files and directories an origin can currently write to">
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can save your changes directly to the following files and folders
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can edit the following files and folders
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_USAGE_BUBBLE_SINGLE_READABLE_DIRECTORY_TEXT" desc="Text of the bubble showing what files and directories an origin can currently access">
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can view all the files in <ph name="FOLDERNAME">$2<ex>My Project</ex></ph>
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can view files in <ph name="FOLDERNAME">$2<ex>My Project</ex></ph>
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_USAGE_BUBBLE_READABLE_DIRECTORIES_TEXT" desc="Text of the bubble showing what files and directories an origin can currently access">
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can view all the files in the following folders
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can view files in the following folders
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_USAGE_BUBBLE_READ_AND_WRITE" desc="Text of the bubble showing what files and directories an origin can currently read and write to">
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can view and save your changes directly to the following files and folders
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can view and edit the following files and folders
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_USAGE_BUBBLE_SAVE_CHANGES" desc="Sub-heading for the files and directories with write access in the bubble showing what files and directories an origin can currently read and write to">
Save changes
......@@ -9652,13 +9649,12 @@ Please help our engineers fix this problem. Tell us what happened right before y
Remove access
</message>
<!-- Native File System restricted directory dialog. -->
<message name="IDS_NATIVE_FILE_SYSTEM_RESTRICTED_DIRECTORY_TITLE" desc="Title of dialog explaining that the user selected a directory that chrome doesn't want to expose to the web">
Can't save to this folder
Can't open this folder
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_RESTRICTED_DIRECTORY_TEXT" desc="Text of dialog explaining that the user selected a directory that chrome doesn't want to expose to the web">
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can't save your changes to this folder because it contains system files.
<ph name="ORIGIN">$1<ex>example.com</ex></ph> can’t open this folder because it contains system files
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_RESTRICTED_DIRECTORY_BUTTON" desc="Text of the button in dialog explaining that the user selected a directory that chrome doesn't want to expose to the web">
Choose a different folder
......@@ -9669,7 +9665,7 @@ Please help our engineers fix this problem. Tell us what happened right before y
Let site view files?
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_DIRECTORY_ACCESS_CONFIRMATION_TEXT" desc="Text of dialog asking user if they intended to share a particular directory">
<ph name="ORIGIN">$1<ex>example.com</ex></ph> will be able to view all files in <ph name="FOLDERNAME">$2<ex>My Project</ex></ph>. The site can see any changes to the folder until you close this tab.
<ph name="ORIGIN">$1<ex>example.com</ex></ph> will be able to view files in <ph name="FOLDERNAME">$2<ex>My Project</ex></ph> until you close this tab
</message>
<message name="IDS_NATIVE_FILE_SYSTEM_DIRECTORY_ACCESS_ALLOW_BUTTON" desc="'allow' button in the dialog asking user if they intended to share a particular directory">
View files
......
dbed12d443f94d3bc837a36e0aeaffd3055f87fe
\ No newline at end of file
48ae7d22e59b87281731fa6835d6b0f7b069aca4
\ No newline at end of file
049a6d45394564470fc23a92bef7138820c44584
\ No newline at end of file
c4c427cb4eef716826103400f45842ada9ab48d3
\ No newline at end of file
8f6df1b3e036b7d1ff3f02ffb177ce99865ad7cb
\ No newline at end of file
263fa381876130a9129a6daa4c112396a517e5ff
\ No newline at end of file
8f6df1b3e036b7d1ff3f02ffb177ce99865ad7cb
\ No newline at end of file
263fa381876130a9129a6daa4c112396a517e5ff
\ No newline at end of file
edcf9f394c3de9af7143861411c0eb121c3d65b4
\ No newline at end of file
5e30f0e866a6baaed62c2abe8cf1f57f3175371e
\ No newline at end of file
5564454b096c01c6de41b589c0ded15948ece183
\ No newline at end of file
1936390f40340293e97c050ca2e3cd8d5933231d
\ No newline at end of file
8335ae562c56c2ba5cfc915797c5cd76c6452b9c
\ No newline at end of file
f7dedb9c627b7a93480a3ad816f8911c99d8609a
\ No newline at end of file
92e8302ca50fb27b0a040eab64d41f2e380894e2
\ No newline at end of file
c11cfb3d33dab1bbe55c355613246d17fbf72d8b
\ No newline at end of file
583d8fa1374a7ea61241273e3400228221000957
\ No newline at end of file
1a166812936560e45d2da7ab3bdbcf5384c48a41
\ No newline at end of file
fdb4c6f3baf4e087864e057b7ef5d32206119b29
\ No newline at end of file
4234290430d0df094e00e02f3defec5e68522f56
\ No newline at end of file
048007a2648e05510dd461b8e8a9481793eda592
\ No newline at end of file
bf7163b7c7743069d10e00cfd8d3652b63f2a909
\ No newline at end of file
b9eba5fa06cefda8b8c41c7d6987c140d2f0873e
\ No newline at end of file
de8331433072adff0da31318dd5b42835b0186fa
\ No newline at end of file
8ed3a2331e2b5c6d9c1ead047e9a580eb977c822
\ No newline at end of file
bda19accb951e8ce69c3bd05c796b4808fcc079f
\ No newline at end of file
4d38a4af9ba5cc2ceb9371cec583cdf4cba3a837
\ No newline at end of file
c7a847985045f0828c88476042493aafc4d606e1
\ No newline at end of file
c7a847985045f0828c88476042493aafc4d606e1
\ No newline at end of file
69050329232ce379cccc6a17554ee70d4f18130c
\ No newline at end of file
97f766f9499aaa3061badaeb2577ffce19765f74
\ No newline at end of file
......@@ -111,7 +111,7 @@ NativeFileSystemDirectoryAccessConfirmationView::
AddChildView(native_file_system_ui_helper::CreateOriginPathLabel(
IDS_NATIVE_FILE_SYSTEM_DIRECTORY_ACCESS_CONFIRMATION_TEXT, origin, path,
CONTEXT_BODY_TEXT_SMALL));
CONTEXT_BODY_TEXT_SMALL, /*show_emphasis=*/true));
}
void ShowNativeFileSystemDirectoryAccessConfirmationDialog(
......
......@@ -25,7 +25,7 @@ NativeFileSystemPermissionView::NativeFileSystemPermissionView(
const base::FilePath& path,
bool is_directory,
base::OnceCallback<void(PermissionAction result)> callback)
: path_(path), is_directory_(is_directory), callback_(std::move(callback)) {
: path_(path), callback_(std::move(callback)) {
const views::LayoutProvider* provider = ChromeLayoutProvider::Get();
SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical,
......@@ -35,7 +35,7 @@ NativeFileSystemPermissionView::NativeFileSystemPermissionView(
AddChildView(native_file_system_ui_helper::CreateOriginPathLabel(
is_directory ? IDS_NATIVE_FILE_SYSTEM_WRITE_PERMISSION_DIRECTORY_TEXT
: IDS_NATIVE_FILE_SYSTEM_WRITE_PERMISSION_FILE_TEXT,
origin, path, CONTEXT_BODY_TEXT_SMALL));
origin, path, CONTEXT_BODY_TEXT_SMALL, /*show_emphasis=*/true));
}
NativeFileSystemPermissionView::~NativeFileSystemPermissionView() {
......@@ -57,12 +57,8 @@ views::Widget* NativeFileSystemPermissionView::ShowDialog(
}
base::string16 NativeFileSystemPermissionView::GetWindowTitle() const {
if (is_directory_) {
return l10n_util::GetStringUTF16(
IDS_NATIVE_FILE_SYSTEM_WRITE_PERMISSION_DIRECTORY_TITLE);
}
return l10n_util::GetStringFUTF16(
IDS_NATIVE_FILE_SYSTEM_WRITE_PERMISSION_FILE_TITLE,
IDS_NATIVE_FILE_SYSTEM_WRITE_PERMISSION_TITLE,
path_.BaseName().LossyDisplayName());
}
......
......@@ -63,7 +63,6 @@ class NativeFileSystemPermissionView : public views::DialogDelegateView {
base::OnceCallback<void(PermissionAction result)> callback);
const base::FilePath path_;
const bool is_directory_;
base::OnceCallback<void(PermissionAction result)> callback_;
DISALLOW_COPY_AND_ASSIGN(NativeFileSystemPermissionView);
......
......@@ -99,7 +99,7 @@ NativeFileSystemRestrictedDirectoryDialogView::
AddChildView(native_file_system_ui_helper::CreateOriginLabel(
IDS_NATIVE_FILE_SYSTEM_RESTRICTED_DIRECTORY_TEXT, origin,
CONTEXT_BODY_TEXT_LARGE));
CONTEXT_BODY_TEXT_LARGE, /*show_emphasis=*/true));
}
void ShowNativeFileSystemRestrictedDirectoryDialog(
......
......@@ -14,7 +14,8 @@ namespace native_file_system_ui_helper {
std::unique_ptr<views::View> CreateOriginLabel(int message_id,
const url::Origin& origin,
int text_context) {
int text_context,
bool show_emphasis) {
base::string16 formatted_origin =
url_formatter::FormatOriginForSecurityDisplay(
origin, url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC);
......@@ -26,17 +27,20 @@ std::unique_ptr<views::View> CreateOriginLabel(int message_id,
label->SetDefaultTextStyle(STYLE_SECONDARY);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
views::StyledLabel::RangeStyleInfo origin_style;
origin_style.text_style = STYLE_EMPHASIZED_SECONDARY;
label->AddStyleRange(gfx::Range(offset, offset + formatted_origin.length()),
origin_style);
if (show_emphasis) {
views::StyledLabel::RangeStyleInfo origin_style;
origin_style.text_style = STYLE_EMPHASIZED_SECONDARY;
label->AddStyleRange(gfx::Range(offset, offset + formatted_origin.length()),
origin_style);
}
return label;
}
std::unique_ptr<views::View> CreateOriginPathLabel(int message_id,
const url::Origin& origin,
const base::FilePath& path,
int text_context) {
int text_context,
bool show_emphasis) {
base::string16 formatted_origin =
url_formatter::FormatOriginForSecurityDisplay(
origin, url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC);
......@@ -52,14 +56,17 @@ std::unique_ptr<views::View> CreateOriginPathLabel(int message_id,
label->SetDefaultTextStyle(STYLE_SECONDARY);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
views::StyledLabel::RangeStyleInfo origin_style;
origin_style.text_style = STYLE_EMPHASIZED_SECONDARY;
label->AddStyleRange(
gfx::Range(offsets[0], offsets[0] + formatted_origin.length()),
origin_style);
if (show_emphasis) {
views::StyledLabel::RangeStyleInfo origin_style;
origin_style.text_style = STYLE_EMPHASIZED_SECONDARY;
label->AddStyleRange(
gfx::Range(offsets[0], offsets[0] + formatted_origin.length()),
origin_style);
}
views::StyledLabel::RangeStyleInfo path_style;
path_style.text_style = STYLE_EMPHASIZED_SECONDARY;
if (show_emphasis)
path_style.text_style = STYLE_EMPHASIZED_SECONDARY;
path_style.tooltip = path.LossyDisplayName();
label->AddStyleRange(
gfx::Range(offsets[1], offsets[1] + formatted_path.length()), path_style);
......
......@@ -21,18 +21,21 @@ class View;
namespace native_file_system_ui_helper {
// Creates and returns a label where the place holder is replaced with |origin|,
// while formatting the origin as emphasized text.
// Creates and returns a label where the place holder is replaced with |origin|.
// If |show_emphasis| is true, the origin is formatted as emphasized text.
std::unique_ptr<views::View> CreateOriginLabel(int message_id,
const url::Origin& origin,
int text_context);
int text_context,
bool show_emphasis);
// Creates and returns a label where the place holders are replaced with
// |origin| and |path|, while formatting the origin and path as emphasized text.
// |origin| and |path|. If |show_emphasis| is true, the origin and path are
// formatted as emphasized text.
std::unique_ptr<views::View> CreateOriginPathLabel(int message_id,
const url::Origin& origin,
const base::FilePath& path,
int text_context);
int text_context,
bool show_emphasis);
} // namespace native_file_system_ui_helper
......
......@@ -132,7 +132,7 @@ class CollapsibleListView : public views::View, public views::ButtonListener {
model->RowCount(), first_item, second_item);
}
auto* label = label_container->AddChildView(std::make_unique<views::Label>(
label_text, CONTEXT_BODY_TEXT_SMALL, STYLE_EMPHASIZED_SECONDARY));
label_text, CONTEXT_BODY_TEXT_SMALL, STYLE_SECONDARY));
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label_layout->SetFlexForView(label, 1);
auto button = views::CreateVectorToggleImageButton(this);
......@@ -352,17 +352,19 @@ void NativeFileSystemUsageBubbleView::Init() {
if (!embedded_path.empty()) {
AddChildView(native_file_system_ui_helper::CreateOriginPathLabel(
heading_message_id, origin_, embedded_path, CONTEXT_BODY_TEXT_LARGE));
heading_message_id, origin_, embedded_path, CONTEXT_BODY_TEXT_LARGE,
/*show_emphasis=*/false));
} else {
AddChildView(native_file_system_ui_helper::CreateOriginLabel(
heading_message_id, origin_, CONTEXT_BODY_TEXT_LARGE));
heading_message_id, origin_, CONTEXT_BODY_TEXT_LARGE,
/*show_emphasis=*/false));
if (writable_paths_model_.RowCount() > 0) {
if (readable_paths_model_.RowCount() > 0) {
auto label = std::make_unique<views::Label>(
l10n_util::GetStringUTF16(
IDS_NATIVE_FILE_SYSTEM_USAGE_BUBBLE_SAVE_CHANGES),
CONTEXT_BODY_TEXT_LARGE, STYLE_EMPHASIZED_SECONDARY);
CONTEXT_BODY_TEXT_LARGE, STYLE_SECONDARY);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
AddChildView(std::move(label));
}
......@@ -375,7 +377,7 @@ void NativeFileSystemUsageBubbleView::Init() {
auto label = std::make_unique<views::Label>(
l10n_util::GetStringUTF16(
IDS_NATIVE_FILE_SYSTEM_USAGE_BUBBLE_VIEW_CHANGES),
CONTEXT_BODY_TEXT_LARGE, STYLE_EMPHASIZED_SECONDARY);
CONTEXT_BODY_TEXT_LARGE, STYLE_SECONDARY);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
AddChildView(std::move(label));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment