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

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

Issue 166573005: Rename apps::ShellWindow to apps::AppWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix more shell and Shell refs 2 Created 6 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 | 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_SHELL_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_SHELL_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_SHELL_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_SHELL_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/scoped_observer.h" 12 #include "base/scoped_observer.h"
13 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" 13 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
14 #include "ui/aura/window_observer.h" 14 #include "ui/aura/window_observer.h"
15 15
16 namespace apps { 16 namespace apps {
17 class ShellWindow; 17 class AppWindow;
18 } 18 }
19 19
20 namespace aura { 20 namespace aura {
21 class Window; 21 class Window;
22 } 22 }
23 23
24 namespace gfx { 24 namespace gfx {
25 class Image; 25 class Image;
26 } 26 }
27 27
28 class ChromeLauncherController; 28 class ChromeLauncherController;
29 29
30 // This is a ShellWindowItemLauncherController for shell windows. There is one 30 // This is a ShellWindowItemLauncherController for app windows. There is one
31 // instance per app, per launcher id. 31 // instance per app, per launcher id.
32 // For apps with multiple windows, each item controller keeps track of all 32 // For apps with multiple windows, each item controller keeps track of all
33 // windows associated with the app and their activation order. 33 // windows associated with the app and their activation order.
34 // Instances are owned by ash::ShelfItemDelegateManager. 34 // Instances are owned by ash::ShelfItemDelegateManager.
35 // 35 //
36 // Tests are in chrome_launcher_controller_browsertest.cc 36 // Tests are in chrome_launcher_controller_browsertest.cc
37 37 //
38 // TODO(jamescook): Rename to AppWindowLauncherItemController.
scheib 2014/02/15 00:26:36 issue
38 class ShellWindowLauncherItemController : public LauncherItemController, 39 class ShellWindowLauncherItemController : public LauncherItemController,
39 public aura::WindowObserver { 40 public aura::WindowObserver {
40 public: 41 public:
41 ShellWindowLauncherItemController(Type type, 42 ShellWindowLauncherItemController(Type type,
42 const std::string& app_shelf_id, 43 const std::string& app_shelf_id,
43 const std::string& app_id, 44 const std::string& app_id,
44 ChromeLauncherController* controller); 45 ChromeLauncherController* controller);
45 46
46 virtual ~ShellWindowLauncherItemController(); 47 virtual ~ShellWindowLauncherItemController();
47 48
48 void AddShellWindow(apps::ShellWindow* shell_window, 49 void AddAppWindow(apps::AppWindow* app_window, ash::ShelfItemStatus status);
49 ash::ShelfItemStatus status);
50 50
51 void RemoveShellWindowForWindow(aura::Window* window); 51 void RemoveShellWindowForWindow(aura::Window* window);
52 52
53 void SetActiveWindow(aura::Window* window); 53 void SetActiveWindow(aura::Window* window);
54 54
55 const std::string& app_shelf_id() const { return app_shelf_id_; } 55 const std::string& app_shelf_id() const { return app_shelf_id_; }
56 56
57 // LauncherItemController overrides: 57 // LauncherItemController overrides:
58 virtual bool IsOpen() const OVERRIDE; 58 virtual bool IsOpen() const OVERRIDE;
59 virtual bool IsVisible() const OVERRIDE; 59 virtual bool IsVisible() const OVERRIDE;
60 virtual void Launch(ash::LaunchSource source, int event_flags) OVERRIDE; 60 virtual void Launch(ash::LaunchSource source, int event_flags) OVERRIDE;
61 virtual bool Activate(ash::LaunchSource source) OVERRIDE; 61 virtual bool Activate(ash::LaunchSource source) OVERRIDE;
62 virtual ChromeLauncherAppMenuItems GetApplicationList( 62 virtual ChromeLauncherAppMenuItems GetApplicationList(
63 int event_flags) OVERRIDE; 63 int event_flags) OVERRIDE;
64 virtual bool ItemSelected(const ui::Event& eent) OVERRIDE; 64 virtual bool ItemSelected(const ui::Event& eent) OVERRIDE;
65 virtual base::string16 GetTitle() OVERRIDE; 65 virtual base::string16 GetTitle() OVERRIDE;
66 virtual ui::MenuModel* CreateContextMenu(aura::Window* root_window) OVERRIDE; 66 virtual ui::MenuModel* CreateContextMenu(aura::Window* root_window) OVERRIDE;
67 virtual ash::ShelfMenuModel* CreateApplicationMenu(int event_flags) OVERRIDE; 67 virtual ash::ShelfMenuModel* CreateApplicationMenu(int event_flags) OVERRIDE;
68 virtual bool IsDraggable() OVERRIDE; 68 virtual bool IsDraggable() OVERRIDE;
69 virtual bool ShouldShowTooltip() OVERRIDE; 69 virtual bool ShouldShowTooltip() OVERRIDE;
70 virtual void Close() OVERRIDE; 70 virtual void Close() OVERRIDE;
71 71
72 // aura::WindowObserver overrides: 72 // aura::WindowObserver overrides:
73 virtual void OnWindowPropertyChanged(aura::Window* window, 73 virtual void OnWindowPropertyChanged(aura::Window* window,
74 const void* key, 74 const void* key,
75 intptr_t old) OVERRIDE; 75 intptr_t old) OVERRIDE;
76 76
77 // Get the number of running applications/incarnations of this. 77 // Get the number of running applications/incarnations of this.
78 size_t shell_window_count() const { return shell_windows_.size(); } 78 size_t app_window_count() const { return app_windows_.size(); }
79 79
80 // Activates the window at position |index|. 80 // Activates the window at position |index|.
81 void ActivateIndexedApp(size_t index); 81 void ActivateIndexedApp(size_t index);
82 82
83 private: 83 private:
84 typedef std::list<apps::ShellWindow*> ShellWindowList; 84 typedef std::list<apps::AppWindow*> AppWindowList;
85 85
86 void ShowAndActivateOrMinimize(apps::ShellWindow* shell_window); 86 void ShowAndActivateOrMinimize(apps::AppWindow* app_window);
87 87
88 // Activate the given |window_to_show|, or - if already selected - advance to 88 // Activate the given |window_to_show|, or - if already selected - advance to
89 // the next window of similar type. 89 // the next window of similar type.
90 void ActivateOrAdvanceToNextShellWindow(apps::ShellWindow* window_to_show); 90 void ActivateOrAdvanceToNextShellWindow(apps::AppWindow* window_to_show);
91 91
92 // List of associated shell windows 92 // List of associated app windows
93 ShellWindowList shell_windows_; 93 AppWindowList app_windows_;
94 94
95 // Pointer to the most recently active shell window 95 // Pointer to the most recently active app window
96 apps::ShellWindow* last_active_shell_window_; 96 apps::AppWindow* last_active_app_window_;
97 97
98 // The launcher id associated with this set of windows. There is one 98 // The launcher id associated with this set of windows. There is one
99 // AppLauncherItemController for each |app_shelf_id_|. 99 // AppLauncherItemController for each |app_shelf_id_|.
100 const std::string app_shelf_id_; 100 const std::string app_shelf_id_;
101 101
102 // Scoped list of observed windows (for removal on destruction) 102 // Scoped list of observed windows (for removal on destruction)
103 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; 103 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_;
104 104
105 DISALLOW_COPY_AND_ASSIGN(ShellWindowLauncherItemController); 105 DISALLOW_COPY_AND_ASSIGN(ShellWindowLauncherItemController);
106 }; 106 };
107 107
108 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_SHELL_WINDOW_LAUNCHER_ITEM_CONTROLLER_ H_ 108 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_SHELL_WINDOW_LAUNCHER_ITEM_CONTROLLER_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698