OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/common/shelf/shelf_controller.h" | 5 #include "ash/common/shelf/shelf_controller.h" |
6 | 6 |
7 #include "ash/common/shelf/shelf_item_delegate.h" | 7 #include "ash/common/shelf/shelf_item_delegate.h" |
8 #include "ash/common/shelf/wm_shelf.h" | 8 #include "ash/common/shelf/wm_shelf.h" |
9 #include "ash/common/wm_lookup.h" | 9 #include "ash/common/wm_lookup.h" |
10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 const std::map<uint32_t, base::string16>& window_id_to_title() const { | 48 const std::map<uint32_t, base::string16>& window_id_to_title() const { |
49 return window_id_to_title_; | 49 return window_id_to_title_; |
50 } | 50 } |
51 | 51 |
52 const base::string16& title() { return title_; } | 52 const base::string16& title() { return title_; } |
53 void set_title(const base::string16& title) { title_ = title; } | 53 void set_title(const base::string16& title) { title_ = title; } |
54 | 54 |
55 private: | 55 private: |
56 // ShelfItemDelegate: | 56 // ShelfItemDelegate: |
57 ShelfItemDelegate::PerformedAction ItemSelected( | 57 ShelfAction ItemSelected(ui::EventType event_type, |
58 const ui::Event& event) override { | 58 int event_flags, |
| 59 int64_t display_id, |
| 60 ShelfLaunchSource source) override { |
59 if (window_id_to_title_.empty()) { | 61 if (window_id_to_title_.empty()) { |
60 delegate_->LaunchItem(); | 62 delegate_->LaunchItem(); |
61 return kNewWindowCreated; | 63 return SHELF_ACTION_NEW_WINDOW_CREATED; |
62 } | 64 } |
63 if (window_id_to_title_.size() == 1) { | 65 if (window_id_to_title_.size() == 1) { |
64 // TODO(mash): Activate the window and return kExistingWindowActivated. | 66 // TODO(mash): Activate the window and return |
| 67 // SHELF_ACTION_WINDOW_ACTIVATED. |
65 NOTIMPLEMENTED(); | 68 NOTIMPLEMENTED(); |
66 } | 69 } |
67 return kNoAction; | 70 return SHELF_ACTION_NONE; |
68 } | 71 } |
69 | 72 |
70 ShelfAppMenuItemList GetAppMenuItems(int event_flags) override { | 73 ShelfAppMenuItemList GetAppMenuItems(int event_flags) override { |
71 ShelfAppMenuItemList items; | 74 ShelfAppMenuItemList items; |
72 for (const auto& window : window_id_to_title_) { | 75 for (const auto& window : window_id_to_title_) { |
73 items.push_back( | 76 items.push_back( |
74 base::MakeUnique<ShelfApplicationMenuItem>(window.second)); | 77 base::MakeUnique<ShelfApplicationMenuItem>(window.second)); |
75 } | 78 } |
76 return items; | 79 return items; |
77 } | 80 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 return; | 234 return; |
232 ShelfID shelf_id = app_id_to_shelf_id_[app_id]; | 235 ShelfID shelf_id = app_id_to_shelf_id_[app_id]; |
233 int index = model_.ItemIndexByID(shelf_id); | 236 int index = model_.ItemIndexByID(shelf_id); |
234 DCHECK_GE(index, 0); | 237 DCHECK_GE(index, 0); |
235 ShelfItem item = *model_.ItemByID(shelf_id); | 238 ShelfItem item = *model_.ItemByID(shelf_id); |
236 item.image = GetShelfIconFromBitmap(image); | 239 item.image = GetShelfIconFromBitmap(image); |
237 model_.Set(index, item); | 240 model_.Set(index, item); |
238 } | 241 } |
239 | 242 |
240 } // namespace ash | 243 } // namespace ash |
OLD | NEW |