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

Unified Diff: chrome/browser/chromeos/login/screens/network_error_model.h

Issue 872633008: Migrate (Network)ErrorScreen to ScreenContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 5 years, 10 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
Index: chrome/browser/chromeos/login/screens/network_error_model.h
diff --git a/chrome/browser/chromeos/login/screens/network_error_model.h b/chrome/browser/chromeos/login/screens/network_error_model.h
new file mode 100644
index 0000000000000000000000000000000000000000..ad40633ba0606ad40482519905228629b6b9b194
--- /dev/null
+++ b/chrome/browser/chromeos/login/screens/network_error_model.h
@@ -0,0 +1,104 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_NETWORK_ERROR_MODEL_H_
+#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_NETWORK_ERROR_MODEL_H_
+
+#include "base/memory/ref_counted.h"
+#include "chrome/browser/chromeos/login/screens/base_screen.h"
+#include "chrome/browser/chromeos/login/screens/network_error.h"
+#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
+
+namespace base {
+class ListValue;
+}
+
+namespace chromeos {
+
+class BaseScreenDelegate;
+class NetworkErrorView;
+
+class NetworkErrorModel : public BaseScreen {
+ public:
+ static const char kContextKeyErrorStateCode[];
+ static const char kContextKeyErrorStateNetwork[];
+ static const char kContextKeyGuestSigninAllowed[];
+ static const char kContextKeyOfflineSigninAllowed[];
+ static const char kContextKeyShowConnectingIndicator[];
+ static const char kContextKeyUIState[];
+ static const char kUserActionConfigureCertsButtonClicked[];
+ static const char kUserActionDiagnoseButtonClicked[];
+ static const char kUserActionLaunchOobeGuestSessionClicked[];
+ static const char kUserActionLocalStateErrorPowerwashButtonClicked[];
+ static const char kUserActionRebootButtonClicked[];
+ static const char kUserActionShowCaptivePortalClicked[];
+
+ explicit NetworkErrorModel(BaseScreenDelegate* base_screen_delegate);
+ ~NetworkErrorModel() override;
+
+ NetworkError::UIState ui_state() const { return ui_state_; }
+ NetworkError::ErrorState error_state() const { return error_state_; }
+
+ // Returns id of the screen behind error screen ("caller" screen).
+ // Returns OobeUI::SCREEN_UNKNOWN if error screen isn't the current
+ // screen.
+ OobeUI::Screen parent_screen() const { return parent_screen_; }
+
+ // BaseScreen:
+ std::string GetName() const override;
+ void OnHide() override;
+
+ // Toggles the guest sign-in prompt.
+ virtual void AllowGuestSignin(bool allowed);
+
+ // Toggles the offline sign-in.
+ virtual void AllowOfflineLogin(bool allowed);
+
+ // Initializes captive portal dialog and shows that if needed.
+ virtual void FixCaptivePortal() = 0;
+
+ // Called when we're asked to hide captive portal dialog.
+ virtual void HideCaptivePortal() = 0;
+
+ // This method is called, when view is being destroyed. Note, if model
+ // is destroyed earlier then it has to call Unbind().
+ virtual void OnViewDestroyed(NetworkErrorView* view) = 0;
+
+ // Sets current UI state.
+ void SetUIState(NetworkError::UIState ui_state);
+
+ // Sets current error screen content according to current UI state,
+ // |error_state|, and |network|.
+ void SetErrorState(NetworkError::ErrorState error_state,
+ const std::string& network);
+
+ // Sets "parent screen" i.e. one that has initiated this network error screen
+ // instance.
+ virtual void SetParentScreen(OobeUI::Screen parent_screen);
+
+ // Sets callback that is called on hide.
+ void SetHideCallback(const base::Closure& on_hide);
+
+ // Shows captive portal dialog.
+ virtual void ShowCaptivePortal() = 0;
+
+ // Toggles the connection pending indicator.
+ virtual void ShowConnectingIndicator(bool show);
+
+ protected:
+ base::Closure* on_hide_callback() { return on_hide_.get(); }
+
+ private:
+ NetworkError::UIState ui_state_;
+ NetworkError::ErrorState error_state_;
+
+ OobeUI::Screen parent_screen_;
+
+ // Optional callback that is called when NetworkError screen is hidden.
+ scoped_ptr<base::Closure> on_hide_;
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_NETWORK_ERROR_MODEL_H_

Powered by Google App Engine
This is Rietveld 408576698