[go: nahoru, domu]

chromeos: Move //ash/common files into //ash

//ash contains the "Aura Shell" system UI used by Chrome OS. For the
mustash servicification project we initially started moving files into
//ash/mus vs. //ash/aura vs. //ash/common. This allowed us to use DEPS
to ban aura includes. We now support aura on mus all the time, so we
don't need this directory structure.

BUG=690096
TEST=compiles, ash_unittests
TBR=sky@chromium.org

Change-Id: I682586877b6c537d2db613664318bbc0365362c6

CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Change-Id: I682586877b6c537d2db613664318bbc0365362c6
Reviewed-on: https://chromium-review.googlesource.com/472548
Reviewed-by: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#463140}
diff --git a/ash/shelf/app_list_button.h b/ash/shelf/app_list_button.h
new file mode 100644
index 0000000..b9ad7f1
--- /dev/null
+++ b/ash/shelf/app_list_button.h
@@ -0,0 +1,74 @@
+// Copyright 2014 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_SHELF_APP_LIST_BUTTON_H_
+#define ASH_SHELF_APP_LIST_BUTTON_H_
+
+#include <memory>
+
+#include "ash/ash_export.h"
+#include "base/macros.h"
+#include "third_party/skia/include/core/SkColor.h"
+#include "ui/views/controls/button/image_button.h"
+
+namespace ash {
+class InkDropButtonListener;
+class ShelfView;
+class WmShelf;
+
+// Button used for the AppList icon on the shelf.
+class ASH_EXPORT AppListButton : public views::ImageButton {
+ public:
+  AppListButton(InkDropButtonListener* listener,
+                ShelfView* shelf_view,
+                WmShelf* wm_shelf);
+  ~AppListButton() override;
+
+  void OnAppListShown();
+  void OnAppListDismissed();
+
+  bool is_showing_app_list() const { return is_showing_app_list_; }
+
+  // Updates background and schedules a paint.
+  void UpdateShelfItemBackground(SkColor color);
+
+  // views::ImageButton overrides:
+  void OnGestureEvent(ui::GestureEvent* event) override;
+
+ protected:
+  // views::ImageButton overrides:
+  bool OnMousePressed(const ui::MouseEvent& event) override;
+  void OnMouseReleased(const ui::MouseEvent& event) override;
+  void OnMouseCaptureLost() override;
+  bool OnMouseDragged(const ui::MouseEvent& event) override;
+  void OnPaint(gfx::Canvas* canvas) override;
+  void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
+  std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override;
+  void NotifyClick(const ui::Event& event) override;
+  bool ShouldEnterPushedState(const ui::Event& event) override;
+  std::unique_ptr<views::InkDrop> CreateInkDrop() override;
+  std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override;
+
+ private:
+  // Get the center point of the app list button used to draw its background and
+  // ink drops.
+  gfx::Point GetCenterPoint() const;
+
+  // True if the app list is currently showing for this display.
+  // This is useful because other IsApplistVisible functions aren't per-display.
+  bool is_showing_app_list_;
+
+  // Color used to paint the background.
+  SkColor background_color_;
+
+  InkDropButtonListener* listener_;
+  ShelfView* shelf_view_;
+  WmShelf* wm_shelf_;
+
+  DISALLOW_COPY_AND_ASSIGN(AppListButton);
+};
+
+}  // namespace ash
+
+#endif  // ASH_SHELF_APP_LIST_BUTTON_H_