Commit 4b6bbb03 authored by Steven Bennetts's avatar Steven Bennetts Committed by Commit Bot

NetworkConfigView: Prevent SystemWebDialogDelegate from opening

There are a few cases where a user might open a
SystemWebDialogDelegate while NetworkConfigView is open.

NetworkConfigView uses SystemTrayClient::CreateUnownedDialogWidget
which does not interact well with SystemWebDialogDelegate
(see issue).

Since NetworkConfigView will soon be deprecated, the simplest
short term fix is to not show any SystemWebDialogDelegate
instance while NetworkConfigView is shown. This will not seem
to strange to a user since NetworkConfigView is a modal dialog.

Bug: 791955
Change-Id: Ibe37ff737df69d5d02670c435124e2837ddb0bab
Reviewed-on: https://chromium-review.googlesource.com/825626Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523955}
parent 375ff547
...@@ -93,6 +93,11 @@ NetworkConfigView::~NetworkConfigView() { ...@@ -93,6 +93,11 @@ NetworkConfigView::~NetworkConfigView() {
g_instance = nullptr; g_instance = nullptr;
} }
// static
bool NetworkConfigView::HasInstance() {
return !!g_instance;
}
// static // static
NetworkConfigView* NetworkConfigView::ShowForNetworkId( NetworkConfigView* NetworkConfigView::ShowForNetworkId(
const std::string& network_id) { const std::string& network_id) {
......
...@@ -39,6 +39,9 @@ class NetworkConfigView : public views::DialogDelegateView, ...@@ -39,6 +39,9 @@ class NetworkConfigView : public views::DialogDelegateView,
virtual ~Delegate() {} virtual ~Delegate() {}
}; };
// Returns true if a NetworkConfigView instance exists.
static bool HasInstance();
// Shows a network connection dialog if none is currently visible. The dialog // Shows a network connection dialog if none is currently visible. The dialog
// is placed on the default display for new windows. Returns the dialog or // is placed on the default display for new windows. Returns the dialog or
// nullptr on error. // nullptr on error.
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h" #include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "chrome/browser/chromeos/options/network_config_view.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_dialogs.h"
#include "components/session_manager/core/session_manager.h" #include "components/session_manager/core/session_manager.h"
...@@ -56,6 +57,13 @@ bool SystemWebDialogDelegate::ShouldShowDialogTitle() const { ...@@ -56,6 +57,13 @@ bool SystemWebDialogDelegate::ShouldShowDialogTitle() const {
} }
void SystemWebDialogDelegate::ShowSystemDialog() { void SystemWebDialogDelegate::ShowSystemDialog() {
// NetworkConfigView does not interact well with web dialogs. For now, do
// not show the dialog while NetworkConfigView is shown: crbug.com/791955.
// TODO(stevenjb): Remove this when NetworkConfigView is deprecated.
if (NetworkConfigView::HasInstance()) {
delete this;
return;
}
content::BrowserContext* browser_context = content::BrowserContext* browser_context =
ProfileManager::GetActiveUserProfile(); ProfileManager::GetActiveUserProfile();
int container_id = session_manager::SessionManager::Get()->session_state() == int container_id = session_manager::SessionManager::Get()->session_state() ==
......
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