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

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

Issue 8436002: [cros] Remove Views implementation for login/OOBE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 1 month 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
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/background_view.h" 5 #include "chrome/browser/chromeos/login/background_view.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/string16.h" 10 #include "base/string16.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chromeos/login/login_utils.h" 15 #include "chrome/browser/chromeos/login/login_utils.h"
16 #include "chrome/browser/chromeos/login/oobe_progress_bar.h"
17 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" 16 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h"
18 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" 17 #include "chrome/browser/chromeos/login/rounded_rect_painter.h"
19 #include "chrome/browser/chromeos/login/shutdown_button.h" 18 #include "chrome/browser/chromeos/login/shutdown_button.h"
20 #include "chrome/browser/chromeos/login/wizard_controller.h" 19 #include "chrome/browser/chromeos/login/wizard_controller.h"
21 #include "chrome/browser/chromeos/status/clock_menu_button.h" 20 #include "chrome/browser/chromeos/status/clock_menu_button.h"
22 #include "chrome/browser/chromeos/status/input_method_menu_button.h" 21 #include "chrome/browser/chromeos/status/input_method_menu_button.h"
23 #include "chrome/browser/chromeos/status/network_menu_button.h" 22 #include "chrome/browser/chromeos/status/network_menu_button.h"
24 #include "chrome/browser/chromeos/status/status_area_view.h" 23 #include "chrome/browser/chromeos/status/status_area_view.h"
25 #include "chrome/browser/policy/browser_policy_connector.h" 24 #include "chrome/browser/policy/browser_policy_connector.h"
26 #include "chrome/browser/profiles/profile_manager.h" 25 #include "chrome/browser/profiles/profile_manager.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 75
77 namespace chromeos { 76 namespace chromeos {
78 77
79 /////////////////////////////////////////////////////////////////////////////// 78 ///////////////////////////////////////////////////////////////////////////////
80 // BackgroundView public: 79 // BackgroundView public:
81 80
82 BackgroundView::BackgroundView() 81 BackgroundView::BackgroundView()
83 : status_area_(NULL), 82 : status_area_(NULL),
84 os_version_label_(NULL), 83 os_version_label_(NULL),
85 boot_times_label_(NULL), 84 boot_times_label_(NULL),
86 progress_bar_(NULL),
87 shutdown_button_(NULL), 85 shutdown_button_(NULL),
88 #if defined(OFFICIAL_BUILD) 86 #if defined(OFFICIAL_BUILD)
89 is_official_build_(true), 87 is_official_build_(true),
90 #else 88 #else
91 is_official_build_(false), 89 is_official_build_(false),
92 #endif 90 #endif
93 background_area_(NULL), 91 background_area_(NULL),
94 version_info_updater_(this) { 92 version_info_updater_(this) {
95 } 93 }
96 94
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 167 }
170 168
171 void BackgroundView::SetStatusAreaVisible(bool visible) { 169 void BackgroundView::SetStatusAreaVisible(bool visible) {
172 status_area_->SetVisible(visible); 170 status_area_->SetVisible(visible);
173 } 171 }
174 172
175 void BackgroundView::SetStatusAreaEnabled(bool enable) { 173 void BackgroundView::SetStatusAreaEnabled(bool enable) {
176 status_area_->MakeButtonsActive(enable); 174 status_area_->MakeButtonsActive(enable);
177 } 175 }
178 176
179 void BackgroundView::SetOobeProgressBarVisible(bool visible) {
180 if (!progress_bar_ && visible)
181 InitProgressBar();
182
183 if (progress_bar_)
184 progress_bar_->SetVisible(visible);
185 }
186
187 bool BackgroundView::IsOobeProgressBarVisible() {
188 return progress_bar_ && progress_bar_->IsVisible();
189 }
190
191 void BackgroundView::SetOobeProgress(LoginStep step) {
192 DCHECK(step < STEPS_COUNT);
193 if (progress_bar_)
194 progress_bar_->SetStep(GetStepId(step));
195 }
196
197 void BackgroundView::ShowScreenSaver() { 177 void BackgroundView::ShowScreenSaver() {
198 SetStatusAreaVisible(false); 178 SetStatusAreaVisible(false);
199 background_area_->SetVisible(true); 179 background_area_->SetVisible(true);
200 } 180 }
201 181
202 void BackgroundView::HideScreenSaver() { 182 void BackgroundView::HideScreenSaver() {
203 SetStatusAreaVisible(true); 183 SetStatusAreaVisible(true);
204 // TODO(oshima): we need a way to suspend screen saver 184 // TODO(oshima): we need a way to suspend screen saver
205 // to save power when it's not visible. 185 // to save power when it's not visible.
206 background_area_->SetVisible(false); 186 background_area_->SetVisible(false);
(...skipping 13 matching lines...) Expand all
220 } 200 }
221 201
222 /////////////////////////////////////////////////////////////////////////////// 202 ///////////////////////////////////////////////////////////////////////////////
223 // BackgroundView protected: 203 // BackgroundView protected:
224 204
225 void BackgroundView::Layout() { 205 void BackgroundView::Layout() {
226 const int kCornerPadding = 5; 206 const int kCornerPadding = 5;
227 const int kInfoLeftPadding = 10; 207 const int kInfoLeftPadding = 10;
228 const int kInfoBottomPadding = 10; 208 const int kInfoBottomPadding = 10;
229 const int kInfoBetweenLinesPadding = 1; 209 const int kInfoBetweenLinesPadding = 1;
230 const int kProgressBarBottomPadding = 20;
231 const int kProgressBarWidth = 750;
232 const int kProgressBarHeight = 70;
233 gfx::Size status_area_size = status_area_->GetPreferredSize(); 210 gfx::Size status_area_size = status_area_->GetPreferredSize();
234 status_area_->SetBounds( 211 status_area_->SetBounds(
235 width() - status_area_size.width() - kCornerPadding, 212 width() - status_area_size.width() - kCornerPadding,
236 kCornerPadding, 213 kCornerPadding,
237 status_area_size.width(), 214 status_area_size.width(),
238 status_area_size.height()); 215 status_area_size.height());
239 gfx::Size version_size = os_version_label_->GetPreferredSize(); 216 gfx::Size version_size = os_version_label_->GetPreferredSize();
240 int os_version_y = height() - version_size.height() - kInfoBottomPadding; 217 int os_version_y = height() - version_size.height() - kInfoBottomPadding;
241 if (!is_official_build_) 218 if (!is_official_build_)
242 os_version_y -= (version_size.height() + kInfoBetweenLinesPadding); 219 os_version_y -= (version_size.height() + kInfoBetweenLinesPadding);
243 os_version_label_->SetBounds( 220 os_version_label_->SetBounds(
244 kInfoLeftPadding, 221 kInfoLeftPadding,
245 os_version_y, 222 os_version_y,
246 width() - 2 * kInfoLeftPadding, 223 width() - 2 * kInfoLeftPadding,
247 version_size.height()); 224 version_size.height());
248 if (!is_official_build_) { 225 if (!is_official_build_) {
249 boot_times_label_->SetBounds( 226 boot_times_label_->SetBounds(
250 kInfoLeftPadding, 227 kInfoLeftPadding,
251 height() - (version_size.height() + kInfoBottomPadding), 228 height() - (version_size.height() + kInfoBottomPadding),
252 width() - 2 * kInfoLeftPadding, 229 width() - 2 * kInfoLeftPadding,
253 version_size.height()); 230 version_size.height());
254 } 231 }
255 if (progress_bar_) {
256 progress_bar_->SetBounds(
257 (width() - kProgressBarWidth) / 2,
258 (height() - kProgressBarBottomPadding - kProgressBarHeight),
259 kProgressBarWidth,
260 kProgressBarHeight);
261 }
262 if (shutdown_button_) { 232 if (shutdown_button_) {
263 shutdown_button_->LayoutIn(this); 233 shutdown_button_->LayoutIn(this);
264 } 234 }
265 if (background_area_) 235 if (background_area_)
266 background_area_->SetBoundsRect(this->bounds()); 236 background_area_->SetBoundsRect(this->bounds());
267 } 237 }
268 238
269 void BackgroundView::ChildPreferredSizeChanged(View* child) { 239 void BackgroundView::ChildPreferredSizeChanged(View* child) {
270 Layout(); 240 Layout();
271 SchedulePaint(); 241 SchedulePaint();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 boot_times_label_->SetFont(rb.GetFont(ResourceBundle::SmallFont)); 333 boot_times_label_->SetFont(rb.GetFont(ResourceBundle::SmallFont));
364 if (idx < 0) 334 if (idx < 0)
365 AddChildView(boot_times_label_); 335 AddChildView(boot_times_label_);
366 else 336 else
367 AddChildViewAt(boot_times_label_, idx); 337 AddChildViewAt(boot_times_label_, idx);
368 } 338 }
369 339
370 version_info_updater_.StartUpdate(is_official_build_); 340 version_info_updater_.StartUpdate(is_official_build_);
371 } 341 }
372 342
373 void BackgroundView::InitProgressBar() {
374 std::vector<int> steps;
375 steps.push_back(GetStepId(SELECT_NETWORK));
376 #if defined(OFFICIAL_BUILD)
377 steps.push_back(GetStepId(EULA));
378 #endif
379 steps.push_back(GetStepId(SIGNIN));
380 #if defined(OFFICIAL_BUILD)
381 if (WizardController::IsRegisterScreenDefined())
382 steps.push_back(GetStepId(REGISTRATION));
383 #endif
384 steps.push_back(GetStepId(PICTURE));
385 progress_bar_ = new OobeProgressBar(steps);
386 AddChildView(progress_bar_);
387 }
388
389 void BackgroundView::UpdateWindowType() { 343 void BackgroundView::UpdateWindowType() {
390 #if defined(TOOLKIT_USES_GTK) 344 #if defined(TOOLKIT_USES_GTK)
391 std::vector<int> params; 345 std::vector<int> params;
392 WmIpc::instance()->SetWindowType( 346 WmIpc::instance()->SetWindowType(
393 GTK_WIDGET(GetNativeWindow()), 347 GTK_WIDGET(GetNativeWindow()),
394 WM_IPC_WINDOW_LOGIN_BACKGROUND, 348 WM_IPC_WINDOW_LOGIN_BACKGROUND,
395 &params); 349 &params);
396 #endif 350 #endif
397 } 351 }
398 352
399 } // namespace chromeos 353 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698