Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3437)

Unified Diff: ash/mus/window_manager_application.cc

Issue 2394503003: mustash: Fix crash when clicking on network in system tray (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/window_manager_application.cc
diff --git a/ash/mus/window_manager_application.cc b/ash/mus/window_manager_application.cc
index f92d47d279ebfbba22dbaf0b294490f9abf2dfaf..b3bc5047058845f1498af91d42f2dfddd573bfbb 100644
--- a/ash/mus/window_manager_application.cc
+++ b/ash/mus/window_manager_application.cc
@@ -36,43 +36,33 @@
#include "chromeos/network/network_handler.h"
#include "chromeos/system/fake_statistics_provider.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h" // nogncheck
+#include "ui/chromeos/network/network_connect.h"
#endif
namespace ash {
namespace mus {
-namespace {
-void InitializeComponents() {
- message_center::MessageCenter::Initialize();
-#if defined(OS_CHROMEOS)
- // Must occur after mojo::ApplicationRunner has initialized AtExitManager, but
- // before WindowManager::Init().
- chromeos::DBusThreadManager::Initialize(
- chromeos::DBusThreadManager::PROCESS_ASH);
-
- // See ChromeBrowserMainPartsChromeos for ordering details.
- bluez::BluezDBusManager::Initialize(
- chromeos::DBusThreadManager::Get()->GetSystemBus(),
- chromeos::DBusThreadManager::Get()->IsUsingFakes());
- chromeos::NetworkHandler::Initialize();
- // TODO(jamescook): Initialize real audio handler.
- chromeos::CrasAudioHandler::InitializeForTesting();
- PowerStatus::Initialize();
-#endif
-}
-
-void ShutdownComponents() {
#if defined(OS_CHROMEOS)
- PowerStatus::Shutdown();
- chromeos::CrasAudioHandler::Shutdown();
- chromeos::NetworkHandler::Shutdown();
- bluez::BluezDBusManager::Shutdown();
- chromeos::DBusThreadManager::Shutdown();
-#endif
- message_center::MessageCenter::Shutdown();
-}
+// TODO(mash): Replace ui::NetworkConnect::Delegate with a mojo interface on a
+// NetworkConfig service.
msw 2016/10/04 22:50:45 nit: cite a bug?
+class WindowManagerApplication::StubNetworkConnectDelegate
+ : public ui::NetworkConnect::Delegate {
+ public:
+ StubNetworkConnectDelegate() {}
+ ~StubNetworkConnectDelegate() override {}
+
+ void ShowNetworkConfigure(const std::string& network_id) override {}
+ void ShowNetworkSettingsForGuid(const std::string& network_id) override {}
+ bool ShowEnrollNetwork(const std::string& network_id) override {
+ return false;
+ }
+ void ShowMobileSimDialog() override {}
+ void ShowMobileSetupDialog(const std::string& service_path) override {}
-} // namespace
+ private:
+ DISALLOW_COPY_AND_ASSIGN(StubNetworkConnectDelegate);
+};
+#endif // OS_CHROMEOS
WindowManagerApplication::WindowManagerApplication()
: screenlock_state_listener_binding_(this) {}
@@ -128,6 +118,40 @@ void WindowManagerApplication::InitWindowManager(
base::MakeUnique<NativeWidgetFactoryMus>(window_manager_.get());
}
+void WindowManagerApplication::InitializeComponents() {
msw 2016/10/04 22:50:45 aside: too bad these have to become class members,
+ message_center::MessageCenter::Initialize();
+#if defined(OS_CHROMEOS)
+ // Must occur after mojo::ApplicationRunner has initialized AtExitManager, but
+ // before WindowManager::Init().
+ chromeos::DBusThreadManager::Initialize(
+ chromeos::DBusThreadManager::PROCESS_ASH);
+
+ // See ChromeBrowserMainPartsChromeos for ordering details.
+ bluez::BluezDBusManager::Initialize(
+ chromeos::DBusThreadManager::Get()->GetSystemBus(),
+ chromeos::DBusThreadManager::Get()->IsUsingFakes());
+ chromeos::NetworkHandler::Initialize();
+ network_connect_delegate_.reset(new StubNetworkConnectDelegate());
+ ui::NetworkConnect::Initialize(network_connect_delegate_.get());
+ // TODO(jamescook): Initialize real audio handler.
+ chromeos::CrasAudioHandler::InitializeForTesting();
+ PowerStatus::Initialize();
+#endif
+}
+
+void WindowManagerApplication::ShutdownComponents() {
+#if defined(OS_CHROMEOS)
+ PowerStatus::Shutdown();
+ chromeos::CrasAudioHandler::Shutdown();
+ ui::NetworkConnect::Shutdown();
+ network_connect_delegate_.reset();
msw 2016/10/04 22:50:45 It's a bit odd that the window manager application
+ chromeos::NetworkHandler::Shutdown();
+ bluez::BluezDBusManager::Shutdown();
+ chromeos::DBusThreadManager::Shutdown();
+#endif
+ message_center::MessageCenter::Shutdown();
+}
+
void WindowManagerApplication::OnStart(const shell::Identity& identity) {
aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak",
"ash_mus_resources_200.pak"));
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698