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

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

Issue 2894443002: arc: Set custom icon in shelf for ARC apps. (Closed)
Patch Set: comments addressed Created 3 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 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 void OnWindowPropertyChanged(aura::Window* window, 53 void OnWindowPropertyChanged(aura::Window* window,
54 const void* key, 54 const void* key,
55 intptr_t old) override; 55 intptr_t old) override;
56 56
57 // Get the number of running applications/incarnations of this. 57 // Get the number of running applications/incarnations of this.
58 size_t window_count() const { return windows_.size(); } 58 size_t window_count() const { return windows_.size(); }
59 59
60 // Activates the window at position |index|. 60 // Activates the window at position |index|.
61 void ActivateIndexedApp(size_t index); 61 void ActivateIndexedApp(size_t index);
62 62
63 // Called when launcher item may need to be updated, for example label or
msw 2017/05/18 22:03:39 optional nit: s/for example/eg./ for one-liner.
khmel 2017/05/18 22:40:02 Done.
64 // icon.
65 virtual void UpdateLauncherItem() {}
msw 2017/05/18 22:03:39 This should be replaced by OnWindowPropertyChanged
khmel 2017/05/18 22:40:02 I added TODO. This sounds as good point. I can do
66
63 const WindowList& windows() const { return windows_; } 67 const WindowList& windows() const { return windows_; }
64 68
65 protected: 69 protected:
66 explicit AppWindowLauncherItemController(const ash::ShelfID& shelf_id); 70 explicit AppWindowLauncherItemController(const ash::ShelfID& shelf_id);
67 71
68 // Called when app window is removed from controller.
69 virtual void OnWindowRemoved(ui::BaseWindow* window) {}
70
71 // Returns the action performed. Should be one of SHELF_ACTION_NONE, 72 // Returns the action performed. Should be one of SHELF_ACTION_NONE,
72 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_WINDOW_MINIMIZED. 73 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_WINDOW_MINIMIZED.
73 ash::ShelfAction ShowAndActivateOrMinimize(ui::BaseWindow* window); 74 ash::ShelfAction ShowAndActivateOrMinimize(ui::BaseWindow* window);
74 75
75 // Activate the given |window_to_show|, or - if already selected - advance to 76 // Activate the given |window_to_show|, or - if already selected - advance to
76 // the next window of similar type. 77 // the next window of similar type.
77 // Returns the action performed. Should be one of SHELF_ACTION_NONE, 78 // Returns the action performed. Should be one of SHELF_ACTION_NONE,
78 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_WINDOW_MINIMIZED. 79 // SHELF_ACTION_WINDOW_ACTIVATED, or SHELF_ACTION_WINDOW_MINIMIZED.
79 ash::ShelfAction ActivateOrAdvanceToNextAppWindow( 80 ash::ShelfAction ActivateOrAdvanceToNextAppWindow(
80 ui::BaseWindow* window_to_show); 81 ui::BaseWindow* window_to_show);
81 82
83 // Returns last active window in the controller or first window.
84 ui::BaseWindow* GetLastActiveWindow();
85
82 private: 86 private:
83 WindowList::iterator GetFromNativeWindow(aura::Window* window); 87 WindowList::iterator GetFromNativeWindow(aura::Window* window);
84 88
85 // List of associated app windows 89 // List of associated app windows
86 WindowList windows_; 90 WindowList windows_;
87 91
88 // Pointer to the most recently active app window 92 // Pointer to the most recently active app window
93 // TODO(khmel): Get rid of |last_active_window_| and provide more reliable
94 // way to determine active window.
89 ui::BaseWindow* last_active_window_ = nullptr; 95 ui::BaseWindow* last_active_window_ = nullptr;
90 96
91 // Scoped list of observed windows (for removal on destruction) 97 // Scoped list of observed windows (for removal on destruction)
92 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_; 98 ScopedObserver<aura::Window, aura::WindowObserver> observed_windows_;
93 99
94 DISALLOW_COPY_AND_ASSIGN(AppWindowLauncherItemController); 100 DISALLOW_COPY_AND_ASSIGN(AppWindowLauncherItemController);
95 }; 101 };
96 102
97 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_ 103 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698