Commit 2cbab899 authored by Yue Li's avatar Yue Li Committed by Commit Bot

Handle ShouldShowDialogTitle for WebDialogDelegate

Currently WebDialogDelegate cannot hide the dialog title by setting
ShouldShowDialogTitle.

Bug: 828574
Test: Local Build
Change-Id: I2d9abc21ef108ccd97dc4667c2d4b311f6ec3501
Reviewed-on: https://chromium-review.googlesource.com/993756Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Yue Li <updowndota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549830}
parent 0617c86f
...@@ -103,9 +103,11 @@ gfx::NativeWindow ShowWebDialog(gfx::NativeView parent, ...@@ -103,9 +103,11 @@ gfx::NativeWindow ShowWebDialog(gfx::NativeView parent,
// Returns the created window. // Returns the created window.
// See ash/public/cpp/shell_window_ids.h for |container_id| values. The window // See ash/public/cpp/shell_window_ids.h for |container_id| values. The window
// is destroyed when it is closed. See also chrome::ShowWebDialog(). // is destroyed when it is closed. See also chrome::ShowWebDialog().
// |is_minimal_style| means whether the title area of the dialog should be hide.
gfx::NativeWindow ShowWebDialogInContainer(int container_id, gfx::NativeWindow ShowWebDialogInContainer(int container_id,
content::BrowserContext* context, content::BrowserContext* context,
ui::WebDialogDelegate* delegate); ui::WebDialogDelegate* delegate,
bool is_minimal_style = false);
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
// Shows the create chrome app shortcut dialog box. // Shows the create chrome app shortcut dialog box.
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "chrome/browser/ui/ash/ash_util.h" #include "chrome/browser/ui/ash/ash_util.h"
#include "ui/wm/core/shadow_types.h"
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
namespace chrome { namespace chrome {
...@@ -49,11 +50,19 @@ gfx::NativeWindow ShowWebDialog(gfx::NativeView parent, ...@@ -49,11 +50,19 @@ gfx::NativeWindow ShowWebDialog(gfx::NativeView parent,
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
gfx::NativeWindow ShowWebDialogInContainer(int container_id, gfx::NativeWindow ShowWebDialogInContainer(int container_id,
content::BrowserContext* context, content::BrowserContext* context,
ui::WebDialogDelegate* delegate) { ui::WebDialogDelegate* delegate,
bool is_minimal_style) {
DCHECK(container_id != ash::kShellWindowId_Invalid); DCHECK(container_id != ash::kShellWindowId_Invalid);
views::WebDialogView* view = views::WebDialogView* view =
new views::WebDialogView(context, delegate, new ChromeWebContentsHandler); new views::WebDialogView(context, delegate, new ChromeWebContentsHandler);
views::Widget::InitParams params; views::Widget::InitParams params;
// TODO(updowndota) Remove the special handling for hiding dialog title after
// the bug is fixed.
if (is_minimal_style) {
params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS;
params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_DROP;
params.shadow_elevation = ::wm::kShadowElevationActiveWindow;
}
params.delegate = view; params.delegate = view;
ash_util::SetupWidgetInitParamsForContainer(&params, container_id); ash_util::SetupWidgetInitParamsForContainer(&params, container_id);
return ShowWebDialogWidget(params, view); return ShowWebDialogWidget(params, view);
......
...@@ -90,7 +90,7 @@ AssistantOptInUI::GetVoiceInteractionHomeService() { ...@@ -90,7 +90,7 @@ AssistantOptInUI::GetVoiceInteractionHomeService() {
void AssistantOptInDialog::Show() { void AssistantOptInDialog::Show() {
DCHECK(!is_active); DCHECK(!is_active);
AssistantOptInDialog* dialog = new AssistantOptInDialog(); AssistantOptInDialog* dialog = new AssistantOptInDialog();
dialog->ShowSystemDialog(); dialog->ShowSystemDialog(true);
} }
// static // static
......
...@@ -65,7 +65,7 @@ bool SystemWebDialogDelegate::ShouldShowDialogTitle() const { ...@@ -65,7 +65,7 @@ bool SystemWebDialogDelegate::ShouldShowDialogTitle() const {
return !title_.empty(); return !title_.empty();
} }
void SystemWebDialogDelegate::ShowSystemDialog() { void SystemWebDialogDelegate::ShowSystemDialog(bool is_minimal_style) {
// NetworkConfigView does not interact well with web dialogs. For now, do // NetworkConfigView does not interact well with web dialogs. For now, do
// not show the dialog while NetworkConfigView is shown: crbug.com/791955. // not show the dialog while NetworkConfigView is shown: crbug.com/791955.
// TODO(stevenjb): Remove this when NetworkConfigView is deprecated. // TODO(stevenjb): Remove this when NetworkConfigView is deprecated.
...@@ -78,7 +78,8 @@ void SystemWebDialogDelegate::ShowSystemDialog() { ...@@ -78,7 +78,8 @@ void SystemWebDialogDelegate::ShowSystemDialog() {
int container_id = GetDialogModalType() == ui::MODAL_TYPE_NONE int container_id = GetDialogModalType() == ui::MODAL_TYPE_NONE
? ash::kShellWindowId_AlwaysOnTopContainer ? ash::kShellWindowId_AlwaysOnTopContainer
: ash::kShellWindowId_LockSystemModalContainer; : ash::kShellWindowId_LockSystemModalContainer;
chrome::ShowWebDialogInContainer(container_id, browser_context, this); chrome::ShowWebDialogInContainer(container_id, browser_context, this,
is_minimal_style);
} }
} // namespace chromeos } // namespace chromeos
...@@ -42,7 +42,8 @@ class SystemWebDialogDelegate : public ui::WebDialogDelegate { ...@@ -42,7 +42,8 @@ class SystemWebDialogDelegate : public ui::WebDialogDelegate {
// Show the dialog using the current ative profile and the proper ash // Show the dialog using the current ative profile and the proper ash
// shell container. // shell container.
void ShowSystemDialog(); // |is_minimal_style| means whether title area of the dialog should be hide.
void ShowSystemDialog(bool is_minimal_style = false);
content::WebUI* GetWebUIForTest() { return webui_; } content::WebUI* GetWebUIForTest() { return webui_; }
......
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