| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 147 | 147 | 
| 148   size_t item_selected_count() const { return item_selected_count_; } | 148   size_t item_selected_count() const { return item_selected_count_; } | 
| 149   void set_item_selected_action(ShelfAction item_selected_action) { | 149   void set_item_selected_action(ShelfAction item_selected_action) { | 
| 150     item_selected_action_ = item_selected_action; | 150     item_selected_action_ = item_selected_action; | 
| 151   } | 151   } | 
| 152 | 152 | 
| 153   // ShelfItemDelegate: | 153   // ShelfItemDelegate: | 
| 154   void ItemSelected(std::unique_ptr<ui::Event> event, | 154   void ItemSelected(std::unique_ptr<ui::Event> event, | 
| 155                     int64_t display_id, | 155                     int64_t display_id, | 
| 156                     ShelfLaunchSource source, | 156                     ShelfLaunchSource source, | 
| 157                     const ItemSelectedCallback& callback) override { | 157                     ItemSelectedCallback callback) override { | 
| 158     item_selected_count_++; | 158     item_selected_count_++; | 
| 159     callback.Run(item_selected_action_, base::nullopt); | 159     std::move(callback).Run(item_selected_action_, base::nullopt); | 
| 160   } | 160   } | 
| 161   void ExecuteCommand(uint32_t command_id, int32_t event_flags) override {} | 161   void ExecuteCommand(uint32_t command_id, int32_t event_flags) override {} | 
| 162   void Close() override {} | 162   void Close() override {} | 
| 163 | 163 | 
| 164  private: | 164  private: | 
| 165   size_t item_selected_count_ = 0; | 165   size_t item_selected_count_ = 0; | 
| 166   ShelfAction item_selected_action_ = SHELF_ACTION_NONE; | 166   ShelfAction item_selected_action_ = SHELF_ACTION_NONE; | 
| 167 | 167 | 
| 168   DISALLOW_COPY_AND_ASSIGN(ShelfItemSelectionTracker); | 168   DISALLOW_COPY_AND_ASSIGN(ShelfItemSelectionTracker); | 
| 169 }; | 169 }; | 
| (...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2009 class ListMenuShelfItemDelegate : public ShelfItemDelegate { | 2009 class ListMenuShelfItemDelegate : public ShelfItemDelegate { | 
| 2010  public: | 2010  public: | 
| 2011   ListMenuShelfItemDelegate() : ShelfItemDelegate(ShelfID()) {} | 2011   ListMenuShelfItemDelegate() : ShelfItemDelegate(ShelfID()) {} | 
| 2012   ~ListMenuShelfItemDelegate() override {} | 2012   ~ListMenuShelfItemDelegate() override {} | 
| 2013 | 2013 | 
| 2014  private: | 2014  private: | 
| 2015   // ShelfItemDelegate: | 2015   // ShelfItemDelegate: | 
| 2016   void ItemSelected(std::unique_ptr<ui::Event> event, | 2016   void ItemSelected(std::unique_ptr<ui::Event> event, | 
| 2017                     int64_t display_id, | 2017                     int64_t display_id, | 
| 2018                     ShelfLaunchSource source, | 2018                     ShelfLaunchSource source, | 
| 2019                     const ItemSelectedCallback& callback) override { | 2019                     ItemSelectedCallback callback) override { | 
| 2020     // Two items are needed to show a menu; the data in the items is not tested. | 2020     // Two items are needed to show a menu; the data in the items is not tested. | 
| 2021     std::vector<mojom::MenuItemPtr> items; | 2021     std::vector<mojom::MenuItemPtr> items; | 
| 2022     items.push_back(mojom::MenuItem::New()); | 2022     items.push_back(mojom::MenuItem::New()); | 
| 2023     items.push_back(mojom::MenuItem::New()); | 2023     items.push_back(mojom::MenuItem::New()); | 
| 2024     callback.Run(SHELF_ACTION_NONE, std::move(items)); | 2024     std::move(callback).Run(SHELF_ACTION_NONE, std::move(items)); | 
| 2025   } | 2025   } | 
| 2026   void ExecuteCommand(uint32_t command_id, int32_t event_flags) override {} | 2026   void ExecuteCommand(uint32_t command_id, int32_t event_flags) override {} | 
| 2027   void Close() override {} | 2027   void Close() override {} | 
| 2028 | 2028 | 
| 2029   DISALLOW_COPY_AND_ASSIGN(ListMenuShelfItemDelegate); | 2029   DISALLOW_COPY_AND_ASSIGN(ListMenuShelfItemDelegate); | 
| 2030 }; | 2030 }; | 
| 2031 | 2031 | 
| 2032 }  // namespace | 2032 }  // namespace | 
| 2033 | 2033 | 
| 2034 // Test fixture for testing material design ink drop ripples on shelf. | 2034 // Test fixture for testing material design ink drop ripples on shelf. | 
| (...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3126   EXPECT_EQ(views::InkDropState::ACTIVATED, | 3126   EXPECT_EQ(views::InkDropState::ACTIVATED, | 
| 3127             overflow_button_ink_drop_->GetTargetInkDropState()); | 3127             overflow_button_ink_drop_->GetTargetInkDropState()); | 
| 3128   EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | 3128   EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | 
| 3129               IsEmpty()); | 3129               IsEmpty()); | 
| 3130 | 3130 | 
| 3131   ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); | 3131   ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); | 
| 3132 } | 3132 } | 
| 3133 | 3133 | 
| 3134 }  // namespace test | 3134 }  // namespace test | 
| 3135 }  // namespace ash | 3135 }  // namespace ash | 
| OLD | NEW | 
|---|