Skip to content

Commit

Permalink
Files: Add support for Email layouts
Browse files Browse the repository at this point in the history
By this CL, Email layouts shown in Drive folder have icon, file-type description, and file extension and opens with double click flow.

https: //screenshot.googleplex.com/4xrjzaQnYB36wNr
Bug: chromium:1515210
Change-Id: Ie5e9dce90433a19b1529455f7b21053dec2663d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5152749
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1243877}
  • Loading branch information
Jérémie Boulic authored and Chromium LUCI CQ committed Jan 7, 2024
1 parent 94f7341 commit 4f3908a
Show file tree
Hide file tree
Showing 17 changed files with 105 additions and 12 deletions.
4 changes: 4 additions & 0 deletions ash/webui/file_manager/resources/labs/labs.html
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ <h2 class="widget">Icons</h2>
<span>type="gsite"</span>
<xf-icon type="gsite"></xf-icon>
</div>
<div class="icon-wrapper">
<span>type="gmaillayout"</span>
<xf-icon type="gmaillayout"></xf-icon>
</div>
<div class="icon-wrapper">
<span>type="gslides"</span>
<xf-icon type="gslides"></xf-icon>
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/ash/file_manager/file_manager_string_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ void AddStringsForFileTypes(base::Value::Dict* dict) {
IDS_FILE_BROWSER_GSHEET_DOCUMENT_FILE_TYPE);
SET_STRING("GSITE_DOCUMENT_FILE_TYPE",
IDS_FILE_BROWSER_GSITE_DOCUMENT_FILE_TYPE);
SET_STRING("EMAIL_LAYOUTS_DOCUMENT_FILE_TYPE",
IDS_FILE_BROWSER_EMAIL_LAYOUTS_DOCUMENT_FILE_TYPE);
SET_STRING("GSLIDES_DOCUMENT_FILE_TYPE",
IDS_FILE_BROWSER_GSLIDES_DOCUMENT_FILE_TYPE);
SET_STRING("GTABLE_DOCUMENT_FILE_TYPE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ std::unique_ptr<web_app::WebAppInstallInfo> CreateWebAppInfoForFileManager() {
});

// Drive & Google Docs:
AppendFileHandler(*info, "open-hosted-generic",
{"gdraw", "gtable", "gform", "gmaps", "gsite", "glink"});
AppendFileHandler(
*info, "open-hosted-generic",
{"gdraw", "gtable", "gform", "gmaps", "gsite", "glink", "gmaillayout"});
AppendFileHandler(*info, "open-hosted-gdoc", {"gdoc"});
AppendFileHandler(*info, "open-hosted-gsheet", {"gsheet"});
AppendFileHandler(*info, "open-hosted-gslides", {"gslides"});
Expand Down
4 changes: 4 additions & 0 deletions chromeos/ui/base/file_icon_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ const std::map<IconType, IconParams>& GetIconTypeToIconParamsMap() {
IconParams{raw_ref(kFiletypeGsheetIcon), ColorId::kGreen}},
{IconType::kGsite,
IconParams{raw_ref(kFiletypeGsiteIcon), ColorId::kFiletypeGsite}},
{IconType::kGmaillayout,
IconParams{raw_ref(kFiletypeGmaillayoutIcon), ColorId::kRed}},
{IconType::kGslide,
IconParams{raw_ref(kFiletypeGslidesIcon), ColorId::kYellow}},
{IconType::kGtable,
Expand Down Expand Up @@ -302,6 +304,7 @@ IconType GetIconTypeForPath(const base::FilePath& filepath) {
{".GFORM", IconType::kGform},
{".GMAPS", IconType::kGmap},
{".GSITE", IconType::kGsite},
{".GMAILLAYOUT", IconType::kGmaillayout},

// Other
{".PDF", IconType::kPdf},
Expand Down Expand Up @@ -348,6 +351,7 @@ IconType GetIconTypeFromString(const std::string& icon_type_string) {
{"gmap", IconType::kGmap},
{"gsheet", IconType::kGsheet},
{"gsite", IconType::kGsite},
{"gmaillayout", IconType::kGmaillayout},
{"gslides", IconType::kGslide},
{"gtable", IconType::kGtable},
{"image", IconType::kImage},
Expand Down
1 change: 1 addition & 0 deletions chromeos/ui/base/file_icon_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ enum class IconType {
kGmap,
kGsheet,
kGsite,
kGmaillayout,
kGslide,
kGtable,
kLinux,
Expand Down
1 change: 1 addition & 0 deletions chromeos/ui/vector_icons/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ aggregate_vector_icons("chromeos_ui_vector_icons") {
"filetype_gmap.icon",
"filetype_gsheet.icon",
"filetype_gsite.icon",
"filetype_gmaillayout.icon",
"filetype_gslides.icon",
"filetype_gtable.icon",
"filetype_image.icon",
Expand Down
49 changes: 49 additions & 0 deletions chromeos/ui/vector_icons/filetype_gmaillayout.icon
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

CANVAS_DIMENSIONS, 20,
MOVE_TO, 6.4f, 13.21f,
R_H_LINE_TO, 1.12f,
V_LINE_TO, 9.66f,
LINE_TO, 10, 11.43f,
R_LINE_TO, 2.46f, -1.77f,
R_V_LINE_TO, 3.55f,
R_H_LINE_TO, 1.05f,
R_ARC_TO, 0.7f, 0.7f, 0, 0, 0, 0.43f, -0.14f,
R_ARC_TO, 0.43f, 0.43f, 0, 0, 0, 0.18f, -0.37f,
V_LINE_TO, 7.6f,
R_ARC_TO, 0.7f, 0.7f, 0, 0, 0, -0.27f, -0.57f,
R_ARC_TO, 0.95f, 0.95f, 0, 0, 0, -0.62f, -0.23f,
R_LINE_TO, -0.3f, 0.03f,
R_ARC_TO, 0.71f, 0.71f, 0, 0, 0, -0.26f, 0.13f,
R_LINE_TO, -2.69f, 2.2f,
R_LINE_TO, -2.61f, -2.13f,
R_ARC_TO, 1.19f, 1.19f, 0, 0, 0, -0.29f, -0.16f,
R_ARC_TO, 0.93f, 0.93f, 0, 0, 0, -0.33f, -0.06f,
R_ARC_TO, 0.91f, 0.91f, 0, 0, 0, -0.62f, 0.22f,
R_ARC_TO, 0.7f, 0.7f, 0, 0, 0, -0.25f, 0.56f,
R_V_LINE_TO, 5.08f,
R_CUBIC_TO, 0, 0.14f, 0.05f, 0.26f, 0.15f, 0.37f,
R_CUBIC_TO, 0.11f, 0.11f, 0.23f, 0.17f, 0.37f, 0.17f,
CLOSE,
MOVE_TO, 4.93f, 17,
R_CUBIC_TO, -0.54f, 0, -1, -0.19f, -1.37f, -0.56f,
ARC_TO, 1.86f, 1.86f, 0, 0, 1, 3, 15.07f,
V_LINE_TO, 4.93f,
R_CUBIC_TO, 0, -0.54f, 0.19f, -1, 0.56f, -1.37f,
CUBIC_TO, 3.94f, 3.2f, 4.4f, 3, 4.93f, 3,
R_H_LINE_TO, 10.14f,
R_CUBIC_TO, 0.54f, 0, 1, 0.19f, 1.37f, 0.56f,
R_CUBIC_TO, 0.37f, 0.38f, 0.56f, 0.83f, 0.56f, 1.37f,
R_V_LINE_TO, 10.14f,
R_CUBIC_TO, 0, 0.54f, -0.19f, 1, -0.56f, 1.37f,
R_CUBIC_TO, -0.38f, 0.37f, -0.83f, 0.56f, -1.37f, 0.56f,
H_LINE_TO, 4.93f,
CLOSE,
R_MOVE_TO, 0, -1.93f,
R_H_LINE_TO, 10.14f,
V_LINE_TO, 4.93f,
H_LINE_TO, 4.93f,
R_V_LINE_TO, 10.14f,
CLOSE
16 changes: 8 additions & 8 deletions components/drive/drive_api_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ struct HostedDocumentKind {
};

const HostedDocumentKind kHostedDocumentKinds[] = {
{kGoogleDocumentMimeType, ".gdoc"},
{kGoogleSpreadsheetMimeType, ".gsheet"},
{kGoogleDocumentMimeType, ".gdoc"},
{kGoogleSpreadsheetMimeType, ".gsheet"},
{kGooglePresentationMimeType, ".gslides"},
{kGoogleDrawingMimeType, ".gdraw"},
{kGoogleTableMimeType, ".gtable"},
{kGoogleFormMimeType, ".gform"},
{kGoogleMapMimeType, ".gmaps"},
{kGoogleSiteMimeType, ".gsite"},
};
{kGoogleDrawingMimeType, ".gdraw"},
{kGoogleTableMimeType, ".gtable"},
{kGoogleFormMimeType, ".gform"},
{kGoogleMapMimeType, ".gmaps"},
{kGoogleSiteMimeType, ".gsite"},
{kEmailLayoutsMimeType, ".gmaillayout"}};

const char kUnknownHostedDocumentExtension[] = ".glink";

Expand Down
1 change: 1 addition & 0 deletions components/drive/drive_api_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const char kGoogleMapMimeType[] = "application/vnd.google-apps.map";
const char kGoogleSiteMimeType[] = "application/vnd.google-apps.site";
const char kDriveFolderMimeType[] = "application/vnd.google-apps.folder";
const char kEncryptedMimeType[] = "application/vnd.google-gsuite.encrypted";
const char kEmailLayoutsMimeType[] = "application/vnd.google-apps.mail-layout";

// Escapes ' to \' in the |str|. This is designed to use for string value of
// search parameter on Drive API v2.
Expand Down
3 changes: 3 additions & 0 deletions ui/chromeos/file_manager_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,9 @@
<message name="IDS_FILE_BROWSER_GSITE_DOCUMENT_FILE_TYPE" desc="Google site file type">
Google site
</message>
<message name="IDS_FILE_BROWSER_EMAIL_LAYOUTS_DOCUMENT_FILE_TYPE" desc="Email layouts file type">
Email layouts
</message>
<message name="IDS_FILE_BROWSER_GLINK_DOCUMENT_FILE_TYPE" desc="Google Drive link file type">
Google Drive link
</message>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ed8e64373229774b44d260735a6dfaf882101e86
8 changes: 8 additions & 0 deletions ui/file_manager/base/gn/file_types.json5
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,14 @@
"extensions": [".gsite"],
"mime": "application/vnd.google-apps.site"
},
{
"type": "hosted",
"icon": "gmaillayout",
"translationKey": "EMAIL_LAYOUTS_DOCUMENT_FILE_TYPE",
"subtype": "emaillayouts",
"extensions": [".gmaillayout"],
"mime": "application/vnd.google-apps.mail-layout"
},

// Others
{
Expand Down
1 change: 1 addition & 0 deletions ui/file_manager/file_manager/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ generate_grd("build_static_grdp") {
"foreground/images/filetype/filetype_gmap.svg",
"foreground/images/filetype/filetype_gsheet.svg",
"foreground/images/filetype/filetype_gsite.svg",
"foreground/images/filetype/filetype_gmaillayout.svg",
"foreground/images/filetype/filetype_gslides.svg",
"foreground/images/filetype/filetype_gtable.svg",
"foreground/images/filetype/filetype_image.svg",
Expand Down
12 changes: 11 additions & 1 deletion ui/file_manager/file_manager/foreground/css/file_types.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ body.check-select #list-container li[selected] [file-type-icon],
-webkit-mask-image: url(../images/filetype/filetype_gsite.svg);
}

[file-type-icon='gmaillayout'] {
-webkit-mask-image: url(../images/filetype/filetype_gmaillayout.svg);
}

[file-type-icon='image'] {
-webkit-mask-image: url(../images/filetype/filetype_image.svg);
}
Expand Down Expand Up @@ -214,6 +218,10 @@ body.check-select #list-container li[selected] [file-type-icon],
-webkit-mask-image: url(../images/filetype/filetype_gsite.svg);
}

.no-thumbnail[generic-thumbnail='gmaillayout'] {
-webkit-mask-image: url(../images/filetype/filetype_gmaillayout.svg);
}

.no-thumbnail[generic-thumbnail='pdf'] {
-webkit-mask-image: url(../images/filetype/filetype_pdf.svg);
}
Expand Down Expand Up @@ -250,13 +258,15 @@ body.check-select #list-container li[selected] [file-type-icon],
[file-type-icon='gmap'],
[file-type-icon='pdf'],
[file-type-icon='video'],
[file-type-icon='gmaillayout'],
.no-thumbnail[generic-thumbnail='audio'],
.no-thumbnail[generic-thumbnail='gdraw'],
.no-thumbnail[generic-thumbnail='image'],
.no-thumbnail[generic-thumbnail='gmap'],
.no-thumbnail[generic-thumbnail='pdf'],
.no-thumbnail[generic-thumbnail='raw'],
.no-thumbnail[generic-thumbnail='video'] {
.no-thumbnail[generic-thumbnail='video'],
.no-thumbnail[generic-thumbnail='gmaillayout'] {
background-color: var(--cros-sys-error);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<g id="gmap"><path fill="#EA4335" d="M15 3c1.1 0 2 .9 2 2v10c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2zm0 2H5v10h10V5zm-5 1c1.657 0 3 1.328 3 2.965 0 .967-.858 2.51-2.59 4.559l-.23.27L10 14l-.18-.206C7.935 11.61 7 9.974 7 8.965 7 7.328 8.343 6 10 6zm0 2a1 1 0 100 2 1 1 0 000-2z"/></g>
<g id="gsheet"><path fill="#34A853" d="M15 3a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V5c0-1.1.9-2 2-2zm0 2H5v10h10V5zm-5 1v2h4v2h-4v4H8v-4H6V8h2V6h2z"/></g>
<g id="gsite"><path fill="#796EEE" d="M5 3h10a2 2 0 012 1.85V15a2 2 0 01-1.85 2H5a2 2 0 01-2-1.85V5a2 2 0 011.85-2H15zm10 2H5v10h10V5zm-5 5v3H6v-3h4zm4 0v3h-3v-3h3zm0-3v2H6V7h8z"/></g>
<g id="gmaillayout"><path fill="#EA4335" d="M6.4 13.21h1.12V9.66L10 11.43l2.46-1.77v3.55h1.05a.7.7 0 0 0 .43-.14.43.43 0 0 0 .18-.37V7.6a.7.7 0 0 0-.27-.57.95.95 0 0 0-.62-.23l-.3.03a.71.71 0 0 0-.26.13l-2.69 2.2-2.61-2.13a1.19 1.19 0 0 0-.29-.16.93.93 0 0 0-.33-.06.91.91 0 0 0-.62.22.7.7 0 0 0-.25.56v5.08c0 .14.05.26.15.37.11.11.23.17.37.17ZM4.93 17c-.54 0-1-.19-1.37-.56A1.86 1.86 0 0 1 3 15.07V4.93c0-.54.19-1 .56-1.37C3.94 3.2 4.4 3 4.93 3h10.14c.54 0 1 .19 1.37.56.37.38.56.83.56 1.37v10.14c0 .54-.19 1-.56 1.37-.38.37-.83.56-1.37.56H4.93Zm0-1.93h10.14V4.93H4.93v10.14Z"/></g>
<g id="gslides"><path fill="#FBBC04" d="M15 3a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V5c0-1.1.9-2 2-2zm0 2H5v10h10V5zm-1 2v6H6V7h8z"/></g>
<g id="gtable"><path fill="#34A853" d="M5 3h10a2 2 0 012 1.85V15a2 2 0 01-1.85 2H5a2 2 0 01-2-1.85V5a2 2 0 011.85-2H15zm10 2H5v10h10V5zm-1 2.01v2.5l-4 4-2-2-2 2V11l2-2 2 2 4-4z"/></g>
<g id="image"><path fill="#EA4335" d="M15 3H5a2 2 0 00-2 2v10c0 1.1.9 2 2 2h10a2 2 0 002-2V5a2 2 0 00-2-2zm0 12H5V5h10v10zm-3.67-6L9.5 12 8 10.6 6 14h8l-2.67-5z"/></g>
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion ui/file_manager/file_manager/widgets/xf_icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ function getCSS() {
-webkit-mask-image: url(../foreground/images/filetype/filetype_gsite.svg);
}
:host([type="gmaillayout"]) span {
-webkit-mask-image: url(../foreground/images/filetype/filetype_gmaillayout.svg);
}
:host([type="gslides"]) span {
-webkit-mask-image: url(../foreground/images/filetype/filetype_gslides.svg);
}
Expand Down Expand Up @@ -434,7 +438,8 @@ function getCSS() {
:host([type='image']) span,
:host([type='gmap']) span,
:host([type='pdf']) span,
:host([type='video']) span {
:host([type='video']) span,
:host([type='gmaillayout']) span {
background-color: var(--cros-sys-error);
}
Expand Down

0 comments on commit 4f3908a

Please sign in to comment.