Commit a9e6448b authored by Kush Sinha's avatar Kush Sinha Committed by Commit Bot

Fix Account Manager's Add Account modal dimensions

The current dimensions sometimes cause the Chrome OS Account Manager's
account addition modal to overflow the screen.

Bug: 944186
Change-Id: I7960863e9b40c39a40151dc07c12fec193661382
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1539998Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Kush Sinha <sinhak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#645358}
parent da0460bd
...@@ -73,6 +73,9 @@ class SystemWebDialogDelegate : public ui::WebDialogDelegate { ...@@ -73,6 +73,9 @@ class SystemWebDialogDelegate : public ui::WebDialogDelegate {
protected: protected:
FRIEND_TEST_ALL_PREFIXES(SystemWebDialogLoginTest, NonModalTest); FRIEND_TEST_ALL_PREFIXES(SystemWebDialogLoginTest, NonModalTest);
// Returns the dialog window (pointer to |aura::Window|). This will be a
// |nullptr| if the dialog has not been created yet.
gfx::NativeWindow dialog_window() const { return dialog_window_; } gfx::NativeWindow dialog_window() const { return dialog_window_; }
private: private:
...@@ -80,7 +83,7 @@ class SystemWebDialogDelegate : public ui::WebDialogDelegate { ...@@ -80,7 +83,7 @@ class SystemWebDialogDelegate : public ui::WebDialogDelegate {
base::string16 title_; base::string16 title_;
content::WebUI* webui_ = nullptr; content::WebUI* webui_ = nullptr;
ui::ModalType modal_type_; ui::ModalType modal_type_;
gfx::NativeWindow dialog_window_; gfx::NativeWindow dialog_window_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(SystemWebDialogDelegate); DISALLOW_COPY_AND_ASSIGN(SystemWebDialogDelegate);
}; };
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.h" #include "chrome/browser/ui/webui/signin/inline_login_handler_dialog_chromeos.h"
#include <algorithm>
#include <string> #include <string>
#include "base/logging.h" #include "base/logging.h"
...@@ -12,6 +13,8 @@ ...@@ -12,6 +13,8 @@
#include "chrome/common/webui_url_constants.h" #include "chrome/common/webui_url_constants.h"
#include "net/base/url_util.h" #include "net/base/url_util.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace chromeos { namespace chromeos {
...@@ -19,6 +22,8 @@ namespace chromeos { ...@@ -19,6 +22,8 @@ namespace chromeos {
namespace { namespace {
InlineLoginHandlerDialogChromeOS* dialog = nullptr; InlineLoginHandlerDialogChromeOS* dialog = nullptr;
constexpr int kSigninDialogWidth = 768;
constexpr int kSigninDialogHeight = 640;
} // namespace } // namespace
...@@ -49,6 +54,13 @@ InlineLoginHandlerDialogChromeOS::~InlineLoginHandlerDialogChromeOS() { ...@@ -49,6 +54,13 @@ InlineLoginHandlerDialogChromeOS::~InlineLoginHandlerDialogChromeOS() {
dialog = nullptr; dialog = nullptr;
} }
void InlineLoginHandlerDialogChromeOS::GetDialogSize(gfx::Size* size) const {
const display::Display display =
display::Screen::GetScreen()->GetDisplayNearestWindow(dialog_window());
size->SetSize(std::min(kSigninDialogWidth, display.work_area().width()),
std::min(kSigninDialogHeight, display.work_area().height()));
}
std::string InlineLoginHandlerDialogChromeOS::GetDialogArgs() const { std::string InlineLoginHandlerDialogChromeOS::GetDialogArgs() const {
return std::string(); return std::string();
} }
...@@ -57,10 +69,4 @@ bool InlineLoginHandlerDialogChromeOS::ShouldShowDialogTitle() const { ...@@ -57,10 +69,4 @@ bool InlineLoginHandlerDialogChromeOS::ShouldShowDialogTitle() const {
return false; return false;
} }
void InlineLoginHandlerDialogChromeOS::GetDialogSize(gfx::Size* size) const {
constexpr int kSigninDialogWidth = 800;
constexpr int kSigninDialogHeight = 700;
size->SetSize(kSigninDialogWidth, kSigninDialogHeight);
}
} // namespace chromeos } // namespace chromeos
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