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

Unified Diff: ash/system/power/power_status_view.h

Issue 10540041: Add battery status to settings row in uber tray bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ash/system/power/power_status_view.h
diff --git a/ash/system/power/power_status_view.h b/ash/system/power/power_status_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..af6ef8617cb8b46650642cadea989c9ece7754b5
--- /dev/null
+++ b/ash/system/power/power_status_view.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2012 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.
+
+#ifndef ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_
+#define ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_
+#pragma once
+
+#include "ash/system/power/power_supply_status.h"
+#include "ui/views/view.h"
+
+namespace views {
+class ImageView;
+class Label;
+}
+
+namespace ash {
+namespace internal {
+namespace tray {
stevenjb 2012/06/07 01:31:18 I don't think we should use namespace tray for any
jennyz 2012/06/07 22:06:52 Done.
+
+// This view is used only for the popup.
+class PowerStatusView : public views::View {
+ public:
+ enum ViewType {
+ VIEW_DEFAULT,
+ VIEW_NOTIFICATION
+ };
+
+ explicit PowerStatusView(ViewType view_type);
+ virtual ~PowerStatusView() {}
+
+ void UpdatePowerStatus(const PowerSupplyStatus& status);
+
+ // Overridden from views::View.
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+
+ private:
+ void LayoutDefaultView();
+ void LayoutNotificationView();
+ void UpdateText();
+ void UpdateIcon();
+ void Update();
+ void UpdateTextForDefaultView();
+ void UpdateTextForNotificationView();
+
+ // Overridden from views::View.
+ virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE;
+
+ // labels used only for VIEW_NOTIFICATION.
+ views::Label* status_label_;
+ views::Label* time_label_;
+
+ // labels used only for VIEW_DEFAULT.
+ views::Label* time_status_label_;
+
+ views::ImageView* icon_;
+ ViewType view_type_;
+
+ PowerSupplyStatus supply_status_;
+
+ DISALLOW_COPY_AND_ASSIGN(PowerStatusView);
+};
+
+} // namespace tray
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698