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

Unified 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, 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/ime_menu/ime_menu_tray.h
diff --git a/ash/system/chromeos/ime_menu/ime_menu_tray.h b/ash/system/chromeos/ime_menu/ime_menu_tray.h
new file mode 100644
index 0000000000000000000000000000000000000000..c4e195f5df475e211512959e4152708e3bc73e5d
--- /dev/null
+++ b/ash/system/chromeos/ime_menu/ime_menu_tray.h
@@ -0,0 +1,78 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_
+#define ASH_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_
+
+#include "ash/ash_export.h"
+#include "ash/common/system/ime/ime_observer.h"
+#include "ash/common/system/tray/system_tray_delegate.h"
+#include "ash/common/system/tray/tray_background_view.h"
+#include "ash/common/wm/window_state_observer.h"
+#include "base/macros.h"
+#include "ui/aura/window_observer.h"
+#include "ui/views/controls/label.h"
+
+namespace ash {
+
+class StatusAreaWidget;
+
+class ImeMenuLabel : public views::Label {
+ public:
+ ImeMenuLabel() : views::Label(base::string16()) {}
+
+ // views:Label:
+ gfx::Size GetPreferredSize() const override;
+
+ private:
+ 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.
+};
+
+class ASH_EXPORT ImeMenuTray : public TrayBackgroundView,
+ public IMEObserver,
+ public wm::WindowStateObserver {
+ public:
+ explicit ImeMenuTray(StatusAreaWidget* status_area_widget);
+ ~ImeMenuTray() override;
+
+ // Sets the window state of the IME menu AppWindow.
+ void SetWindowState(wm::WindowState* window_state);
+
+ // TrayBackgroundView:
+ void SetShelfAlignment(ShelfAlignment alignment) override;
+ base::string16 GetAccessibleNameForTray() override;
+ void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override;
+ void ClickedOutsideBubble() override;
+ bool PerformAction(const ui::Event& event) override;
+
+ // IMEObserver:
+ void OnIMERefresh() override;
+ void OnIMEMenuActivationChanged(bool is_activated) override;
+
+ // wm::WindowStateObserver:
+ void OnPostWindowStateTypeChange(wm::WindowState* window_state,
+ wm::WindowStateType old_type) override;
+
+ private:
+ // To allow the test class to access GetLabelTextForTest() method.
+ friend class ImeMenuTrayTest;
+
+ // Updates the UI of the IME menu tray.
+ void UpdateTray();
+ // Sets the border of the label to keep the tray width consistant.
+ void SetLabelBorder();
+
+ // Returns the text of the tray label.
+ 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.
+
+ 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.
+ ash::wm::WindowState* window_state_;
+ ash::IMEInfo current_ime_;
+
+ DISALLOW_COPY_AND_ASSIGN(ImeMenuTray);
+};
+
+} // namespace ash
+
+#endif // ASH_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_

Powered by Google App Engine
This is Rietveld 408576698