Commit a60ac9ac authored by Christopher Gunadi's avatar Christopher Gunadi Committed by Commit Bot

Refactor Crostini dialog to extend BubbleDialogDelegateView

Dialogs that are non-modal should preferably inherit
BubbleDialogDelegateView.

Bug: 1004271
Test: browser_tests --gtest_filter="*Crostini*ViewBrowserTest*"
Change-Id: I2abef29396e9d202bad28a0406b0f2c5e8e2fd02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1806678Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Christopher Gunadi <chrisgunadi@google.com>
Cr-Commit-Position: refs/heads/master@{#697135}
parent be56a0b9
...@@ -71,7 +71,7 @@ bool CrostiniAppUninstallerView::Accept() { ...@@ -71,7 +71,7 @@ bool CrostiniAppUninstallerView::Accept() {
gfx::Size CrostiniAppUninstallerView::CalculatePreferredSize() const { gfx::Size CrostiniAppUninstallerView::CalculatePreferredSize() const {
const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric( const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH) - DISTANCE_STANDALONE_BUBBLE_PREFERRED_WIDTH) -
margins().width(); margins().width();
return gfx::Size(dialog_width, GetHeightForWidth(dialog_width)); return gfx::Size(dialog_width, GetHeightForWidth(dialog_width));
} }
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
#include <string> #include <string>
#include "ui/views/window/dialog_delegate.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h"
class Profile; class Profile;
// The Crostini application uninstaller. Displays a confirmation prompt, // The Crostini application uninstaller. Displays a confirmation prompt,
// and kicks off the uninstall if the user confirms that they want the app // and kicks off the uninstall if the user confirms that they want the app
// uninstalled. Subsequent notifications are handled by CrostiniPackageService. // uninstalled. Subsequent notifications are handled by CrostiniPackageService.
class CrostiniAppUninstallerView : public views::DialogDelegateView { class CrostiniAppUninstallerView : public views::BubbleDialogDelegateView {
public: public:
// Show the "are you sure?"-style confirmation prompt. |app_id| should be an // Show the "are you sure?"-style confirmation prompt. |app_id| should be an
// ID understood by CrostiniRegistryService::GetRegistration(). // ID understood by CrostiniRegistryService::GetRegistration().
......
...@@ -109,7 +109,7 @@ bool CrostiniUninstallerView::Cancel() { ...@@ -109,7 +109,7 @@ bool CrostiniUninstallerView::Cancel() {
gfx::Size CrostiniUninstallerView::CalculatePreferredSize() const { gfx::Size CrostiniUninstallerView::CalculatePreferredSize() const {
const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric( const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH) - DISTANCE_STANDALONE_BUBBLE_PREFERRED_WIDTH) -
margins().width(); margins().width();
return gfx::Size(dialog_width, GetHeightForWidth(dialog_width)); return gfx::Size(dialog_width, GetHeightForWidth(dialog_width));
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UNINSTALLER_VIEW_H_ #ifndef CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UNINSTALLER_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UNINSTALLER_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UNINSTALLER_VIEW_H_
#include "ui/views/window/dialog_delegate.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h"
namespace views { namespace views {
class Label; class Label;
...@@ -20,7 +20,7 @@ class Profile; ...@@ -20,7 +20,7 @@ class Profile;
// The Crostini uninstaller. Provides a warning to the user and // The Crostini uninstaller. Provides a warning to the user and
// uninstalls Crostinin if the user chooses to do so. // uninstalls Crostinin if the user chooses to do so.
class CrostiniUninstallerView : public views::DialogDelegateView { class CrostiniUninstallerView : public views::BubbleDialogDelegateView {
public: public:
// These values are persisted to logs. Entries should not be renumbered and // These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused. // numeric values should never be reused.
......
...@@ -105,7 +105,7 @@ bool CrostiniUpgradeContainerView::ShouldShowCloseButton() const { ...@@ -105,7 +105,7 @@ bool CrostiniUpgradeContainerView::ShouldShowCloseButton() const {
gfx::Size CrostiniUpgradeContainerView::CalculatePreferredSize() const { gfx::Size CrostiniUpgradeContainerView::CalculatePreferredSize() const {
const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric( const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH) - DISTANCE_STANDALONE_BUBBLE_PREFERRED_WIDTH) -
margins().width(); margins().width();
return gfx::Size(dialog_width, GetHeightForWidth(dialog_width)); return gfx::Size(dialog_width, GetHeightForWidth(dialog_width));
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPGRADE_CONTAINER_VIEW_H_ #ifndef CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPGRADE_CONTAINER_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPGRADE_CONTAINER_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPGRADE_CONTAINER_VIEW_H_
#include "ui/views/window/dialog_delegate.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h"
class Profile; class Profile;
...@@ -15,7 +15,7 @@ void SetCrostiniUpgradeSkipDelayForTesting(bool should_skip); ...@@ -15,7 +15,7 @@ void SetCrostiniUpgradeSkipDelayForTesting(bool should_skip);
// 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::DialogDelegateView { class CrostiniUpgradeContainerView : public views::BubbleDialogDelegateView {
public: public:
static void Show(Profile* profile); static void Show(Profile* profile);
......
...@@ -59,7 +59,7 @@ bool CrostiniUpgradeView::ShouldShowCloseButton() const { ...@@ -59,7 +59,7 @@ bool CrostiniUpgradeView::ShouldShowCloseButton() const {
gfx::Size CrostiniUpgradeView::CalculatePreferredSize() const { gfx::Size CrostiniUpgradeView::CalculatePreferredSize() const {
const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric( const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH) - DISTANCE_STANDALONE_BUBBLE_PREFERRED_WIDTH) -
margins().width(); margins().width();
return gfx::Size(dialog_width, GetHeightForWidth(dialog_width)); return gfx::Size(dialog_width, GetHeightForWidth(dialog_width));
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPGRADE_VIEW_H_ #ifndef CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPGRADE_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPGRADE_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_CROSTINI_CROSTINI_UPGRADE_VIEW_H_
#include "ui/views/window/dialog_delegate.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h"
namespace crostini { namespace crostini {
enum class CrostiniResult; enum class CrostiniResult;
...@@ -15,7 +15,7 @@ class Profile; ...@@ -15,7 +15,7 @@ class Profile;
// Provides a warning to the user that an upgrade is required and and internet // Provides a warning to the user that an upgrade is required and and internet
// connection is needed. // connection is needed.
class CrostiniUpgradeView : public views::DialogDelegateView { class CrostiniUpgradeView : public views::BubbleDialogDelegateView {
public: public:
static void Show(Profile* profile); static void Show(Profile* profile);
......
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