Commit 1e5ad60e authored by mukai@chromium.org's avatar mukai@chromium.org

Updates the display message in the uber tray.

This CL contains the following fixes:
- shows the notification for display rotation / ui_scale
- adds (width x height) annotation to the display if something
  has been edited
- shows the internal display's status if something for the internal
  display has been edited and no external display is connected
- shows the tooltip text to provide the status of both internal and
  extrenal displays at the same time

This CL does not contain:
- the feature to prevent notification when the settings change happens
  from chrome://settings/display

I think we can achieve this by suppressing the notification when
the current active tab is chrome://settings/display, but anyways
it'll be done in another CL. That is marked as a TODO.

BUG=250650, 246271

Review URL: https://chromiumcodereview.appspot.com/17445002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207998 0039d316-1c4b-4281-b951-d872f2087c98
parent 5ad0c707
......@@ -698,6 +698,7 @@
'shell/window_watcher_unittest.cc',
'system/chromeos/network/network_state_notifier_unittest.cc',
'system/chromeos/power/tray_power_unittest.cc',
'system/chromeos/tray_display_unittest.cc',
'system/tray/system_tray_unittest.cc',
'system/user/tray_user_unittest.cc',
'system/web_notification/web_notification_tray_unittest.cc',
......
......@@ -321,6 +321,15 @@ Press Ctrl+Alt+Z to disable.
<message name="IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED" desc="The label used in the tray to show that the current status is docked mode.">
Dock mode
</message>
<message name="IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED" desc="The label used in the tray to notify that the display resolution settings has changed.">
<ph name="DISPLAY_NAME">$1</ph> has been resized to <ph name="RESOLUTION">$2</ph>
</message>
<message name="IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED" desc="The label used in the tray to notify that the display rotation settings has changed.">
<ph name="DISPLAY_NAME">$1</ph> has been rotated
</message>
<message name="IDS_ASH_STATUS_TRAY_DISPLAY_SINGLE_DISPLAY" desc="The label used in the tray to show the current display's configuration if there is a single display">
<ph name="DISPLAY_NAME">$1</ph>: <ph name="RESOLUTION">$2</ph>
</message>
<message name="IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME" desc="Label shown in tray for a display whose name is unknown.">
Unknown Display
</message>
......
This diff is collapsed.
......@@ -5,33 +5,40 @@
#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/system_tray_item.h"
#include "base/strings/string16.h"
#include "ui/views/view.h"
namespace views {
class View;
namespace ash {
namespace test {
class AshTestBase;
}
namespace ash {
namespace internal {
enum TrayDisplayMode {
TRAY_DISPLAY_SINGLE,
TRAY_DISPLAY_EXTENDED,
TRAY_DISPLAY_MIRRORED,
TRAY_DISPLAY_DOCKED,
};
class DisplayView;
class DisplayNotificationView;
class TrayDisplay : public SystemTrayItem,
public DisplayController::Observer {
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;
typedef std::map<int64, DisplayInfo> DisplayInfoMap;
// 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 +50,19 @@ class TrayDisplay : public SystemTrayItem,
// Overridden from DisplayControllerObserver:
virtual void OnDisplayConfigurationChanged() OVERRIDE;
DisplayView* default_;
// Call this with |diabled| = false when the test case wants to see the
// display notification.
static void SetDisplayNotificationsDisabledForTest(bool disabled);
// Test accessors.
base::string16 GetDefaultViewMessage();
views::View* default_view() { return default_; }
const string16& current_message() const { return current_message_; }
views::View* default_;
DisplayNotificationView* notification_;
TrayDisplayMode current_mode_;
string16 current_message_;
DisplayInfoMap display_info_;
DISALLOW_COPY_AND_ASSIGN(TrayDisplay);
};
......
This diff is collapsed.
......@@ -30,6 +30,10 @@
#include "ui/gfx/point.h"
#include "ui/gfx/screen.h"
#if defined(OS_CHROMEOS)
#include "ash/system/chromeos/tray_display.h"
#endif
#if defined(OS_WIN)
#include "ash/test/test_metro_viewer_process_host.h"
#include "base/test/test_process_killer_win.h"
......@@ -114,6 +118,14 @@ void AshTestBase::SetUp() {
Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000));
ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents();
#if defined(OS_CHROMEOS)
// We do not want to see the notification for display configuration change,
// since it may trap mouse events unexpectedly.
// TODO(mukai): remove this code when the display notification code is moved
// to the message center.
internal::TrayDisplay::SetDisplayNotificationsDisabledForTest(true);
#endif
#if defined(OS_WIN)
if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
!CommandLine::ForCurrentProcess()->HasSwitch(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment