OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/shelf/shelf_view.h" | 5 #include "ash/shelf/shelf_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 size_t item_selected_count() const { return item_selected_count_; } | 146 size_t item_selected_count() const { return item_selected_count_; } |
147 void set_item_selected_action(ShelfAction item_selected_action) { | 147 void set_item_selected_action(ShelfAction item_selected_action) { |
148 item_selected_action_ = item_selected_action; | 148 item_selected_action_ = item_selected_action; |
149 } | 149 } |
150 | 150 |
151 // ShelfItemDelegate: | 151 // ShelfItemDelegate: |
152 void ItemSelected(std::unique_ptr<ui::Event> event, | 152 void ItemSelected(std::unique_ptr<ui::Event> event, |
153 int64_t display_id, | 153 int64_t display_id, |
154 ShelfLaunchSource source, | 154 ShelfLaunchSource source, |
155 const ItemSelectedCallback& callback) override { | 155 ItemSelectedCallback callback) override { |
156 item_selected_count_++; | 156 item_selected_count_++; |
157 callback.Run(item_selected_action_, base::nullopt); | 157 std::move(callback).Run(item_selected_action_, base::nullopt); |
158 } | 158 } |
159 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override {} | 159 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override {} |
160 void Close() override {} | 160 void Close() override {} |
161 | 161 |
162 private: | 162 private: |
163 size_t item_selected_count_ = 0; | 163 size_t item_selected_count_ = 0; |
164 ShelfAction item_selected_action_ = SHELF_ACTION_NONE; | 164 ShelfAction item_selected_action_ = SHELF_ACTION_NONE; |
165 | 165 |
166 DISALLOW_COPY_AND_ASSIGN(ShelfItemSelectionTracker); | 166 DISALLOW_COPY_AND_ASSIGN(ShelfItemSelectionTracker); |
167 }; | 167 }; |
(...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2000 class ListMenuShelfItemDelegate : public ShelfItemDelegate { | 2000 class ListMenuShelfItemDelegate : public ShelfItemDelegate { |
2001 public: | 2001 public: |
2002 ListMenuShelfItemDelegate() : ShelfItemDelegate(ShelfID()) {} | 2002 ListMenuShelfItemDelegate() : ShelfItemDelegate(ShelfID()) {} |
2003 ~ListMenuShelfItemDelegate() override {} | 2003 ~ListMenuShelfItemDelegate() override {} |
2004 | 2004 |
2005 private: | 2005 private: |
2006 // ShelfItemDelegate: | 2006 // ShelfItemDelegate: |
2007 void ItemSelected(std::unique_ptr<ui::Event> event, | 2007 void ItemSelected(std::unique_ptr<ui::Event> event, |
2008 int64_t display_id, | 2008 int64_t display_id, |
2009 ShelfLaunchSource source, | 2009 ShelfLaunchSource source, |
2010 const ItemSelectedCallback& callback) override { | 2010 ItemSelectedCallback callback) override { |
2011 // Two items are needed to show a menu; the data in the items is not tested. | 2011 // Two items are needed to show a menu; the data in the items is not tested. |
2012 std::vector<mojom::MenuItemPtr> items; | 2012 std::vector<mojom::MenuItemPtr> items; |
2013 items.push_back(mojom::MenuItem::New()); | 2013 items.push_back(mojom::MenuItem::New()); |
2014 items.push_back(mojom::MenuItem::New()); | 2014 items.push_back(mojom::MenuItem::New()); |
2015 callback.Run(SHELF_ACTION_NONE, std::move(items)); | 2015 std::move(callback).Run(SHELF_ACTION_NONE, std::move(items)); |
2016 } | 2016 } |
2017 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override {} | 2017 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override {} |
2018 void Close() override {} | 2018 void Close() override {} |
2019 | 2019 |
2020 DISALLOW_COPY_AND_ASSIGN(ListMenuShelfItemDelegate); | 2020 DISALLOW_COPY_AND_ASSIGN(ListMenuShelfItemDelegate); |
2021 }; | 2021 }; |
2022 | 2022 |
2023 } // namespace | 2023 } // namespace |
2024 | 2024 |
2025 // Test fixture for testing material design ink drop ripples on shelf. | 2025 // Test fixture for testing material design ink drop ripples on shelf. |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3117 EXPECT_EQ(views::InkDropState::ACTIVATED, | 3117 EXPECT_EQ(views::InkDropState::ACTIVATED, |
3118 overflow_button_ink_drop_->GetTargetInkDropState()); | 3118 overflow_button_ink_drop_->GetTargetInkDropState()); |
3119 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | 3119 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), |
3120 IsEmpty()); | 3120 IsEmpty()); |
3121 | 3121 |
3122 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); | 3122 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); |
3123 } | 3123 } |
3124 | 3124 |
3125 } // namespace test | 3125 } // namespace test |
3126 } // namespace ash | 3126 } // namespace ash |
OLD | NEW |