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

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: Change SetWindowState() with SetImeWindow(). 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..30d3196d5567241be38206045f0dc385553f294e
--- /dev/null
+++ b/ash/system/chromeos/ime_menu/ime_menu_tray.h
@@ -0,0 +1,71 @@
+// 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"
+
+namespace aura {
+class Window;
+} // namespace arua
+
+namespace views {
+class Label;
+} // namespace views
+
+namespace ash {
+class StatusAreaWidget;
+
+class ASH_EXPORT ImeMenuTray : public TrayBackgroundView,
+ public IMEObserver,
+ public aura::WindowObserver {
+ public:
+ explicit ImeMenuTray(StatusAreaWidget* status_area_widget);
+ ~ImeMenuTray() override;
+
+ // Sets the IME menu window.
+ void SetImeWindow(aura::Window* window);
+
+ // 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;
+
+ // aura::WindowObserver:
+ void OnWindowVisibilityChanging(aura::Window* window, bool visible) override;
+ void OnWindowDestroying(aura::Window* window) override;
+
+ private:
+ // To allow the test class to access GetLabelTextForTest() method.
+ friend class ImeMenuTrayTest;
+
+ // Updates the text of the label on the tray.
+ void UpdateTrayLabel();
+
+ // Sets the border of the label to keep the tray width consistant.
+ void SetLabelBorder();
+
+ views::Label* label_;
+ aura::Window* window_;
+ 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