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

Side by Side Diff: chrome/browser/chromeos/setting_level_bubble_view.h

Issue 8319008: aura: brightness and volume bubble. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update. 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 #ifndef CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ 6 #define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/gtest_prod_util.h"
9 #include "views/view.h" 10 #include "views/view.h"
10 11
11 namespace views { 12 namespace views {
12 class ProgressBar; 13 class ProgressBar;
13 } // namespace views 14 } // namespace views
14 15
15 class SkBitmap; 16 class SkBitmap;
16 17
17 namespace chromeos { 18 namespace chromeos {
18 19
19 // SettingLevelBubbleView displays information about the current value of a 20 // SettingLevelBubbleView displays information about the current value of a
20 // level-based setting like volume or brightness. 21 // level-based setting like volume or brightness.
21 class SettingLevelBubbleView : public views::View { 22 class SettingLevelBubbleView : public views::View {
22 public: 23 public:
24 // Layout() is called before Init(), make sure |progress_bar_| is ready.
23 SettingLevelBubbleView(); 25 SettingLevelBubbleView();
24 26
25 // Initialize the view, setting the progress bar to the specified level in the 27 // Initialize the view, setting the progress bar to the specified level in the
26 // range [0.0, 100.0] and state. Ownership of |icon| remains with the caller 28 // range [0.0, 100.0] and state. Ownership of |icon| remains with the caller
27 // (it's probably a shared instance from ResourceBundle). 29 // (it's probably a shared instance from ResourceBundle).
28 void Init(SkBitmap* icon, double level, bool enabled); 30 void Init(SkBitmap* icon, double level, bool enabled);
29 31
30 // Change the icon that we're currently displaying. 32 // Change the icon that we're currently displaying.
31 void SetIcon(SkBitmap* icon); 33 void SetIcon(SkBitmap* icon);
32 34
33 // Set the progress bar to the specified level and redraw it. 35 // Set the progress bar to the specified level and redraw it.
34 void SetLevel(double level); 36 void SetLevel(double level);
35 37
36 // Draw the progress bar in an enabled or disabled state. 38 // Draw the progress bar in an enabled or disabled state.
37 void SetEnabled(bool enabled); 39 void SetEnabled(bool enabled);
38 40
39 // views::View implementation: 41 // views::View implementation:
40 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 42 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
41 virtual void Layout() OVERRIDE; 43 virtual void Layout() OVERRIDE;
42 virtual gfx::Size GetPreferredSize() OVERRIDE; 44 virtual gfx::Size GetPreferredSize() OVERRIDE;
43 45
44 private: 46 private:
47 FRIEND_TEST_ALL_PREFIXES(SettingLevelBubbleTest, CreateAndUpdate);
48
45 views::ProgressBar* progress_bar_; 49 views::ProgressBar* progress_bar_;
46 SkBitmap* icon_; // not owned 50 SkBitmap* icon_; // not owned
47 51
48 DISALLOW_COPY_AND_ASSIGN(SettingLevelBubbleView); 52 DISALLOW_COPY_AND_ASSIGN(SettingLevelBubbleView);
49 }; 53 };
50 54
51 } // namespace chromeos 55 } // namespace chromeos
52 56
53 #endif // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ 57 #endif // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698