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

Side by Side Diff: chrome/browser/chromeos/login/update_view.cc

Issue 7646004: chromeos: Improve brightness and volume animations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: hopefully fix windows compile and DCHECK Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/setting_level_bubble.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/update_view.h" 5 #include "chrome/browser/chromeos/login/update_view.h"
6 6
7 #include <algorithm>
7 #include <string> 8 #include <string>
8 9
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/chromeos/login/helper.h" 12 #include "chrome/browser/chromeos/login/helper.h"
12 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" 13 #include "chrome/browser/chromeos/login/rounded_rect_painter.h"
13 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" 14 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h"
14 #include "grit/chromium_strings.h" 15 #include "grit/chromium_strings.h"
15 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
16 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
18 #include "views/border.h" 19 #include "views/border.h"
19 #include "views/controls/label.h" 20 #include "views/controls/label.h"
20 #include "views/controls/progress_bar.h" 21 #include "views/controls/progress_bar.h"
21 #include "views/controls/throbber.h" 22 #include "views/controls/throbber.h"
22 #include "views/focus/focus_manager.h" 23 #include "views/focus/focus_manager.h"
23 #include "views/widget/widget.h" 24 #include "views/widget/widget.h"
24 25
26 using std::max;
25 using views::Background; 27 using views::Background;
26 using views::Label; 28 using views::Label;
27 using views::View; 29 using views::View;
28 using views::Widget; 30 using views::Widget;
29 31
30 namespace { 32 namespace {
31 33
32 // TODO(nkostylev): Switch to GridLayout. 34 // TODO(nkostylev): Switch to GridLayout.
33 35
34 // Y offset for the 'installing updates' label. 36 // Y offset for the 'installing updates' label.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 InitLabel(&installing_updates_label_); 83 InitLabel(&installing_updates_label_);
82 InitLabel(&preparing_updates_label_); 84 InitLabel(&preparing_updates_label_);
83 InitLabel(&reboot_label_); 85 InitLabel(&reboot_label_);
84 InitLabel(&manual_reboot_label_); 86 InitLabel(&manual_reboot_label_);
85 preparing_updates_label_->SetVisible(false); 87 preparing_updates_label_->SetVisible(false);
86 manual_reboot_label_->SetVisible(false); 88 manual_reboot_label_->SetVisible(false);
87 manual_reboot_label_->SetColor(kManualRebootLabelColor); 89 manual_reboot_label_->SetColor(kManualRebootLabelColor);
88 90
89 progress_bar_ = new views::ProgressBar(); 91 progress_bar_ = new views::ProgressBar();
90 AddChildView(progress_bar_); 92 AddChildView(progress_bar_);
93 progress_bar_->SetDisplayRange(0.0, 100.0);
91 94
92 // Curtain view. 95 // Curtain view.
93 InitLabel(&checking_label_); 96 InitLabel(&checking_label_);
94 throbber_ = CreateDefaultThrobber(); 97 throbber_ = CreateDefaultThrobber();
95 AddChildView(throbber_); 98 AddChildView(throbber_);
96 99
97 #if !defined(OFFICIAL_BUILD) 100 #if !defined(OFFICIAL_BUILD)
98 InitLabel(&escape_to_skip_label_); 101 InitLabel(&escape_to_skip_label_);
99 escape_to_skip_label_->SetColor(kSkipLabelColor); 102 escape_to_skip_label_->SetColor(kSkipLabelColor);
100 escape_to_skip_label_->SetText( 103 escape_to_skip_label_->SetText(
101 L"Press ESCAPE to skip (Non-official builds only)"); 104 L"Press ESCAPE to skip (Non-official builds only)");
102 #endif 105 #endif
103 106
104 UpdateLocalizedStrings(); 107 UpdateLocalizedStrings();
105 UpdateVisibility(); 108 UpdateVisibility();
106 } 109 }
107 110
108 void UpdateView::Reset() { 111 void UpdateView::Reset() {
109 progress_bar_->SetProgress(0); 112 progress_bar_->SetValue(0.0);
110 } 113 }
111 114
112 void UpdateView::UpdateLocalizedStrings() { 115 void UpdateView::UpdateLocalizedStrings() {
113 installing_updates_label_->SetText(UTF16ToWide(l10n_util::GetStringFUTF16( 116 installing_updates_label_->SetText(UTF16ToWide(l10n_util::GetStringFUTF16(
114 IDS_INSTALLING_UPDATE, 117 IDS_INSTALLING_UPDATE,
115 l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)))); 118 l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME))));
116 preparing_updates_label_->SetText( 119 preparing_updates_label_->SetText(
117 UTF16ToWide(l10n_util::GetStringUTF16(IDS_UPDATE_AVAILABLE))); 120 UTF16ToWide(l10n_util::GetStringUTF16(IDS_UPDATE_AVAILABLE)));
118 reboot_label_->SetText( 121 reboot_label_->SetText(
119 UTF16ToWide(l10n_util::GetStringUTF16(IDS_INSTALLING_UPDATE_DESC))); 122 UTF16ToWide(l10n_util::GetStringUTF16(IDS_INSTALLING_UPDATE_DESC)));
120 manual_reboot_label_->SetText( 123 manual_reboot_label_->SetText(
121 UTF16ToWide(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED))); 124 UTF16ToWide(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED)));
122 checking_label_->SetText( 125 checking_label_->SetText(
123 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CHECKING_FOR_UPDATES))); 126 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CHECKING_FOR_UPDATES)));
124 } 127 }
125 128
126 void UpdateView::AddProgress(int ticks) { 129 void UpdateView::AddProgress(int ticks) {
127 progress_bar_->AddProgress(ticks); 130 progress_bar_->SetValue(
131 max(progress_bar_->current_value() + ticks, 100.0));
128 } 132 }
129 133
130 void UpdateView::SetProgress(int progress) { 134 void UpdateView::SetProgress(int progress) {
131 progress_bar_->SetProgress(progress); 135 progress_bar_->SetValue(progress);
132 } 136 }
133 137
134 void UpdateView::ShowManualRebootInfo() { 138 void UpdateView::ShowManualRebootInfo() {
135 show_manual_reboot_label_ = true; 139 show_manual_reboot_label_ = true;
136 UpdateVisibility(); 140 UpdateVisibility();
137 } 141 }
138 142
139 void UpdateView::ShowPreparingUpdatesInfo(bool visible) { 143 void UpdateView::ShowPreparingUpdatesInfo(bool visible) {
140 show_preparing_updates_label_ = visible; 144 show_preparing_updates_label_ = visible;
141 UpdateVisibility(); 145 UpdateVisibility();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } else { 259 } else {
256 NOTREACHED(); 260 NOTREACHED();
257 } 261 }
258 const std::string text = 262 const std::string text =
259 label_spoken ? WideToUTF8(label_spoken->GetText()) : std::string(); 263 label_spoken ? WideToUTF8(label_spoken->GetText()) : std::string();
260 WizardAccessibilityHelper::GetInstance()->MaybeSpeak(text.c_str(), false, 264 WizardAccessibilityHelper::GetInstance()->MaybeSpeak(text.c_str(), false,
261 true); 265 true);
262 } 266 }
263 267
264 } // namespace chromeos 268 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/setting_level_bubble.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698