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

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

Issue 2883193002: WIP
Patch Set: git cl try 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
70 void OnTaskDestroyed(int task_id) override; 71 void OnTaskDestroyed(int task_id) override;
71 void OnTaskSetActive(int32_t task_id) override; 72 void OnTaskSetActive(int32_t task_id) override;
72 void OnTaskOrientationLockRequested( 73 void OnTaskOrientationLockRequested(
73 int32_t task_id, 74 int32_t task_id,
74 const arc::mojom::OrientationLock orientation_lock) override; 75 const arc::mojom::OrientationLock orientation_lock) override;
75 76
77 int active_task_id() const { return active_task_id_; }
78
76 private: 79 private:
77 class AppWindow;
78 class AppWindowInfo; 80 class AppWindowInfo;
79 81
80 using TaskIdToAppWindowInfo = std::map<int, std::unique_ptr<AppWindowInfo>>; 82 using TaskIdToAppWindowInfo = std::map<int, std::unique_ptr<AppWindowInfo>>;
81 83
82 // Maps shelf group id to controller. Shelf group id is optional parameter for 84 // 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. 85 // the Android task. If it is not set, app id is used instead.
84 using ShelfGroupToAppControllerMap = 86 using ShelfGroupToAppControllerMap =
85 std::map<arc::ArcAppShelfId, ArcAppWindowLauncherItemController*>; 87 std::map<arc::ArcAppShelfId, ArcAppWindowLauncherItemController*>;
86 88
87 void StartObserving(Profile* profile); 89 void StartObserving(Profile* profile);
88 void StopObserving(Profile* profile); 90 void StopObserving(Profile* profile);
89 91
90 void RegisterApp(AppWindowInfo* app_window_info); 92 void RegisterApp(AppWindowInfo* app_window_info);
91 void UnregisterApp(AppWindowInfo* app_window_info); 93 void UnregisterApp(AppWindowInfo* app_window_info);
92 94
93 AppWindowInfo* GetAppWindowInfoForTask(int task_id); 95 AppWindowInfo* GetAppWindowInfoForTask(int task_id);
94 AppWindow* GetAppWindowForTask(int task_id); 96 ArcAppWindow* GetAppWindowForTask(int task_id);
95 97
96 void AttachControllerToWindowIfNeeded(aura::Window* window); 98 void AttachControllerToWindowIfNeeded(aura::Window* window);
97 void AttachControllerToWindowsIfNeeded(); 99 void AttachControllerToWindowsIfNeeded();
98 ArcAppWindowLauncherItemController* AttachControllerToTask( 100 ArcAppWindowLauncherItemController* AttachControllerToTask(
99 int taskId, 101 int taskId,
100 const AppWindowInfo& app_window_info); 102 const AppWindowInfo& app_window_info);
101 103
102 void SetOrientationLockForAppWindow(AppWindow* app_window); 104 void SetOrientationLockForAppWindow(ArcAppWindow* app_window);
103 105
104 std::vector<int> GetTaskIdsForApp(const std::string& arc_app_id) const; 106 std::vector<int> GetTaskIdsForApp(const std::string& arc_app_id) const;
105 107
106 // AppWindowLauncherController: 108 // AppWindowLauncherController:
107 AppWindowLauncherItemController* ControllerForWindow( 109 AppWindowLauncherItemController* ControllerForWindow(
108 aura::Window* window) override; 110 aura::Window* window) override;
109 111
110 int active_task_id_ = -1; 112 int active_task_id_ = -1;
111 TaskIdToAppWindowInfo task_id_to_app_window_info_; 113 TaskIdToAppWindowInfo task_id_to_app_window_info_;
112 ShelfGroupToAppControllerMap app_shelf_group_to_controller_map_; 114 ShelfGroupToAppControllerMap app_shelf_group_to_controller_map_;
113 std::vector<aura::Window*> observed_windows_; 115 std::vector<aura::Window*> observed_windows_;
114 Profile* observed_profile_ = nullptr; 116 Profile* observed_profile_ = nullptr;
115 bool observing_shell_ = false; 117 bool observing_shell_ = false;
116 118
117 DISALLOW_COPY_AND_ASSIGN(ArcAppWindowLauncherController); 119 DISALLOW_COPY_AND_ASSIGN(ArcAppWindowLauncherController);
118 }; 120 };
119 121
120 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_ 122 #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