| Index: mash/shelf/shelf_button_host.h
|
| diff --git a/ash/shelf/shelf_button_host.h b/mash/shelf/shelf_button_host.h
|
| similarity index 60%
|
| copy from ash/shelf/shelf_button_host.h
|
| copy to mash/shelf/shelf_button_host.h
|
| index b664c7f407777d18f7cad77671fb379c76f0b8ee..4111fdd2c797ec6c64426805f2e8b3e607d87e4e 100644
|
| --- a/ash/shelf/shelf_button_host.h
|
| +++ b/mash/shelf/shelf_button_host.h
|
| @@ -2,11 +2,12 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef ASH_SHELF_SHELF_BUTTON_HOST_H_
|
| -#define ASH_SHELF_SHELF_BUTTON_HOST_H_
|
| +#ifndef MASH_SHELF_SHELF_BUTTON_HOST_H_
|
| +#define MASH_SHELF_SHELF_BUTTON_HOST_H_
|
|
|
| -#include "ash/ash_export.h"
|
| +#include "base/logging.h"
|
| #include "base/strings/string16.h"
|
| +#include "mash/shelf/shelf_types.h"
|
|
|
| namespace ui {
|
| class LocatedEvent;
|
| @@ -16,11 +17,13 @@ namespace views {
|
| class View;
|
| }
|
|
|
| -namespace ash {
|
| +namespace mash {
|
| +namespace shelf {
|
|
|
| +// TODO(msw): Eliminate this abstraction and just pass pointers to ShelfView?
|
| // The shelf buttons communicate back to the host by way of this interface.
|
| // This interface is used to enable reordering the items on the shelf.
|
| -class ASH_EXPORT ShelfButtonHost {
|
| +class ShelfButtonHost {
|
| public:
|
| enum Pointer {
|
| NONE,
|
| @@ -29,6 +32,29 @@ class ASH_EXPORT ShelfButtonHost {
|
| TOUCH,
|
| };
|
|
|
| + virtual ShelfAlignment GetAlignment() const = 0;
|
| +
|
| + virtual bool IsHorizontalAlignment() const = 0;
|
| +
|
| + // Helper function for choosing values specific to the shelf alignment.
|
| + template<typename T>
|
| + T PrimaryAxisValue(T horizontal, T vertical) const {
|
| + return IsHorizontalAlignment() ? horizontal : vertical;
|
| + }
|
| +
|
| + // Helper function for choosing values specific to the shelf alignment.
|
| + template<typename T>
|
| + T SelectValueForShelfAlignment(T bottom, T left, T right, T top) const {
|
| + switch (GetAlignment()) {
|
| + case SHELF_ALIGNMENT_BOTTOM: return bottom;
|
| + case SHELF_ALIGNMENT_LEFT: return left;
|
| + case SHELF_ALIGNMENT_RIGHT: return right;
|
| + case SHELF_ALIGNMENT_TOP: return top;
|
| + }
|
| + NOTREACHED();
|
| + return bottom;
|
| + }
|
| +
|
| // Invoked when a pointer device is pressed on a view.
|
| virtual void PointerPressedOnButton(views::View* view,
|
| Pointer pointer,
|
| @@ -60,6 +86,7 @@ class ASH_EXPORT ShelfButtonHost {
|
| virtual ~ShelfButtonHost() {}
|
| };
|
|
|
| -} // namespace ash
|
| +} // namespace shelf
|
| +} // namespace mash
|
|
|
| -#endif // ASH_SHELF_SHELF_BUTTON_HOST_H_
|
| +#endif // MASH_SHELF_SHELF_BUTTON_HOST_H_
|
|
|