Commit bd76ea14 authored by glevin's avatar glevin Committed by Commit Bot

Harmonize ArcAppDialogView

Note that there are 3 app dialogs here generated by the same code:
one for uninstalling, one for USB list permission, and one for USB
access permission.

As per crbug.com/788010 Comment 1 (and previous dlgs):
- Allow text to run to right edge of dialog (minus margin)
- Remove X (Close) button from upper right
- Width = 448px

Bug: 788010
Test: Try to uninstall an ARC++ app, or use one to access USB devices.
OMG Harmony!

Change-Id: I6ffe099ba9f4fe3fae7cd3b6f203873000dd62e8
Reviewed-on: https://chromium-review.googlesource.com/1066450
Commit-Queue: Greg Levin <glevin@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565339}
parent b52ae4ac
...@@ -32,7 +32,6 @@ namespace arc { ...@@ -32,7 +32,6 @@ namespace arc {
namespace { namespace {
const int kRightColumnWidth = 210;
const int kIconSize = 64; const int kIconSize = 64;
// Currenty ARC apps only support 48*48 native icon. // Currenty ARC apps only support 48*48 native icon.
const int kIconSourceSize = 48; const int kIconSourceSize = 48;
...@@ -59,12 +58,16 @@ class ArcAppDialogView : public views::DialogDelegateView, ...@@ -59,12 +58,16 @@ class ArcAppDialogView : public views::DialogDelegateView,
// views::WidgetDelegate: // views::WidgetDelegate:
base::string16 GetWindowTitle() const override; base::string16 GetWindowTitle() const override;
ui::ModalType GetModalType() const override; ui::ModalType GetModalType() const override;
bool ShouldShowCloseButton() const override;
// views::DialogDelegate: // views::DialogDelegate:
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
bool Accept() override; bool Accept() override;
bool Cancel() override; bool Cancel() override;
// views::View:
gfx::Size CalculatePreferredSize() const override;
// AppIconLoaderDelegate: // AppIconLoaderDelegate:
void OnAppImageUpdated(const std::string& app_id, void OnAppImageUpdated(const std::string& app_id,
const gfx::ImageSkia& image) override; const gfx::ImageSkia& image) override;
...@@ -151,7 +154,6 @@ void ArcAppDialogView::AddMultiLineLabel(views::View* parent, ...@@ -151,7 +154,6 @@ void ArcAppDialogView::AddMultiLineLabel(views::View* parent,
label->SetMultiLine(true); label->SetMultiLine(true);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT); label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetAllowCharacterBreak(true); label->SetAllowCharacterBreak(true);
label->SizeToFit(kRightColumnWidth);
parent->AddChildView(label); parent->AddChildView(label);
} }
...@@ -171,6 +173,10 @@ ui::ModalType ArcAppDialogView::GetModalType() const { ...@@ -171,6 +173,10 @@ ui::ModalType ArcAppDialogView::GetModalType() const {
return ui::MODAL_TYPE_WINDOW; return ui::MODAL_TYPE_WINDOW;
} }
bool ArcAppDialogView::ShouldShowCloseButton() const {
return false;
}
base::string16 ArcAppDialogView::GetDialogButtonLabel( base::string16 ArcAppDialogView::GetDialogButtonLabel(
ui::DialogButton button) const { ui::DialogButton button) const {
return button == ui::DIALOG_BUTTON_CANCEL ? cancel_button_text_ return button == ui::DIALOG_BUTTON_CANCEL ? cancel_button_text_
...@@ -189,6 +195,12 @@ bool ArcAppDialogView::Cancel() { ...@@ -189,6 +195,12 @@ bool ArcAppDialogView::Cancel() {
return true; return true;
} }
gfx::Size ArcAppDialogView::CalculatePreferredSize() const {
const int default_width = views::LayoutProvider::Get()->GetDistanceMetric(
DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH);
return gfx::Size(default_width, GetHeightForWidth(default_width));
}
void ArcAppDialogView::OnAppImageUpdated(const std::string& app_id, void ArcAppDialogView::OnAppImageUpdated(const std::string& app_id,
const gfx::ImageSkia& image) { const gfx::ImageSkia& image) {
DCHECK_EQ(app_id, app_id_); DCHECK_EQ(app_id, app_id_);
......
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