Commit 99bb071b authored by Nicholas Verne's avatar Nicholas Verne Committed by Commit Bot

Rename CrostiniUpgradeContainerView to CrostiniUpdateFilesystemView

This will distinguish it from the "real" container upgrade (which upgrades the
Linux distribution)

Bug: 1025629
Change-Id: Icc35ccdbbbf500ba5b9d008c81d9a1880bfffbdd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1923207
Auto-Submit: Nicholas Verne <nverne@chromium.org>
Reviewed-by: default avatarNic Hollingum <hollingum@google.com>
Commit-Queue: Nic Hollingum <hollingum@google.com>
Cr-Commit-Position: refs/heads/master@{#716450}
parent ceddf8ec
...@@ -410,7 +410,7 @@ class CrostiniManager::CrostiniRestarter ...@@ -410,7 +410,7 @@ class CrostiniManager::CrostiniRestarter
void StartLxdContainerFinished(CrostiniResult result) { void StartLxdContainerFinished(CrostiniResult result) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
CloseCrostiniUpgradeContainerView(); CloseCrostiniUpdateFilesystemView();
for (auto& observer : observer_list_) { for (auto& observer : observer_list_) {
observer.OnContainerStarted(result); observer.OnContainerStarted(result);
} }
...@@ -2414,7 +2414,7 @@ void CrostiniManager::OnStartLxdContainer( ...@@ -2414,7 +2414,7 @@ void CrostiniManager::OnStartLxdContainer(
case vm_tools::cicerone::StartLxdContainerResponse::REMAPPING: case vm_tools::cicerone::StartLxdContainerResponse::REMAPPING:
// Run the update container dialog to warn users of delays. // Run the update container dialog to warn users of delays.
// The callback will be called when we receive the LxdContainerStarting // The callback will be called when we receive the LxdContainerStarting
PrepareShowCrostiniUpgradeContainerView(profile_, PrepareShowCrostiniUpdateFilesystemView(profile_,
CrostiniUISurface::kAppList); CrostiniUISurface::kAppList);
// signal. // signal.
// Then perform the same steps as for starting. // Then perform the same steps as for starting.
......
...@@ -139,15 +139,15 @@ void ShowCrostiniUpdateComponentView(Profile* profile, ...@@ -139,15 +139,15 @@ void ShowCrostiniUpdateComponentView(Profile* profile,
// Shows the Crostini Container Upgrade dialog (for running upgrades in the // Shows the Crostini Container Upgrade dialog (for running upgrades in the
// container). // container).
void ShowCrostiniUpgradeContainerView(Profile* profile, void ShowCrostiniUpdateFilesystemView(Profile* profile,
CrostiniUISurface ui_surface); CrostiniUISurface ui_surface);
// Show the Crostini Container Upgrade dialog after a delay // Show the Crostini Container Upgrade dialog after a delay
// (CloseCrostiniUpgradeContainerView will cancel the next dialog show). // (CloseCrostiniUpdateFilesystemView will cancel the next dialog show).
void PrepareShowCrostiniUpgradeContainerView(Profile* profile, void PrepareShowCrostiniUpdateFilesystemView(Profile* profile,
CrostiniUISurface ui_surface); CrostiniUISurface ui_surface);
// Closes the current CrostiniUpgradeContainerView or ensures that the view will // Closes the current CrostiniUpdateFilesystemView or ensures that the view will
// not open until PrepareShowCrostiniUpgradeContainerView is called again. // not open until PrepareShowCrostiniUpdateFilesystemView is called again.
void CloseCrostiniUpgradeContainerView(); void CloseCrostiniUpdateFilesystemView();
// Show the Crostini Software Config dialog (for installing Ansible and // Show the Crostini Software Config dialog (for installing Ansible and
// applying an Ansible playbook in the container). // applying an Ansible playbook in the container).
......
...@@ -3768,8 +3768,8 @@ jumbo_static_library("ui") { ...@@ -3768,8 +3768,8 @@ jumbo_static_library("ui") {
"views/crostini/crostini_uninstaller_view.h", "views/crostini/crostini_uninstaller_view.h",
"views/crostini/crostini_update_component_view.cc", "views/crostini/crostini_update_component_view.cc",
"views/crostini/crostini_update_component_view.h", "views/crostini/crostini_update_component_view.h",
"views/crostini/crostini_upgrade_container_view.cc", "views/crostini/crostini_update_filesystem_view.cc",
"views/crostini/crostini_upgrade_container_view.h", "views/crostini/crostini_update_filesystem_view.h",
"views/plugin_vm/plugin_vm_launcher_view.cc", "views/plugin_vm/plugin_vm_launcher_view.cc",
"views/plugin_vm/plugin_vm_launcher_view.h", "views/plugin_vm/plugin_vm_launcher_view.h",
] ]
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/views/crostini/crostini_upgrade_container_view.h" #include "chrome/browser/ui/views/crostini/crostini_update_filesystem_view.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
namespace { namespace {
bool g_crostini_upgrade_container_should_skip_delay_for_testing = false; bool g_crostini_update_filesystem_should_skip_delay_for_testing = false;
CrostiniUpgradeContainerView* g_crostini_upgrade_container_view_dialog = CrostiniUpdateFilesystemView* g_crostini_update_filesystem_view_dialog =
nullptr; nullptr;
bool g_crostini_upgrade_container_should_show = false; bool g_crostini_update_filesystem_should_show = false;
// The time to delay before showing the upgrade container dialog (to decrease // The time to delay before showing the upgrade container dialog (to decrease
// flashiness). // flashiness).
constexpr base::TimeDelta kDelayBeforeUpgradeContainerDialog = constexpr base::TimeDelta kDelayBeforeUpgradeContainerDialog =
...@@ -42,68 +42,68 @@ constexpr char kCrostiniUpgradeContainerSourceHistogram[] = ...@@ -42,68 +42,68 @@ constexpr char kCrostiniUpgradeContainerSourceHistogram[] =
} // namespace } // namespace
namespace crostini { namespace crostini {
void SetCrostiniUpgradeSkipDelayForTesting(bool should_skip) { void SetCrostiniUpdateFilesystemSkipDelayForTesting(bool should_skip) {
g_crostini_upgrade_container_should_skip_delay_for_testing = should_skip; g_crostini_update_filesystem_should_skip_delay_for_testing = should_skip;
} }
void PrepareShowCrostiniUpgradeContainerView( void PrepareShowCrostiniUpdateFilesystemView(
Profile* profile, Profile* profile,
crostini::CrostiniUISurface ui_surface) { crostini::CrostiniUISurface ui_surface) {
g_crostini_upgrade_container_should_show = true; g_crostini_update_filesystem_should_show = true;
base::TimeDelta delay = base::TimeDelta delay =
g_crostini_upgrade_container_should_skip_delay_for_testing g_crostini_update_filesystem_should_skip_delay_for_testing
? base::TimeDelta::FromMilliseconds(0) ? base::TimeDelta::FromMilliseconds(0)
: kDelayBeforeUpgradeContainerDialog; : kDelayBeforeUpgradeContainerDialog;
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, FROM_HERE,
base::BindOnce(&ShowCrostiniUpgradeContainerView, profile, ui_surface), base::BindOnce(&ShowCrostiniUpdateFilesystemView, profile, ui_surface),
delay); delay);
} }
void ShowCrostiniUpgradeContainerView(Profile* profile, void ShowCrostiniUpdateFilesystemView(Profile* profile,
crostini::CrostiniUISurface ui_surface) { crostini::CrostiniUISurface ui_surface) {
if (g_crostini_upgrade_container_should_show) { if (g_crostini_update_filesystem_should_show) {
base::UmaHistogramEnumeration(kCrostiniUpgradeContainerSourceHistogram, base::UmaHistogramEnumeration(kCrostiniUpgradeContainerSourceHistogram,
ui_surface, ui_surface,
crostini::CrostiniUISurface::kCount); crostini::CrostiniUISurface::kCount);
CrostiniUpgradeContainerView::Show(profile); CrostiniUpdateFilesystemView::Show(profile);
} }
} }
void CloseCrostiniUpgradeContainerView() { void CloseCrostiniUpdateFilesystemView() {
if (g_crostini_upgrade_container_view_dialog) { if (g_crostini_update_filesystem_view_dialog) {
g_crostini_upgrade_container_view_dialog->GetWidget()->Close(); g_crostini_update_filesystem_view_dialog->GetWidget()->Close();
} }
g_crostini_upgrade_container_should_show = false; g_crostini_update_filesystem_should_show = false;
} }
} // namespace crostini } // namespace crostini
void CrostiniUpgradeContainerView::Show(Profile* profile) { void CrostiniUpdateFilesystemView::Show(Profile* profile) {
DCHECK(crostini::CrostiniFeatures::Get()->IsUIAllowed(profile)); DCHECK(crostini::CrostiniFeatures::Get()->IsUIAllowed(profile));
if (!g_crostini_upgrade_container_view_dialog) { if (!g_crostini_update_filesystem_view_dialog) {
g_crostini_upgrade_container_view_dialog = g_crostini_update_filesystem_view_dialog =
new CrostiniUpgradeContainerView(); new CrostiniUpdateFilesystemView();
CreateDialogWidget(g_crostini_upgrade_container_view_dialog, nullptr, CreateDialogWidget(g_crostini_update_filesystem_view_dialog, nullptr,
nullptr); nullptr);
} }
g_crostini_upgrade_container_view_dialog->GetWidget()->Show(); g_crostini_update_filesystem_view_dialog->GetWidget()->Show();
} }
int CrostiniUpgradeContainerView::GetDialogButtons() const { int CrostiniUpdateFilesystemView::GetDialogButtons() const {
return ui::DIALOG_BUTTON_OK; return ui::DIALOG_BUTTON_OK;
} }
base::string16 CrostiniUpgradeContainerView::GetWindowTitle() const { base::string16 CrostiniUpdateFilesystemView::GetWindowTitle() const {
return l10n_util::GetStringUTF16(IDS_CROSTINI_UPGRADING_LABEL); return l10n_util::GetStringUTF16(IDS_CROSTINI_UPGRADING_LABEL);
} }
bool CrostiniUpgradeContainerView::ShouldShowCloseButton() const { bool CrostiniUpdateFilesystemView::ShouldShowCloseButton() const {
return false; return false;
} }
gfx::Size CrostiniUpgradeContainerView::CalculatePreferredSize() const { gfx::Size CrostiniUpdateFilesystemView::CalculatePreferredSize() const {
const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric( const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_STANDALONE_BUBBLE_PREFERRED_WIDTH) - DISTANCE_STANDALONE_BUBBLE_PREFERRED_WIDTH) -
margins().width(); margins().width();
...@@ -111,12 +111,12 @@ gfx::Size CrostiniUpgradeContainerView::CalculatePreferredSize() const { ...@@ -111,12 +111,12 @@ gfx::Size CrostiniUpgradeContainerView::CalculatePreferredSize() const {
} }
// static // static
CrostiniUpgradeContainerView* CrostiniUpdateFilesystemView*
CrostiniUpgradeContainerView::GetActiveViewForTesting() { CrostiniUpdateFilesystemView::GetActiveViewForTesting() {
return g_crostini_upgrade_container_view_dialog; return g_crostini_update_filesystem_view_dialog;
} }
CrostiniUpgradeContainerView::CrostiniUpgradeContainerView() { CrostiniUpdateFilesystemView::CrostiniUpdateFilesystemView() {
constexpr int kDialogSpacingVertical = 32; constexpr int kDialogSpacingVertical = 32;
views::LayoutProvider* provider = views::LayoutProvider::Get(); views::LayoutProvider* provider = views::LayoutProvider::Get();
...@@ -136,6 +136,6 @@ CrostiniUpgradeContainerView::CrostiniUpgradeContainerView() { ...@@ -136,6 +136,6 @@ CrostiniUpgradeContainerView::CrostiniUpgradeContainerView() {
chrome::DialogIdentifier::CROSTINI_CONTAINER_UPGRADE); chrome::DialogIdentifier::CROSTINI_CONTAINER_UPGRADE);
} }
CrostiniUpgradeContainerView::~CrostiniUpgradeContainerView() { CrostiniUpdateFilesystemView::~CrostiniUpdateFilesystemView() {
g_crostini_upgrade_container_view_dialog = nullptr; g_crostini_update_filesystem_view_dialog = nullptr;
} }
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPGRADE_CONTAINER_VIEW_H_ #ifndef CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPDATE_FILESYSTEM_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPGRADE_CONTAINER_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPDATE_FILESYSTEM_VIEW_H_
#include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h"
class Profile; class Profile;
namespace crostini { namespace crostini {
void SetCrostiniUpgradeSkipDelayForTesting(bool should_skip); void SetCrostiniUpdateFilesystemSkipDelayForTesting(bool should_skip);
} // namespace crostini } // namespace crostini
// Provides a warning to the user that an upgrade is occurring and Crostini // Provides a warning to the user that an upgrade is occurring and Crostini
// start will take longer than usual. // start will take longer than usual.
class CrostiniUpgradeContainerView : public views::BubbleDialogDelegateView { class CrostiniUpdateFilesystemView : public views::BubbleDialogDelegateView {
public: public:
static void Show(Profile* profile); static void Show(Profile* profile);
...@@ -25,11 +25,11 @@ class CrostiniUpgradeContainerView : public views::BubbleDialogDelegateView { ...@@ -25,11 +25,11 @@ class CrostiniUpgradeContainerView : public views::BubbleDialogDelegateView {
bool ShouldShowCloseButton() const override; bool ShouldShowCloseButton() const override;
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
static CrostiniUpgradeContainerView* GetActiveViewForTesting(); static CrostiniUpdateFilesystemView* GetActiveViewForTesting();
private: private:
CrostiniUpgradeContainerView(); CrostiniUpdateFilesystemView();
~CrostiniUpgradeContainerView() override; ~CrostiniUpdateFilesystemView() override;
}; };
#endif // CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPGRADE_CONTAINER_VIEW_H_ #endif // CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPDATE_FILESYSTEM_VIEW_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/views/crostini/crostini_upgrade_container_view.h" #include "chrome/browser/ui/views/crostini/crostini_update_filesystem_view.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/metrics/histogram_base.h" #include "base/metrics/histogram_base.h"
...@@ -30,21 +30,21 @@ chromeos::FakeCiceroneClient* GetFakeCiceroneClient() { ...@@ -30,21 +30,21 @@ chromeos::FakeCiceroneClient* GetFakeCiceroneClient() {
chromeos::DBusThreadManager::Get()->GetCiceroneClient()); chromeos::DBusThreadManager::Get()->GetCiceroneClient());
} }
class CrostiniUpgradeContainerViewBrowserTest class CrostiniUpdateFilesystemViewBrowserTest
: public CrostiniDialogBrowserTest { : public CrostiniDialogBrowserTest {
public: public:
CrostiniUpgradeContainerViewBrowserTest() CrostiniUpdateFilesystemViewBrowserTest()
: CrostiniDialogBrowserTest(true /*register_termina*/) {} : CrostiniDialogBrowserTest(true /*register_termina*/) {}
// DialogBrowserTest: // DialogBrowserTest:
void ShowUi(const std::string& name) override { void ShowUi(const std::string& name) override {
PrepareShowCrostiniUpgradeContainerView( PrepareShowCrostiniUpdateFilesystemView(
browser()->profile(), crostini::CrostiniUISurface::kAppList); browser()->profile(), crostini::CrostiniUISurface::kAppList);
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
} }
CrostiniUpgradeContainerView* ActiveView() { CrostiniUpdateFilesystemView* ActiveView() {
return CrostiniUpgradeContainerView::GetActiveViewForTesting(); return CrostiniUpdateFilesystemView::GetActiveViewForTesting();
} }
bool HasAcceptButton() { bool HasAcceptButton() {
...@@ -72,19 +72,19 @@ class CrostiniUpgradeContainerViewBrowserTest ...@@ -72,19 +72,19 @@ class CrostiniUpgradeContainerViewBrowserTest
} }
private: private:
DISALLOW_COPY_AND_ASSIGN(CrostiniUpgradeContainerViewBrowserTest); DISALLOW_COPY_AND_ASSIGN(CrostiniUpdateFilesystemViewBrowserTest);
}; };
// Test the dialog is actually launched. // Test the dialog is actually launched.
IN_PROC_BROWSER_TEST_F(CrostiniUpgradeContainerViewBrowserTest, IN_PROC_BROWSER_TEST_F(CrostiniUpdateFilesystemViewBrowserTest,
InvokeUi_default) { InvokeUi_default) {
crostini::SetCrostiniUpgradeSkipDelayForTesting(true); crostini::SetCrostiniUpdateFilesystemSkipDelayForTesting(true);
ShowAndVerifyUi(); ShowAndVerifyUi();
} }
IN_PROC_BROWSER_TEST_F(CrostiniUpgradeContainerViewBrowserTest, HitOK) { IN_PROC_BROWSER_TEST_F(CrostiniUpdateFilesystemViewBrowserTest, HitOK) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
crostini::SetCrostiniUpgradeSkipDelayForTesting(true); crostini::SetCrostiniUpdateFilesystemSkipDelayForTesting(true);
ShowUi("default"); ShowUi("default");
ExpectView(); ExpectView();
...@@ -104,10 +104,10 @@ IN_PROC_BROWSER_TEST_F(CrostiniUpgradeContainerViewBrowserTest, HitOK) { ...@@ -104,10 +104,10 @@ IN_PROC_BROWSER_TEST_F(CrostiniUpgradeContainerViewBrowserTest, HitOK) {
1); 1);
} }
IN_PROC_BROWSER_TEST_F(CrostiniUpgradeContainerViewBrowserTest, IN_PROC_BROWSER_TEST_F(CrostiniUpdateFilesystemViewBrowserTest,
StartLxdContainerNoUpgradeNeeded) { StartLxdContainerNoUpgradeNeeded) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
crostini::SetCrostiniUpgradeSkipDelayForTesting(true); crostini::SetCrostiniUpdateFilesystemSkipDelayForTesting(true);
vm_tools::cicerone::StartLxdContainerResponse reply; vm_tools::cicerone::StartLxdContainerResponse reply;
reply.set_status(vm_tools::cicerone::StartLxdContainerResponse::STARTING); reply.set_status(vm_tools::cicerone::StartLxdContainerResponse::STARTING);
...@@ -118,10 +118,10 @@ IN_PROC_BROWSER_TEST_F(CrostiniUpgradeContainerViewBrowserTest, ...@@ -118,10 +118,10 @@ IN_PROC_BROWSER_TEST_F(CrostiniUpgradeContainerViewBrowserTest,
ExpectNoView(); ExpectNoView();
} }
IN_PROC_BROWSER_TEST_F(CrostiniUpgradeContainerViewBrowserTest, IN_PROC_BROWSER_TEST_F(CrostiniUpdateFilesystemViewBrowserTest,
StartLxdContainerUpgradeNeeded) { StartLxdContainerUpgradeNeeded) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
crostini::SetCrostiniUpgradeSkipDelayForTesting(true); crostini::SetCrostiniUpdateFilesystemSkipDelayForTesting(true);
vm_tools::cicerone::StartLxdContainerResponse reply; vm_tools::cicerone::StartLxdContainerResponse reply;
reply.set_status(vm_tools::cicerone::StartLxdContainerResponse::REMAPPING); reply.set_status(vm_tools::cicerone::StartLxdContainerResponse::REMAPPING);
......
...@@ -2354,7 +2354,7 @@ if (!is_android) { ...@@ -2354,7 +2354,7 @@ if (!is_android) {
"../browser/ui/views/crostini/crostini_installer_view_browsertest.cc", "../browser/ui/views/crostini/crostini_installer_view_browsertest.cc",
"../browser/ui/views/crostini/crostini_uninstaller_view_browsertest.cc", "../browser/ui/views/crostini/crostini_uninstaller_view_browsertest.cc",
"../browser/ui/views/crostini/crostini_update_component_view_browsertest.cc", "../browser/ui/views/crostini/crostini_update_component_view_browsertest.cc",
"../browser/ui/views/crostini/crostini_upgrade_container_view_browsertest.cc", "../browser/ui/views/crostini/crostini_update_filesystem_view_browsertest.cc",
"../browser/ui/views/extensions/extension_dialog_bounds_browsertest.cc", "../browser/ui/views/extensions/extension_dialog_bounds_browsertest.cc",
"../browser/ui/views/frame/browser_frame_ash_browsertest.cc", "../browser/ui/views/frame/browser_frame_ash_browsertest.cc",
"../browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc", "../browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc",
......
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