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

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

Issue 25716004: Revert 226547 "Refactor LauncherItemController and LauncherItemD..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
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 "ash/launcher/launcher_item_delegate.h"
9 #include "ash/launcher/launcher_types.h" 8 #include "ash/launcher/launcher_types.h"
10 #include "base/basictypes.h" 9 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
13 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" 13 #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 ChromeLauncherController; 16 class ChromeLauncherController;
18 class ChromeLauncherAppMenuItem; 17 class ChromeLauncherAppMenuItem;
19 18
20 typedef ScopedVector<ChromeLauncherAppMenuItem> ChromeLauncherAppMenuItems; 19 typedef ScopedVector<ChromeLauncherAppMenuItem> ChromeLauncherAppMenuItems;
21 20
22 namespace aura { 21 namespace aura {
23 class Window; 22 class Window;
24 } 23 }
25 24
26 namespace content { 25 namespace content {
27 class WebContents; 26 class WebContents;
28 } 27 }
29 28
30 // LauncherItemController is used by ChromeLauncherController to track one 29 // LauncherItemController is used by ChromeLauncherController to track one
31 // or more windows associated with a launcher item. 30 // or more windows associated with a launcher item.
32 class LauncherItemController : public ash::LauncherItemDelegate { 31 class LauncherItemController {
33 public: 32 public:
34 enum Type { 33 enum Type {
35 TYPE_APP, 34 TYPE_APP,
36 TYPE_APP_PANEL, 35 TYPE_APP_PANEL,
37 TYPE_SHORTCUT, 36 TYPE_SHORTCUT,
38 TYPE_WINDOWED_APP 37 TYPE_WINDOWED_APP
39 }; 38 };
40 39
41 LauncherItemController(Type type, 40 LauncherItemController(Type type,
42 const std::string& app_id, 41 const std::string& app_id,
(...skipping 14 matching lines...) Expand all
57 DCHECK(locked_); 56 DCHECK(locked_);
58 locked_--; 57 locked_--;
59 } 58 }
60 bool locked() { return locked_ > 0; } 59 bool locked() { return locked_ > 0; }
61 60
62 bool image_set_by_controller() const { return image_set_by_controller_; } 61 bool image_set_by_controller() const { return image_set_by_controller_; }
63 void set_image_set_by_controller(bool image_set_by_controller) { 62 void set_image_set_by_controller(bool image_set_by_controller) {
64 image_set_by_controller_ = image_set_by_controller; 63 image_set_by_controller_ = image_set_by_controller;
65 } 64 }
66 65
66 // Returns the title for this item.
67 virtual string16 GetTitle() = 0;
68
67 // Returns true if this item controls |window|. 69 // Returns true if this item controls |window|.
68 // When this |window| has multiple applications/tabs, it only returns true 70 // When this |window| has multiple applications/tabs, it only returns true
69 // it controls the currently visible app/tab. 71 // it controls the currently visible app/tab.
70 virtual bool IsCurrentlyShownInWindow(aura::Window* window) const = 0; 72 virtual bool IsCurrentlyShownInWindow(aura::Window* window) const = 0;
71 73
72 // Returns true if this item is open. 74 // Returns true if this item is open.
73 virtual bool IsOpen() const = 0; 75 virtual bool IsOpen() const = 0;
74 76
75 // Returns true if this item is visible (e.g. not minimized). 77 // Returns true if this item is visible (e.g. not minimized).
76 virtual bool IsVisible() const = 0; 78 virtual bool IsVisible() const = 0;
77 79
78 // Launches a new instance of the app associated with this item. 80 // Launches a new instance of the app associated with this item.
79 virtual void Launch(ash::LaunchSource source, int event_flags) = 0; 81 virtual void Launch(ash::LaunchSource source, int event_flags) = 0;
80 82
81 // Shows and activates the most-recently-active window associated with the 83 // Shows and activates the most-recently-active window associated with the
82 // item, or launches the item if it is not currently open. 84 // item, or launches the item if it is not currently open.
83 virtual void Activate(ash::LaunchSource source) = 0; 85 virtual void Activate(ash::LaunchSource source) = 0;
84 86
85 // Closes all windows associated with this item. 87 // Closes all windows associated with this item.
86 virtual void Close() = 0; 88 virtual void Close() = 0;
87 89
90 // Called when the item is clicked. The behavior varies by the number of
91 // windows associated with the item:
92 // * One window: toggles the minimize state.
93 // * Multiple windows: cycles the active window.
94 // The |event| is dispatched by a view, therefore the type of the
95 // event's target is |views::View|.
96 virtual void Clicked(const ui::Event& event) = 0;
97
98 // Called when the controlled item is removed from the launcher.
99 virtual void OnRemoved() = 0;
100
88 // Called to retrieve the list of running applications. 101 // Called to retrieve the list of running applications.
89 virtual ChromeLauncherAppMenuItems GetApplicationList(int event_flags) = 0; 102 virtual ChromeLauncherAppMenuItems GetApplicationList(int event_flags) = 0;
90 103
91 // Helper function to get the ash::LauncherItemType for the item type. 104 // Helper function to get the ash::LauncherItemType for the item type.
92 ash::LauncherItemType GetLauncherItemType() const; 105 ash::LauncherItemType GetLauncherItemType() const;
93 106
94 protected: 107 protected:
95 // Helper function to return the title associated with |app_id_|. 108 // Helper function to return the title associated with |app_id_|.
96 // Returns an empty title if no matching extension can be found. 109 // Returns an empty title if no matching extension can be found.
97 string16 GetAppTitle() const; 110 string16 GetAppTitle() const;
(...skipping 10 matching lines...) Expand all
108 // applications. 121 // applications.
109 int locked_; 122 int locked_;
110 123
111 // Set to true if the launcher item image has been set by the controller. 124 // Set to true if the launcher item image has been set by the controller.
112 bool image_set_by_controller_; 125 bool image_set_by_controller_;
113 126
114 DISALLOW_COPY_AND_ASSIGN(LauncherItemController); 127 DISALLOW_COPY_AND_ASSIGN(LauncherItemController);
115 }; 128 };
116 129
117 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_ 130 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_ITEM_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698