Commit ba279169 authored by Jason Lin's avatar Jason Lin Committed by Commit Bot

crostini: Host terminal setting in an app popup browser

Bug: 999950
Change-Id: I03ce5446f7eb0468a9c24b084b37b039a6fe2fea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1952045Reviewed-by: default avatarBen Wells <benwells@chromium.org>
Reviewed-by: default avatarJoel Hockey <joelhockey@chromium.org>
Commit-Queue: Jason Lin <lxj@google.com>
Cr-Commit-Position: refs/heads/master@{#727302}
parent 1e938d2c
...@@ -102,4 +102,12 @@ void LaunchContainerTerminal(Profile* profile, ...@@ -102,4 +102,12 @@ void LaunchContainerTerminal(Profile* profile,
ShowContainerTerminal(profile, launch_params, vsh_in_crosh_url, browser); ShowContainerTerminal(profile, launch_params, vsh_in_crosh_url, browser);
} }
void LaunchTerminalSettings(Profile* profile) {
DCHECK(base::FeatureList::IsEnabled(features::kTerminalSystemApp));
web_app::LaunchSystemWebApp(profile, web_app::SystemAppType::TERMINAL,
GURL(std::string(chrome::kChromeUITerminalURL) +
"html/terminal_settings.html"),
/*is_popup=*/true);
}
} // namespace crostini } // namespace crostini
...@@ -44,6 +44,9 @@ void LaunchContainerTerminal(Profile* profile, ...@@ -44,6 +44,9 @@ void LaunchContainerTerminal(Profile* profile,
const std::string& container_name, const std::string& container_name,
const std::vector<std::string>& terminal_args); const std::vector<std::string>& terminal_args);
// Launches the terminal settings popup window.
void LaunchTerminalSettings(Profile* profile);
} // namespace crostini } // namespace crostini
#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_TERMINAL_H_ #endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_TERMINAL_H_
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/chromeos/crostini/crostini_terminal.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_navigator_params.h"
...@@ -46,9 +47,12 @@ bool TerminalSystemAppMenuModel::IsCommandIdEnabled(int command_id) const { ...@@ -46,9 +47,12 @@ bool TerminalSystemAppMenuModel::IsCommandIdEnabled(int command_id) const {
void TerminalSystemAppMenuModel::ExecuteCommand(int command_id, void TerminalSystemAppMenuModel::ExecuteCommand(int command_id,
int event_flags) { int event_flags) {
if (command_id == IDC_OPTIONS) {
crostini::LaunchTerminalSettings(browser()->profile());
return;
}
static const base::NoDestructor<base::flat_map<int, std::string>> kCommands({ static const base::NoDestructor<base::flat_map<int, std::string>> kCommands({
// Opens settings page.
{IDC_OPTIONS, "options"},
// Split the currently selected pane vertically. // Split the currently selected pane vertically.
{IDC_TERMINAL_SPLIT_VERTICAL, "splitv"}, {IDC_TERMINAL_SPLIT_VERTICAL, "splitv"},
// Split the currently selected pane horizontally. // Split the currently selected pane horizontally.
......
...@@ -188,7 +188,10 @@ bool AppBrowserController::HasTitlebarToolbar() const { ...@@ -188,7 +188,10 @@ bool AppBrowserController::HasTitlebarToolbar() const {
// Show titlebar toolbar for Terminal System App, but not other system apps. // Show titlebar toolbar for Terminal System App, but not other system apps.
// TODO(crbug.com/846546): Generalise this as a SystemWebApp capability. // TODO(crbug.com/846546): Generalise this as a SystemWebApp capability.
if (is_for_system_web_app()) if (is_for_system_web_app())
return system_app_type_ == web_app::SystemAppType::TERMINAL; return system_app_type_ == web_app::SystemAppType::TERMINAL &&
// SWA terminal has a setting window, which has browser type "app
// popup". We don't want it to have the toolbar.
!browser_->is_type_app_popup();
// Show for all other apps. // Show for all other apps.
return true; return true;
......
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