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

Side by Side Diff: ash/system/chromeos/screen_layout_observer.h

Issue 2217713002: Remove the system menu display settings row (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ 5 #ifndef ASH_SYSTEM_CHROMEOS_SCREEN_LAYOUT_OBSERVER_H_
6 #define ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ 6 #define ASH_SYSTEM_CHROMEOS_SCREEN_LAYOUT_OBSERVER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 11
12 #include "ash/ash_export.h" 12 #include "ash/ash_export.h"
13 #include "ash/common/display/display_info.h" 13 #include "ash/common/display/display_info.h"
14 #include "ash/common/system/tray/system_tray_item.h" 14 #include "ash/common/system/tray/system_tray_item.h"
James Cook 2016/08/05 17:00:24 not needed?
yiyix 2016/08/13 05:28:51 Done.
15 #include "ash/common/wm_display_observer.h" 15 #include "ash/common/wm_display_observer.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
18 #include "ui/views/view.h" 18 #include "ui/views/view.h"
James Cook 2016/08/05 17:00:24 not needed?
yiyix 2016/08/13 05:28:51 Done.
19 19
20 namespace ash { 20 namespace ash {
21 21
22 class DisplayView; 22 class DisplayView;
23 23
24 class ASH_EXPORT TrayDisplay : public SystemTrayItem, public WmDisplayObserver { 24 class ASH_EXPORT ScreenLayoutObserver : public WmDisplayObserver {
James Cook 2016/08/05 17:00:24 Add class comment explaining what this does and wh
yiyix 2016/08/13 05:28:51 Done.
25 public: 25 public:
26 explicit TrayDisplay(SystemTray* system_tray); 26 explicit ScreenLayoutObserver();
James Cook 2016/08/05 17:00:24 no explicit
yiyix 2016/08/13 05:28:51 Done.
27 ~TrayDisplay() override; 27 ~ScreenLayoutObserver() override;
28 28
29 // Overridden from WmDisplayObserver: 29 // Overridden from WmDisplayObserver:
30 void OnDisplayConfigurationChanged() override; 30 void OnDisplayConfigurationChanged() override;
31 31
32 private: 32 private:
33 friend class TrayDisplayTest; 33 friend class ScreenLayoutObserverTest;
34 34
35 typedef std::map<int64_t, DisplayInfo> DisplayInfoMap; 35 typedef std::map<int64_t, DisplayInfo> DisplayInfoMap;
36 36
37 static const char kNotificationId[]; 37 static const char kNotificationId[];
38 38
39 // Scans the current display info and updates |display_info_|. Sets the 39 // Scans the current display info and updates |display_info_|. Sets the
40 // previous data to |old_info| if it's not NULL. 40 // previous data to |old_info| if it's not NULL.
41 void UpdateDisplayInfo(DisplayInfoMap* old_info); 41 void UpdateDisplayInfo(DisplayInfoMap* old_info);
42 42
43 // Compares the current display settings with |old_info| and determine what 43 // Compares the current display settings with |old_info| and determine what
44 // message should be shown for notification. Returns true if there's a 44 // message should be shown for notification. Returns true if there's a
45 // meaningful change. Note that it's possible to return true and set 45 // meaningful change. Note that it's possible to return true and set
46 // |message_out| to empty, which means the notification should be removed. It 46 // |message_out| to empty, which means the notification should be removed. It
47 // also sets |additional_message_out| which appears in the notification with 47 // also sets |additional_message_out| which appears in the notification with
48 // the |message_out|. 48 // the |message_out|.
49 bool GetDisplayMessageForNotification(const DisplayInfoMap& old_info, 49 bool GetDisplayMessageForNotification(const DisplayInfoMap& old_info,
50 base::string16* message_out, 50 base::string16* message_out,
51 base::string16* additional_message_out); 51 base::string16* additional_message_out);
52 52
53 // Creates or updates the display notification. 53 // Creates or updates the display notification.
54 void CreateOrUpdateNotification(const base::string16& message, 54 void CreateOrUpdateNotification(const base::string16& message,
55 const base::string16& additional_message); 55 const base::string16& additional_message);
56 56
57 // Overridden from SystemTrayItem.
58 views::View* CreateDefaultView(LoginStatus status) override;
59 void DestroyDefaultView() override;
60
61 // Test accessors.
62 base::string16 GetDefaultViewMessage() const;
63 bool GetAccessibleStateForTesting(ui::AXViewState* state);
64 const views::View* default_view() const {
65 return reinterpret_cast<views::View*>(default_);
66 }
67
68 DisplayView* default_;
69 DisplayInfoMap display_info_; 57 DisplayInfoMap display_info_;
70 58
71 DISALLOW_COPY_AND_ASSIGN(TrayDisplay); 59 DISALLOW_COPY_AND_ASSIGN(ScreenLayoutObserver);
James Cook 2016/08/05 17:00:24 I like that you renamed to class to better represe
yiyix 2016/08/13 05:28:51 Thanks!
72 }; 60 };
73 61
74 } // namespace ash 62 } // namespace ash
75 63
76 #endif // ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ 64 #endif // ASH_SYSTEM_CHROMEOS_SCREEN_LAYOUT_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698