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

Unified Diff: chrome/browser/chromeos/login/oobe_progress_bar.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/oobe_progress_bar.h ('k') | chrome/browser/chromeos/login/rounded_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/oobe_progress_bar.cc
diff --git a/chrome/browser/chromeos/login/oobe_progress_bar.cc b/chrome/browser/chromeos/login/oobe_progress_bar.cc
deleted file mode 100644
index 71735e848f31f540eada21316f0d7c6aa1c6a0bc..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/login/oobe_progress_bar.cc
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "chrome/browser/chromeos/login/oobe_progress_bar.h"
-
-#include "base/logging.h"
-#include "base/utf_string_conversions.h"
-#include "grit/theme_resources.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/canvas_skia.h"
-
-namespace chromeos {
-
-// static
-SkBitmap* OobeProgressBar::dot_current_ = NULL;
-SkBitmap* OobeProgressBar::dot_empty_ = NULL;
-SkBitmap* OobeProgressBar::dot_filled_ = NULL;
-SkBitmap* OobeProgressBar::line_ = NULL;
-SkBitmap* OobeProgressBar::line_left_ = NULL;
-SkBitmap* OobeProgressBar::line_right_ = NULL;
-
-static const SkColor kCurrentTextColor = SkColorSetRGB(255, 255, 255);
-static const SkColor kEmptyTextColor = SkColorSetRGB(112, 115, 118);
-static const SkColor kFilledTextColor = SkColorSetRGB(112, 115, 118);
-static const int kTextPadding = 5;
-
-OobeProgressBar::OobeProgressBar(const std::vector<int>& steps)
- : steps_(steps), progress_(0) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- font_ = rb.GetFont(ResourceBundle::BaseFont);
- InitClass();
-}
-
-OobeProgressBar::~OobeProgressBar() {}
-
-// static
-void OobeProgressBar::InitClass() {
- static bool initialized = false;
- if (!initialized) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
-
- // Load images.
- dot_current_ = rb.GetBitmapNamed(IDR_OOBE_PROGRESS_DOT_CURRENT);
- dot_empty_ = rb.GetBitmapNamed(IDR_OOBE_PROGRESS_DOT_EMPTY);
- dot_filled_ = rb.GetBitmapNamed(IDR_OOBE_PROGRESS_DOT_FILLED);
- line_ = rb.GetBitmapNamed(IDR_OOBE_PROGRESS_LINE);
- line_left_ = rb.GetBitmapNamed(IDR_OOBE_PROGRESS_LINE_LEFT);
- line_right_ = rb.GetBitmapNamed(IDR_OOBE_PROGRESS_LINE_RIGHT);
-
- initialized = true;
- }
-}
-
-void OobeProgressBar::OnPaint(gfx::Canvas* canvas) {
- gfx::Rect bounds = GetContentsBounds();
-
- int x = bounds.x();
- int y = bounds.y();
-
- double step_width = static_cast<double>(bounds.width()) / steps_.size();
-
- for (size_t i = 0; i < steps_.size(); ++i) {
- SkBitmap* dot;
- SkColor color;
- SkBitmap* line_before = line_;
- SkBitmap* line_after = line_;
- if (i < progress_) {
- dot = dot_filled_;
- color = kFilledTextColor;
- } else if (i == progress_) {
- dot = dot_current_;
- color = kCurrentTextColor;
- line_before = line_left_;
- line_after = line_right_;
- } else {
- dot = dot_empty_;
- color = kEmptyTextColor;
- }
-
- // x coordinate for next step.
- int next_x = static_cast<int>((i + 1) * step_width);
-
- // Offset of line origin from dot origin.
- int line_offset_y = (dot->height() - line_->height()) / 2;
-
- // Current x for painting.
- int ix = x;
-
- int line_width = ((next_x - x) -
- (line_before->width() + dot->width() + line_after->width())) / 2;
- if (i > 0) {
- canvas->TileImageInt(*line_, ix, y + line_offset_y,
- line_width, line_->height());
- }
- ix += line_width;
- if (i > 0) {
- canvas->DrawBitmapInt(*line_before, ix, y + line_offset_y);
- }
- ix += line_before->width();
-
- canvas->DrawBitmapInt(*dot, ix, y);
- ix += dot->width();
-
- if (i != steps_.size() - 1)
- canvas->DrawBitmapInt(*line_after, ix, y + line_offset_y);
- ix += line_after->width();
-
- if (i != steps_.size() - 1) {
- canvas->TileImageInt(*line_, ix, y + line_offset_y,
- next_x - ix, line_->height());
- }
-
- string16 str = l10n_util::GetStringUTF16(steps_[i]);
- canvas->DrawStringInt(str, font_, color,
- x + kTextPadding, y + dot->height() + kTextPadding,
- (next_x - x - 2 * kTextPadding),
- (bounds.height() - dot->height() - 2 * kTextPadding),
- gfx::Canvas::MULTI_LINE | gfx::Canvas::TEXT_ALIGN_CENTER |
- gfx::Canvas::TEXT_VALIGN_TOP | gfx::Canvas::NO_ELLIPSIS);
-
- x = next_x;
- }
-}
-
-void OobeProgressBar::OnLocaleChanged() {
- font_ = ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont);
- SchedulePaint();
-}
-
-void OobeProgressBar::SetStep(int step) {
- for (size_t i = 0; i < steps_.size(); ++i) {
- if (steps_[i] == step) {
- progress_ = i;
- SchedulePaint();
- return;
- }
- }
- NOTREACHED();
-}
-
-} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/oobe_progress_bar.h ('k') | chrome/browser/chromeos/login/rounded_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698