Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: chrome/browser/ui/ash/launcher/launcher_item_controller.h

Issue 2671923002: mash: Cleanup ash shelf application menu code. (Closed)
Patch Set: Add comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "ash/common/shelf/shelf_item_delegate.h" 10 #include "ash/common/shelf/shelf_item_delegate.h"
11 #include "ash/common/shelf/shelf_item_types.h" 11 #include "ash/common/shelf/shelf_item_types.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h"
15 #include "ui/events/event.h" 15 #include "ui/events/event.h"
16 16
17 class AppWindowLauncherItemController; 17 class AppWindowLauncherItemController;
18 class ChromeLauncherController; 18 class ChromeLauncherController;
19 class ChromeLauncherAppMenuItem;
20
21 using ChromeLauncherAppMenuItems =
22 std::vector<std::unique_ptr<ChromeLauncherAppMenuItem>>;
23 19
24 // LauncherItemController is used by ChromeLauncherController to track one 20 // LauncherItemController is used by ChromeLauncherController to track one
25 // or more windows associated with a shelf item. 21 // or more windows associated with a shelf item.
26 class LauncherItemController : public ash::ShelfItemDelegate { 22 class LauncherItemController : public ash::ShelfItemDelegate {
27 public: 23 public:
28 LauncherItemController(const std::string& app_id, 24 LauncherItemController(const std::string& app_id,
29 const std::string& launch_id, 25 const std::string& launch_id,
30 ChromeLauncherController* launcher_controller); 26 ChromeLauncherController* launcher_controller);
31 ~LauncherItemController() override; 27 ~LauncherItemController() override;
32 28
(...skipping 19 matching lines...) Expand all
52 } 48 }
53 49
54 // Launches a new instance of the app associated with this item. 50 // Launches a new instance of the app associated with this item.
55 virtual void Launch(ash::LaunchSource source, int event_flags) = 0; 51 virtual void Launch(ash::LaunchSource source, int event_flags) = 0;
56 52
57 // Shows and activates the most-recently-active window associated with the 53 // Shows and activates the most-recently-active window associated with the
58 // item, or launches the item if it is not currently open. 54 // item, or launches the item if it is not currently open.
59 // Returns the action performed by activating the item. 55 // Returns the action performed by activating the item.
60 virtual PerformedAction Activate(ash::LaunchSource source) = 0; 56 virtual PerformedAction Activate(ash::LaunchSource source) = 0;
61 57
62 // Called to retrieve the list of running applications.
63 virtual ChromeLauncherAppMenuItems GetApplicationList(int event_flags) = 0;
64
65 // Returns nullptr if class is not AppWindowLauncherItemController. 58 // Returns nullptr if class is not AppWindowLauncherItemController.
66 virtual AppWindowLauncherItemController* AsAppWindowLauncherItemController(); 59 virtual AppWindowLauncherItemController* AsAppWindowLauncherItemController();
67 60
68 private: 61 private:
69 // The application id; empty if there is no app associated with the item. 62 // The application id; empty if there is no app associated with the item.
70 const std::string app_id_; 63 const std::string app_id_;
71 64
72 // An id that can be passed to an app when launched in order to support 65 // An id that can be passed to an app when launched in order to support
73 // multiple shelf items per app. This id is used together with the app_id to 66 // multiple shelf items per app. This id is used together with the app_id to
74 // uniquely identify each shelf item that has the same app_id. 67 // uniquely identify each shelf item that has the same app_id.
75 const std::string launch_id_; 68 const std::string launch_id_;
76 69
77 // A unique id assigned by the shelf model for the shelf item. 70 // A unique id assigned by the shelf model for the shelf item.
78 ash::ShelfID shelf_id_; 71 ash::ShelfID shelf_id_;
79 72
80 ChromeLauncherController* launcher_controller_; 73 ChromeLauncherController* launcher_controller_;
81 74
82 // The lock counter which tells the launcher if the item can be removed from 75 // The lock counter which tells the launcher if the item can be removed from
83 // the launcher (0) or not (>0). It is being used for windowed V1 76 // the launcher (0) or not (>0). It is being used for windowed V1
84 // applications. 77 // applications.
85 int locked_; 78 int locked_;
86 79
87 // Set to true if the launcher item image has been set by the controller. 80 // Set to true if the launcher item image has been set by the controller.
88 bool image_set_by_controller_; 81 bool image_set_by_controller_;
89 82
90 DISALLOW_COPY_AND_ASSIGN(LauncherItemController); 83 DISALLOW_COPY_AND_ASSIGN(LauncherItemController);
91 }; 84 };
92 85
93 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ 86 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698