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

Unified Diff: ash/system/chromeos/tray_display.h

Issue 17445002: Updates the display message in the uber tray. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 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/chromeos/tray_display.h
diff --git a/ash/system/chromeos/tray_display.h b/ash/system/chromeos/tray_display.h
index 0265704ea677b3eb92943838ed52459a8c594575..ce617d2f448489f1d98b0cc8eff5b35cff2bae2c 100644
--- a/ash/system/chromeos/tray_display.h
+++ b/ash/system/chromeos/tray_display.h
@@ -5,33 +5,75 @@
#ifndef ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_
#define ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_
+#include <map>
+
+#include "ash/ash_export.h"
#include "ash/display/display_controller.h"
+#include "ash/display/display_info.h"
+#include "ash/system/tray/actionable_view.h"
#include "ash/system/tray/system_tray_item.h"
+#include "base/strings/string16.h"
+
+namespace gfx {
+class Point;
+}
namespace views {
+class ImageView;
+class Label;
class View;
}
namespace ash {
-namespace internal {
+namespace test {
+class AshTestBase;
+}
-enum TrayDisplayMode {
- TRAY_DISPLAY_SINGLE,
- TRAY_DISPLAY_EXTENDED,
- TRAY_DISPLAY_MIRRORED,
- TRAY_DISPLAY_DOCKED,
-};
+namespace internal {
-class DisplayView;
class DisplayNotificationView;
-class TrayDisplay : public SystemTrayItem,
- public DisplayController::Observer {
+class DisplayView : public ash::internal::ActionableView {
+ public:
+ explicit DisplayView(user::LoginStatus login_status);
+ virtual ~DisplayView();
+
+ void Update();
+
+ views::Label* label() { return label_; }
+
+ // Overridden from views::View.
+ virtual bool GetTooltipText(const gfx::Point& p,
+ string16* tooltip) const OVERRIDE;
+
+ private:
+ base::string16 GetInternalDisplayInfo() const;
+
+ // Overridden from ActionableView.
+ virtual bool PerformAction(const ui::Event& event) OVERRIDE;
+ virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
+
+ user::LoginStatus login_status_;
+ views::ImageView* image_;
+ views::Label* label_;
+
+ DISALLOW_COPY_AND_ASSIGN(DisplayView);
+};
+
+class ASH_EXPORT TrayDisplay : public SystemTrayItem,
+ public DisplayController::Observer {
public:
explicit TrayDisplay(SystemTray* system_tray);
virtual ~TrayDisplay();
private:
+ friend class test::AshTestBase;
+ friend class TrayDisplayTest;
+
+ // Checks the current display settings and determine what message should be
+ // shown for notification.
+ base::string16 GetDisplayMessageForNotification();
+
// Overridden from SystemTrayItem.
virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE;
virtual views::View* CreateNotificationView(
@@ -43,9 +85,18 @@ class TrayDisplay : public SystemTrayItem,
// Overridden from DisplayControllerObserver:
virtual void OnDisplayConfigurationChanged() OVERRIDE;
+ // Call this to true when the test case wants to see the display notification.
+ // Default is false on test.
+ static void SetDisplayNotificationsEnabledForTest(bool enabled);
+
+ // Test utilities.
+ DisplayView* default_view() { return default_; }
+ const string16& current_message() const { return current_message_; }
+
DisplayView* default_;
DisplayNotificationView* notification_;
- TrayDisplayMode current_mode_;
+ string16 current_message_;
+ std::map<int64, DisplayInfo> display_info_;
DISALLOW_COPY_AND_ASSIGN(TrayDisplay);
};

Powered by Google App Engine
This is Rietveld 408576698