diff options
Diffstat (limited to 'chrome')
4 files changed, 44 insertions, 8 deletions
diff --git a/chrome/browser/chromeos/login/help_app_launcher.cc b/chrome/browser/chromeos/login/help_app_launcher.cc index 2b5265b..7746d39 100644 --- a/chrome/browser/chromeos/login/help_app_launcher.cc +++ b/chrome/browser/chromeos/login/help_app_launcher.cc @@ -73,7 +73,8 @@ void HelpAppLauncher::ShowHelpTopicDialog(const GURL& topic_url) { this, parent_window_, l10n_util::GetString(IDS_LOGIN_OOBE_HELP_DIALOG_TITLE), - topic_url)); + topic_url, + LoginHtmlDialog::STYLE_GENERIC)); } else { dialog_->set_url(topic_url); } diff --git a/chrome/browser/chromeos/login/login_html_dialog.cc b/chrome/browser/chromeos/login/login_html_dialog.cc index a05c7de..47e3e4b 100644 --- a/chrome/browser/chromeos/login/login_html_dialog.cc +++ b/chrome/browser/chromeos/login/login_html_dialog.cc @@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/login/login_html_dialog.h" +#include "chrome/browser/chromeos/frame/bubble_window.h" #include "chrome/browser/chromeos/login/helper.h" #include "chrome/browser/profile_manager.h" #include "chrome/browser/views/html_dialog_view.h" @@ -42,12 +43,14 @@ class HtmlDialogWithoutContextMenuView : public HtmlDialogView { LoginHtmlDialog::LoginHtmlDialog(Delegate* delegate, gfx::NativeWindow parent_window, const std::wstring& title, - const GURL& url) - : delegate_(delegate), + const GURL& url, + Style style) + : style_(style), + delegate_(delegate), parent_window_(parent_window), title_(title), url_(url) { - gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size(0, 0))); + gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); width_ = static_cast<int>(kDefaultWidthRatio * screen_bounds.width()); height_ = static_cast<int>(kDefaultHeightRatio * screen_bounds.height()); } @@ -60,7 +63,15 @@ void LoginHtmlDialog::Show() { HtmlDialogWithoutContextMenuView* html_view = new HtmlDialogWithoutContextMenuView(ProfileManager::GetDefaultProfile(), this); - views::Window::CreateChromeWindow(parent_window_, gfx::Rect(), html_view); + switch (style_) { + case STYLE_BUBBLE: + chromeos::BubbleWindow::Create(parent_window_, gfx::Rect(), html_view); + break; + case STYLE_GENERIC: + default: + views::Window::CreateChromeWindow(parent_window_, gfx::Rect(), html_view); + break; + } html_view->InitDialog(); html_view->window()->Show(); } diff --git a/chrome/browser/chromeos/login/login_html_dialog.h b/chrome/browser/chromeos/login/login_html_dialog.h index 367bb56..65c3116 100644 --- a/chrome/browser/chromeos/login/login_html_dialog.h +++ b/chrome/browser/chromeos/login/login_html_dialog.h @@ -26,10 +26,16 @@ class LoginHtmlDialog : public HtmlDialogUIDelegate { virtual void OnDialogClosed() = 0; }; + enum Style { + STYLE_GENERIC, // Use generic CreateChromeWindow as a host. + STYLE_BUBBLE // Use chromeos::BubbleWindow as a host. + } style_; + LoginHtmlDialog(Delegate* delegate, gfx::NativeWindow parent_window, const std::wstring& title, - const GURL& url); + const GURL& url, + Style style); ~LoginHtmlDialog(); // Shows created dialog. diff --git a/chrome/browser/chromeos/login/network_selection_view.cc b/chrome/browser/chromeos/login/network_selection_view.cc index 19b3955..b33e8d6 100644 --- a/chrome/browser/chromeos/login/network_selection_view.cc +++ b/chrome/browser/chromeos/login/network_selection_view.cc @@ -80,6 +80,11 @@ const int kMenuWidthOffset = 6; const SkColor kWelcomeColor = 0xFFCDD3D6; +// Hints for size of proxy settings dialog. +static const int kProxySettingsDialogReasonableWidth = 700; +static const int kProxySettingsDialogReasonableHeight = 460; +static const int kProxySettingsDialogReasonableWidthRatio = 0.4; +static const int kProxySettingsDialogReasonableHeightRatio = 0.4; } // namespace namespace chromeos { @@ -416,8 +421,21 @@ void NetworkSelectionView::LinkActivated(views::Link* source, int) { proxy_settings_dialog_.reset(new LoginHtmlDialog( this, GetNativeWindow(), - l10n_util::GetString(IDS_OPTIONS_PROXY_TAB_LABEL), - GURL(kProxySettingsURL))); + std::wstring(), + GURL(kProxySettingsURL), + LoginHtmlDialog::STYLE_BUBBLE)); + gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); + proxy_settings_dialog_->SetDialogSize( + std::min( + screen_bounds.width(), + std::max(kProxySettingsDialogReasonableWidth, static_cast<int>( + kProxySettingsDialogReasonableWidthRatio * + screen_bounds.width()))), + std::min( + screen_bounds.height(), + std::max(kProxySettingsDialogReasonableHeight, static_cast<int>( + kProxySettingsDialogReasonableHeightRatio * + screen_bounds.height())))); } proxy_settings_dialog_->Show(); } |