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

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

Issue 2894443002: arc: Set custom icon in shelf for ARC apps. (Closed)
Patch Set: rebase 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
11 11
12 #include "ash/shell_observer.h" 12 #include "ash/shell_observer.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 14 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
15 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" 15 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
16 #include "chrome/browser/ui/ash/launcher/arc_app_shelf_id.h" 16 #include "chrome/browser/ui/ash/launcher/arc_app_shelf_id.h"
17 #include "mojo/public/cpp/bindings/binding.h" 17 #include "mojo/public/cpp/bindings/binding.h"
18 #include "ui/aura/env_observer.h" 18 #include "ui/aura/env_observer.h"
19 #include "ui/aura/window_observer.h" 19 #include "ui/aura/window_observer.h"
20 20
21 namespace aura { 21 namespace aura {
22 class Window; 22 class Window;
23 } 23 }
24 24
25 class ArcAppWindow;
25 class ArcAppWindowLauncherItemController; 26 class ArcAppWindowLauncherItemController;
26 class ChromeLauncherController; 27 class ChromeLauncherController;
27 28
28 class Profile; 29 class Profile;
29 30
30 class ArcAppWindowLauncherController : public AppWindowLauncherController, 31 class ArcAppWindowLauncherController : public AppWindowLauncherController,
31 public aura::EnvObserver, 32 public aura::EnvObserver,
32 public aura::WindowObserver, 33 public aura::WindowObserver,
33 public ash::ShellObserver, 34 public ash::ShellObserver,
34 public ArcAppListPrefs::Observer { 35 public ArcAppListPrefs::Observer {
(...skipping 25 matching lines...) Expand all
60 void OnMaximizeModeStarted() override; 61 void OnMaximizeModeStarted() override;
61 void OnMaximizeModeEnded() override; 62 void OnMaximizeModeEnded() override;
62 63
63 // ArcAppListPrefs::Observer: 64 // ArcAppListPrefs::Observer:
64 void OnAppReadyChanged(const std::string& app_id, bool ready) override; 65 void OnAppReadyChanged(const std::string& app_id, bool ready) override;
65 void OnAppRemoved(const std::string& app_id) override; 66 void OnAppRemoved(const std::string& app_id) override;
66 void OnTaskCreated(int task_id, 67 void OnTaskCreated(int task_id,
67 const std::string& package_name, 68 const std::string& package_name,
68 const std::string& activity, 69 const std::string& activity,
69 const std::string& intent) override; 70 const std::string& intent) override;
71 void OnTaskDescriptionUpdated(
72 int32_t task_id,
73 const std::string& label,
74 const std::vector<uint8_t>& icon_png_data) override;
70 void OnTaskDestroyed(int task_id) override; 75 void OnTaskDestroyed(int task_id) override;
71 void OnTaskSetActive(int32_t task_id) override;
72 void OnTaskOrientationLockRequested( 76 void OnTaskOrientationLockRequested(
73 int32_t task_id, 77 int32_t task_id,
74 const arc::mojom::OrientationLock orientation_lock) override; 78 const arc::mojom::OrientationLock orientation_lock) override;
79 void OnTaskSetActive(int32_t task_id) override;
80
81 int active_task_id() const { return active_task_id_; }
75 82
76 private: 83 private:
77 class AppWindow;
78 class AppWindowInfo; 84 class AppWindowInfo;
79 85
80 using TaskIdToAppWindowInfo = std::map<int, std::unique_ptr<AppWindowInfo>>; 86 using TaskIdToAppWindowInfo = std::map<int, std::unique_ptr<AppWindowInfo>>;
81 87
82 // Maps shelf group id to controller. Shelf group id is optional parameter for 88 // Maps shelf group id to controller. Shelf group id is optional parameter for
83 // the Android task. If it is not set, app id is used instead. 89 // the Android task. If it is not set, app id is used instead.
84 using ShelfGroupToAppControllerMap = 90 using ShelfGroupToAppControllerMap =
85 std::map<arc::ArcAppShelfId, ArcAppWindowLauncherItemController*>; 91 std::map<arc::ArcAppShelfId, ArcAppWindowLauncherItemController*>;
86 92
87 void StartObserving(Profile* profile); 93 void StartObserving(Profile* profile);
88 void StopObserving(Profile* profile); 94 void StopObserving(Profile* profile);
89 95
90 void RegisterApp(AppWindowInfo* app_window_info); 96 void RegisterApp(AppWindowInfo* app_window_info);
91 void UnregisterApp(AppWindowInfo* app_window_info); 97 void UnregisterApp(AppWindowInfo* app_window_info);
92 98
93 AppWindowInfo* GetAppWindowInfoForTask(int task_id); 99 AppWindowInfo* GetAppWindowInfoForTask(int task_id);
94 AppWindow* GetAppWindowForTask(int task_id); 100 ArcAppWindow* GetAppWindowForTask(int task_id);
95 101
96 void AttachControllerToWindowIfNeeded(aura::Window* window); 102 void AttachControllerToWindowIfNeeded(aura::Window* window);
97 void AttachControllerToWindowsIfNeeded(); 103 void AttachControllerToWindowsIfNeeded();
98 ArcAppWindowLauncherItemController* AttachControllerToTask( 104 ArcAppWindowLauncherItemController* AttachControllerToTask(
99 int taskId, 105 int taskId,
100 const AppWindowInfo& app_window_info); 106 const AppWindowInfo& app_window_info);
101 107
102 void SetOrientationLockForAppWindow(AppWindow* app_window); 108 void SetOrientationLockForAppWindow(ArcAppWindow* app_window);
103 109
104 std::vector<int> GetTaskIdsForApp(const std::string& arc_app_id) const; 110 std::vector<int> GetTaskIdsForApp(const std::string& arc_app_id) const;
105 111
106 // AppWindowLauncherController: 112 // AppWindowLauncherController:
107 AppWindowLauncherItemController* ControllerForWindow( 113 AppWindowLauncherItemController* ControllerForWindow(
108 aura::Window* window) override; 114 aura::Window* window) override;
109 115
110 int active_task_id_ = -1; 116 int active_task_id_ = -1;
111 TaskIdToAppWindowInfo task_id_to_app_window_info_; 117 TaskIdToAppWindowInfo task_id_to_app_window_info_;
112 ShelfGroupToAppControllerMap app_shelf_group_to_controller_map_; 118 ShelfGroupToAppControllerMap app_shelf_group_to_controller_map_;
113 std::vector<aura::Window*> observed_windows_; 119 std::vector<aura::Window*> observed_windows_;
114 Profile* observed_profile_ = nullptr; 120 Profile* observed_profile_ = nullptr;
115 bool observing_shell_ = false; 121 bool observing_shell_ = false;
116 122
117 DISALLOW_COPY_AND_ASSIGN(ArcAppWindowLauncherController); 123 DISALLOW_COPY_AND_ASSIGN(ArcAppWindowLauncherController);
118 }; 124 };
119 125
120 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_ 126 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/arc_app_window.cc ('k') | chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698