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

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

Issue 2696073002: Merge ShelfItemDelegate::ItemSelected & LauncherItemDelegate::Activate. (Closed)
Patch Set: nit 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
« no previous file with comments | « chrome/browser/ui/ash/launcher/launcher_controller_helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
15 #include "ui/events/event.h" 14 #include "ui/events/event.h"
16 15
17 class AppWindowLauncherItemController; 16 class AppWindowLauncherItemController;
18 class ChromeLauncherController; 17 class ChromeLauncherController;
19 18
20 // LauncherItemController is used by ChromeLauncherController to track one 19 // LauncherItemController is used by ChromeLauncherController to track one
21 // or more windows associated with a shelf item. 20 // or more windows associated with a shelf item.
22 // TODO (khmel): Consider using ash::AppLauncherId instead of pair 21 // TODO (khmel): Consider using ash::AppLauncherId instead of pair
23 // |app_id| and |launch_id|. 22 // |app_id| and |launch_id|.
24 class LauncherItemController : public ash::ShelfItemDelegate { 23 class LauncherItemController : public ash::ShelfItemDelegate {
(...skipping 17 matching lines...) Expand all
42 DCHECK(locked_); 41 DCHECK(locked_);
43 locked_--; 42 locked_--;
44 } 43 }
45 bool locked() const { return locked_ > 0; } 44 bool locked() const { return locked_ > 0; }
46 45
47 bool image_set_by_controller() const { return image_set_by_controller_; } 46 bool image_set_by_controller() const { return image_set_by_controller_; }
48 void set_image_set_by_controller(bool image_set_by_controller) { 47 void set_image_set_by_controller(bool image_set_by_controller) {
49 image_set_by_controller_ = image_set_by_controller; 48 image_set_by_controller_ = image_set_by_controller;
50 } 49 }
51 50
52 // Shows and activates the most-recently-active window associated with the
53 // item, or launches the item if it is not currently open.
54 // Returns the action performed by activating the item.
55 virtual PerformedAction Activate(ash::LaunchSource source) = 0;
56
57 // Returns nullptr if class is not AppWindowLauncherItemController. 51 // Returns nullptr if class is not AppWindowLauncherItemController.
58 virtual AppWindowLauncherItemController* AsAppWindowLauncherItemController(); 52 virtual AppWindowLauncherItemController* AsAppWindowLauncherItemController();
59 53
60 private: 54 private:
61 // The application id; empty if there is no app associated with the item. 55 // The application id; empty if there is no app associated with the item.
62 const std::string app_id_; 56 const std::string app_id_;
63 57
64 // An id that can be passed to an app when launched in order to support 58 // An id that can be passed to an app when launched in order to support
65 // multiple shelf items per app. This id is used together with the app_id to 59 // multiple shelf items per app. This id is used together with the app_id to
66 // uniquely identify each shelf item that has the same app_id. 60 // uniquely identify each shelf item that has the same app_id.
67 const std::string launch_id_; 61 const std::string launch_id_;
68 62
69 // A unique id assigned by the shelf model for the shelf item. 63 // A unique id assigned by the shelf model for the shelf item.
70 ash::ShelfID shelf_id_; 64 ash::ShelfID shelf_id_;
71 65
72 ChromeLauncherController* launcher_controller_; 66 ChromeLauncherController* launcher_controller_;
73 67
74 // The lock counter which tells the launcher if the item can be removed from 68 // The lock counter which tells the launcher if the item can be removed from
75 // the launcher (0) or not (>0). It is being used for windowed V1 69 // the launcher (0) or not (>0). It is being used for windowed V1
76 // applications. 70 // applications.
77 int locked_; 71 int locked_;
78 72
79 // Set to true if the launcher item image has been set by the controller. 73 // Set to true if the launcher item image has been set by the controller.
80 bool image_set_by_controller_; 74 bool image_set_by_controller_;
81 75
82 DISALLOW_COPY_AND_ASSIGN(LauncherItemController); 76 DISALLOW_COPY_AND_ASSIGN(LauncherItemController);
83 }; 77 };
84 78
85 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ 79 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/launcher_controller_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698