• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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.
4 
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UPDATE_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UPDATE_VIEW_H_
7 #pragma once
8 
9 #include "views/view.h"
10 
11 namespace views {
12 class Label;
13 class ProgressBar;
14 class Throbber;
15 }  // namespace views
16 
17 namespace chromeos {
18 
19 class ScreenObserver;
20 class UpdateController;
21 
22 // View for the network selection/initial welcome screen.
23 class UpdateView : public views::View {
24  public:
25   explicit UpdateView(ScreenObserver* observer);
26   virtual ~UpdateView();
27 
28   void Init();
29   void Reset();
30   void UpdateLocalizedStrings();
31 
32   // Sets update controller.
set_controller(UpdateController * controller)33   void set_controller(UpdateController* controller) {
34     controller_ = controller;
35   }
36 
37   // Advances view's progress bar. Maximum progress is 100.
38   void AddProgress(int progress);
39 
40   // Sets the current value for the progress bar. Maximum progress is 100.
41   void SetProgress(int progress);
42 
43   // Shows label with instructions for user to do a manual reboot.
44   // Usually is not called since we rely on API that will reboot after update.
45   void ShowManualRebootInfo();
46 
47   // Shows label for "Preparing updates" state.
48   void ShowPreparingUpdatesInfo(bool visible);
49 
50   // Whether curtain window with throbber and label in the center should
51   // be shown.
52   void ShowCurtain(bool show_curtain);
53 
54   // views::View implementation:
55   virtual void Layout();
56 
57  private:
58   // Creates Label control and adds it as a child.
59   void InitLabel(views::Label** label);
60 
61   // Updates visibility of the elements.
62   void UpdateVisibility();
63 
64   // Keyboard accelerator to allow cancelling update by hitting escape.
65   views::Accelerator escape_accelerator_;
66 
67   // Dialog controls.
68   views::Label* installing_updates_label_;
69   views::Label* preparing_updates_label_;
70   views::Label* reboot_label_;
71   views::Label* manual_reboot_label_;
72   views::Label* escape_to_skip_label_;
73   views::ProgressBar* progress_bar_;
74 
75   // Curtain views.
76   views::Label* checking_label_;
77   views::Throbber* throbber_;
78 
79   // Show curtain view?
80   bool show_curtain_;
81 
82   // Show manual reboot label?
83   bool show_manual_reboot_label_;
84 
85   // Show preparing updates label?
86   bool show_preparing_updates_label_;
87 
88   // Notifications receiver.
89   chromeos::ScreenObserver* observer_;
90   // Update controller.
91   chromeos::UpdateController* controller_;
92 
93   DISALLOW_COPY_AND_ASSIGN(UpdateView);
94 };
95 
96 }  // namespace chromeos
97 
98 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_UPDATE_VIEW_H_
99