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

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

Issue 1921403002: Pin apps from prefs on the mash shelf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. Created 4 years, 7 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/shelf/shelf_item_delegate.h" 10 #include "ash/shelf/shelf_item_delegate.h"
11 #include "ash/shelf/shelf_item_types.h" 11 #include "ash/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 "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" 16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h"
17 #include "ui/events/event.h" 17 #include "ui/events/event.h"
18 18
19 class ChromeLauncherController; 19 class ChromeLauncherController;
20 class ChromeLauncherAppMenuItem; 20 class ChromeLauncherAppMenuItem;
21 class Profile;
21 22
22 typedef ScopedVector<ChromeLauncherAppMenuItem> ChromeLauncherAppMenuItems; 23 typedef ScopedVector<ChromeLauncherAppMenuItem> ChromeLauncherAppMenuItems;
23 24
24 namespace aura { 25 namespace aura {
25 class Window; 26 class Window;
26 } 27 }
27 28
28 namespace content { 29 namespace content {
29 class WebContents; 30 class WebContents;
30 } 31 }
(...skipping 10 matching lines...) Expand all
41 }; 42 };
42 43
43 LauncherItemController(Type type, 44 LauncherItemController(Type type,
44 const std::string& app_id, 45 const std::string& app_id,
45 ChromeLauncherController* launcher_controller); 46 ChromeLauncherController* launcher_controller);
46 ~LauncherItemController() override; 47 ~LauncherItemController() override;
47 48
48 Type type() const { return type_; } 49 Type type() const { return type_; }
49 ash::ShelfID shelf_id() const { return shelf_id_; } 50 ash::ShelfID shelf_id() const { return shelf_id_; }
50 void set_shelf_id(ash::ShelfID id) { shelf_id_ = id; } 51 void set_shelf_id(ash::ShelfID id) { shelf_id_ = id; }
51 virtual const std::string& app_id() const; 52 const std::string& app_id() const { return app_id_; }
52 ChromeLauncherController* launcher_controller() const { 53 ChromeLauncherController* launcher_controller() const {
53 return launcher_controller_; 54 return launcher_controller_;
54 } 55 }
55 56
56 // Lock this item to the launcher without being pinned (windowed v1 apps). 57 // Lock this item to the launcher without being pinned (windowed v1 apps).
57 void lock() { locked_++; } 58 void lock() { locked_++; }
58 void unlock() { 59 void unlock() {
59 DCHECK(locked_); 60 DCHECK(locked_);
60 locked_--; 61 locked_--;
61 } 62 }
(...skipping 17 matching lines...) Expand all
79 // item, or launches the item if it is not currently open. 80 // item, or launches the item if it is not currently open.
80 // Returns the action performed by activating the item. 81 // Returns the action performed by activating the item.
81 virtual PerformedAction Activate(ash::LaunchSource source) = 0; 82 virtual PerformedAction Activate(ash::LaunchSource source) = 0;
82 83
83 // Called to retrieve the list of running applications. 84 // Called to retrieve the list of running applications.
84 virtual ChromeLauncherAppMenuItems GetApplicationList(int event_flags) = 0; 85 virtual ChromeLauncherAppMenuItems GetApplicationList(int event_flags) = 0;
85 86
86 // Helper function to get the ash::ShelfItemType for the item type. 87 // Helper function to get the ash::ShelfItemType for the item type.
87 ash::ShelfItemType GetShelfItemType() const; 88 ash::ShelfItemType GetShelfItemType() const;
88 89
89 protected: 90 // Helper function to return the title associated with |app_id|.
90 // Helper function to return the title associated with |app_id_|.
91 // Returns an empty title if no matching extension can be found. 91 // Returns an empty title if no matching extension can be found.
92 base::string16 GetAppTitle() const; 92 static base::string16 GetAppTitle(Profile* profile,
93 const std::string& app_id);
93 94
94 private: 95 private:
95 const Type type_; 96 const Type type_;
96 // App id will be empty if there is no app associated with the window. 97 // App id will be empty if there is no app associated with the window.
97 const std::string app_id_; 98 const std::string app_id_;
98 ash::ShelfID shelf_id_; 99 ash::ShelfID shelf_id_;
99 ChromeLauncherController* launcher_controller_; 100 ChromeLauncherController* launcher_controller_;
100 101
101 // The lock counter which tells the launcher if the item can be removed from 102 // The lock counter which tells the launcher if the item can be removed from
102 // the launcher (0) or not (>0). It is being used for windowed V1 103 // the launcher (0) or not (>0). It is being used for windowed V1
103 // applications. 104 // applications.
104 int locked_; 105 int locked_;
105 106
106 // Set to true if the launcher item image has been set by the controller. 107 // Set to true if the launcher item image has been set by the controller.
107 bool image_set_by_controller_; 108 bool image_set_by_controller_;
108 109
109 DISALLOW_COPY_AND_ASSIGN(LauncherItemController); 110 DISALLOW_COPY_AND_ASSIGN(LauncherItemController);
110 }; 111 };
111 112
112 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ 113 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698