Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / chromeos / login / screens / reset_screen.h
blob8fb87dbd69eee98fcbf3ab50519128c8dc050cff
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_RESET_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_RESET_SCREEN_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/chromeos/login/help_app_launcher.h"
14 #include "chrome/browser/chromeos/login/screens/reset_model.h"
15 #include "chromeos/dbus/update_engine_client.h"
18 namespace chromeos {
20 class ErrorScreen;
21 class ResetView;
23 // Representation independent class that controls screen showing reset to users.
24 class ResetScreen : public ResetModel,
25 public UpdateEngineClient::Observer {
26 public:
27 ResetScreen(BaseScreenDelegate* base_screen_delegate,
28 ResetView* view);
29 ~ResetScreen() override;
31 // ResetModel implementation:
32 void PrepareToShow() override;
33 void Show() override;
34 void Hide() override;
35 void OnViewDestroyed(ResetView* view) override;
36 void OnUserAction(const std::string& action_id) override;
38 // UpdateEngineClient::Observer implementation:
39 void UpdateStatusChanged(const UpdateEngineClient::Status& status) override;
41 void OnRollbackCheck(bool can_rollback);
43 private:
45 enum State {
46 STATE_RESTART_REQUIRED = 0,
47 STATE_REVERT_PROMISE,
48 STATE_POWERWASH_PROPOSAL,
49 STATE_ERROR
52 void OnCancel();
53 void OnPowerwash();
54 void OnRestart();
55 void OnToggleRollback();
56 void OnShowConfirm();
57 void OnLearnMore();
58 void OnConfirmationDismissed();
60 // Returns an instance of the error screen.
61 ErrorScreen* GetErrorScreen();
63 ResetView* view_;
65 // Help application used for help dialogs.
66 scoped_refptr<HelpAppLauncher> help_app_;
68 base::WeakPtrFactory<ResetScreen> weak_ptr_factory_;
70 DISALLOW_COPY_AND_ASSIGN(ResetScreen);
73 } // namespace chromeos
75 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_RESET_SCREEN_H_