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

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

Issue 2290603002: Enhance chrome.app.window API for shelf integration with pinning support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
(...skipping 24 matching lines...) Expand all
35 using WindowList = std::list<ui::BaseWindow*>; 35 using WindowList = std::list<ui::BaseWindow*>;
36 36
37 ~AppWindowLauncherItemController() override; 37 ~AppWindowLauncherItemController() override;
38 38
39 void AddWindow(ui::BaseWindow* window); 39 void AddWindow(ui::BaseWindow* window);
40 void RemoveWindow(ui::BaseWindow* window); 40 void RemoveWindow(ui::BaseWindow* window);
41 41
42 void SetActiveWindow(aura::Window* window); 42 void SetActiveWindow(aura::Window* window);
43 ui::BaseWindow* GetAppWindow(aura::Window* window); 43 ui::BaseWindow* GetAppWindow(aura::Window* window);
44 44
45 const std::string& app_shelf_id() const { return app_shelf_id_; } 45 const std::string& app_id() const { return app_id_; }
46 const std::string& launch_id() const { return launch_id_; }
46 47
47 // LauncherItemController overrides: 48 // LauncherItemController overrides:
48 bool IsOpen() const override; 49 bool IsOpen() const override;
49 bool IsVisible() const override; 50 bool IsVisible() const override;
50 void Launch(ash::LaunchSource source, int event_flags) override; 51 void Launch(ash::LaunchSource source, int event_flags) override;
51 ash::ShelfItemDelegate::PerformedAction Activate( 52 ash::ShelfItemDelegate::PerformedAction Activate(
52 ash::LaunchSource source) override; 53 ash::LaunchSource source) override;
53 ChromeLauncherAppMenuItems GetApplicationList(int event_flags) override; 54 ChromeLauncherAppMenuItems GetApplicationList(int event_flags) override;
54 ash::ShelfItemDelegate::PerformedAction ItemSelected( 55 ash::ShelfItemDelegate::PerformedAction ItemSelected(
55 const ui::Event& event) override; 56 const ui::Event& event) override;
(...skipping 11 matching lines...) Expand all
67 // Get the number of running applications/incarnations of this. 68 // Get the number of running applications/incarnations of this.
68 size_t window_count() const { return windows_.size(); } 69 size_t window_count() const { return windows_.size(); }
69 70
70 // Activates the window at position |index|. 71 // Activates the window at position |index|.
71 void ActivateIndexedApp(size_t index); 72 void ActivateIndexedApp(size_t index);
72 73
73 const WindowList& windows() const { return windows_; } 74 const WindowList& windows() const { return windows_; }
74 75
75 protected: 76 protected:
76 AppWindowLauncherItemController(Type type, 77 AppWindowLauncherItemController(Type type,
77 const std::string& app_shelf_id, 78 const std::string& launch_id,
78 const std::string& app_id, 79 const std::string& app_id,
stevenjb 2016/08/30 16:12:51 Yikes. Please change this to app_id, launch_id so
Andra Paraschiv 2016/08/31 10:57:18 Done.
79 ChromeLauncherController* controller); 80 ChromeLauncherController* controller);
80 81
81 // Called when app window is removed from controller. 82 // Called when app window is removed from controller.
82 virtual void OnWindowRemoved(ui::BaseWindow* window) {} 83 virtual void OnWindowRemoved(ui::BaseWindow* window) {}
83 84
84 // Returns the action performed. Should be one of kNoAction, 85 // Returns the action performed. Should be one of kNoAction,
85 // kExistingWindowActivated, or kExistingWindowMinimized. 86 // kExistingWindowActivated, or kExistingWindowMinimized.
86 ash::ShelfItemDelegate::PerformedAction ShowAndActivateOrMinimize( 87 ash::ShelfItemDelegate::PerformedAction ShowAndActivateOrMinimize(
87 ui::BaseWindow* window); 88 ui::BaseWindow* window);
88 89
89 // Activate the given |window_to_show|, or - if already selected - advance to 90 // Activate the given |window_to_show|, or - if already selected - advance to
90 // the next window of similar type. 91 // the next window of similar type.
91 // Returns the action performed. Should be one of kNoAction, 92 // Returns the action performed. Should be one of kNoAction,
92 // kExistingWindowActivated, or kExistingWindowMinimized. 93 // kExistingWindowActivated, or kExistingWindowMinimized.
93 ash::ShelfItemDelegate::PerformedAction ActivateOrAdvanceToNextAppWindow( 94 ash::ShelfItemDelegate::PerformedAction ActivateOrAdvanceToNextAppWindow(
94 ui::BaseWindow* window_to_show); 95 ui::BaseWindow* window_to_show);
95 96
96 private: 97 private:
97 WindowList::iterator GetFromNativeWindow(aura::Window* window); 98 WindowList::iterator GetFromNativeWindow(aura::Window* window);
98 99
99 // List of associated app windows 100 // List of associated app windows
100 WindowList windows_; 101 WindowList windows_;
101 102
102 // Pointer to the most recently active app window 103 // Pointer to the most recently active app window
103 ui::BaseWindow* last_active_window_ = nullptr; 104 ui::BaseWindow* last_active_window_ = nullptr;
104 105
106 // The application id associated with this set of windows.
107 const std::string app_id_;
108
105 // The launcher id associated with this set of windows. There is one 109 // The launcher id associated with this set of windows. There is one
106 // AppLauncherItemController for each |app_shelf_id_|. 110 // AppLauncherItemController for each app_shelf_id whose value is
107 const std::string app_shelf_id_; 111 // |launch_id_| appended to |app_id_|.
112 const std::string launch_id_;
108 113
109 // Scoped list of observed windows (for removal on destruction) 114 // Scoped list of observed windows (for removal on destruction)
110 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; 115 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_;
111 116
112 DISALLOW_COPY_AND_ASSIGN(AppWindowLauncherItemController); 117 DISALLOW_COPY_AND_ASSIGN(AppWindowLauncherItemController);
113 }; 118 };
114 119
115 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ 120 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698