Return backed up TemplateURL on default search change
[chromium-blink-merge.git] / chrome / browser / chromeos / setting_level_bubble_view.h
bloba9c07f5595e4a81cc58c03f8fceb44c69c1b8732
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.
5 #ifndef CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_
7 #pragma once
9 #include "base/gtest_prod_util.h"
10 #include "ui/views/view.h"
12 namespace views {
13 class ProgressBar;
14 } // namespace views
16 class SkBitmap;
18 namespace chromeos {
20 // SettingLevelBubbleView displays information about the current value of a
21 // level-based setting like volume or brightness.
22 class SettingLevelBubbleView : public views::View {
23 public:
24 // Layout() is called before Init(), make sure |progress_bar_| is ready.
25 SettingLevelBubbleView();
27 // Initialize the view, setting the progress bar to the specified level in the
28 // range [0.0, 100.0] and state. Ownership of |icon| remains with the caller
29 // (it's probably a shared instance from ResourceBundle).
30 void Init(SkBitmap* icon, double level, bool enabled);
32 // Change the icon that we're currently displaying.
33 void SetIcon(SkBitmap* icon);
35 // Set the progress bar to the specified level and redraw it.
36 void SetLevel(double level);
38 // Draw the progress bar in an enabled or disabled state.
39 void SetEnabled(bool enabled);
41 // views::View implementation:
42 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
43 virtual void Layout() OVERRIDE;
44 virtual gfx::Size GetPreferredSize() OVERRIDE;
46 private:
47 FRIEND_TEST_ALL_PREFIXES(SettingLevelBubbleTest, CreateAndUpdate);
49 views::ProgressBar* progress_bar_;
50 SkBitmap* icon_; // not owned
52 DISALLOW_COPY_AND_ASSIGN(SettingLevelBubbleView);
55 } // namespace chromeos
57 #endif // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_