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

Side by Side Diff: ash/system/chromeos/ime_menu/ime_menu_tray.h

Issue 1996563002: Add ImeMenuTray element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Activates window when clicked. Created 4 years, 5 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ASH_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_
6 #define ASH_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_
7
8 #include "ash/ash_export.h"
9 #include "ash/common/system/ime/ime_observer.h"
10 #include "ash/common/system/tray/system_tray_delegate.h"
11 #include "ash/common/system/tray/tray_background_view.h"
12 #include "ash/common/wm/window_state_observer.h"
13 #include "base/macros.h"
14 #include "ui/aura/window_observer.h"
15 #include "ui/views/controls/label.h"
16
17 namespace ash {
18
19 class StatusAreaWidget;
20
21 class ImeMenuLabel : public views::Label {
22 public:
23 ImeMenuLabel() : views::Label(base::string16()) {}
24
25 // views:Label:
26 gfx::Size GetPreferredSize() const override;
27
28 private:
29 DISALLOW_COPY_AND_ASSIGN(ImeMenuLabel);
sadrul 2016/06/29 15:14:10 This should go in the .cc file
Azure Wei 2016/06/30 00:36:30 Done.
30 };
31
32 class ASH_EXPORT ImeMenuTray : public TrayBackgroundView,
33 public IMEObserver,
34 public wm::WindowStateObserver {
35 public:
36 explicit ImeMenuTray(StatusAreaWidget* status_area_widget);
37 ~ImeMenuTray() override;
38
39 // Sets the window state of the IME menu AppWindow.
40 void SetWindowState(wm::WindowState* window_state);
41
42 // TrayBackgroundView:
43 void SetShelfAlignment(ShelfAlignment alignment) override;
44 base::string16 GetAccessibleNameForTray() override;
45 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override;
46 void ClickedOutsideBubble() override;
47 bool PerformAction(const ui::Event& event) override;
48
49 // IMEObserver:
50 void OnIMERefresh() override;
51 void OnIMEMenuActivationChanged(bool is_activated) override;
52
53 // wm::WindowStateObserver:
54 void OnPostWindowStateTypeChange(wm::WindowState* window_state,
55 wm::WindowStateType old_type) override;
56
57 private:
58 // To allow the test class to access GetLabelTextForTest() method.
59 friend class ImeMenuTrayTest;
60
61 // Updates the UI of the IME menu tray.
62 void UpdateTray();
63 // Sets the border of the label to keep the tray width consistant.
64 void SetLabelBorder();
65
66 // Returns the text of the tray label.
67 base::string16 GetLabelTextForTesting();
sadrul 2016/06/29 15:14:10 const & (although since ImeMenuTrayTest is already
Azure Wei 2016/06/30 00:36:30 Removed this.
68
69 ImeMenuLabel* label_;
sadrul 2016/06/29 15:14:10 |label_| can be a views::Label (since ImeMenuLabel
Azure Wei 2016/06/30 00:36:30 Done.
70 ash::wm::WindowState* window_state_;
71 ash::IMEInfo current_ime_;
72
73 DISALLOW_COPY_AND_ASSIGN(ImeMenuTray);
74 };
75
76 } // namespace ash
77
78 #endif // ASH_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698