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); |
+}; |
stevenjb
2013/06/21 01:08:35
I kind of hate exposing this in the header just fo
Jun Mukai
2013/06/21 04:48:50
Done.
|
+ |
+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. |
stevenjb
2013/06/21 01:08:35
s/to true/with |enabled| = true/
(The 'Default' cl
Jun Mukai
2013/06/21 04:48:50
Done.
|
+ // Default is false on test. |
+ static void SetDisplayNotificationsEnabledForTest(bool enabled); |
+ |
+ // Test utilities. |
stevenjb
2013/06/21 01:08:35
nit: s/utilities/accessors/
Jun Mukai
2013/06/21 04:48:50
Done.
|
+ 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_; |
stevenjb
2013/06/21 01:08:35
We should typedef this, e.g. DisplayInfoMap. It wi
Jun Mukai
2013/06/21 04:48:50
Done.
|
DISALLOW_COPY_AND_ASSIGN(TrayDisplay); |
}; |