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

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

Issue 2112013002: Allow arc app to lock screen orientation in TouchView/Tablet mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow arc app to lock screen orientation in TouchView/Tablet mode Created 4 years, 5 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/common/shell_observer.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #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"
14 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" 15 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
15 #include "mojo/public/cpp/bindings/binding.h" 16 #include "mojo/public/cpp/bindings/binding.h"
16 #include "ui/aura/env_observer.h" 17 #include "ui/aura/env_observer.h"
17 #include "ui/aura/window_observer.h" 18 #include "ui/aura/window_observer.h"
18 19
19 namespace ash { 20 namespace ash {
20 class ShelfDelegate; 21 class ShelfDelegate;
21 } 22 }
22 23
23 namespace aura { 24 namespace aura {
24 class Window; 25 class Window;
25 } 26 }
26 27
27 namespace views { 28 namespace views {
28 class Widget; 29 class Widget;
29 } 30 }
30 31
31 class ArcAppWindowLauncherItemController; 32 class ArcAppWindowLauncherItemController;
32 class ChromeLauncherController; 33 class ChromeLauncherController;
33 34
34 class Profile; 35 class Profile;
35 36
36 class ArcAppWindowLauncherController : public AppWindowLauncherController, 37 class ArcAppWindowLauncherController : public AppWindowLauncherController,
37 public aura::EnvObserver, 38 public aura::EnvObserver,
38 public aura::WindowObserver, 39 public aura::WindowObserver,
40 public ash::ShellObserver,
39 public ArcAppListPrefs::Observer { 41 public ArcAppListPrefs::Observer {
40 public: 42 public:
41 ArcAppWindowLauncherController(ChromeLauncherController* owner, 43 ArcAppWindowLauncherController(ChromeLauncherController* owner,
42 ash::ShelfDelegate* shelf_delegate); 44 ash::ShelfDelegate* shelf_delegate);
43 ~ArcAppWindowLauncherController() override; 45 ~ArcAppWindowLauncherController() override;
44 46
45 // Returns shelf app id. Play Store app is mapped to Arc platform host app. 47 // Returns shelf app id. Play Store app is mapped to Arc platform host app.
46 static std::string GetShelfAppIdFromArcAppId(const std::string& arc_app_id); 48 static std::string GetShelfAppIdFromArcAppId(const std::string& arc_app_id);
47 49
48 // Returns Arc app id. Arc platform host app is mapped to Play Store app. 50 // Returns Arc app id. Arc platform host app is mapped to Play Store app.
49 static std::string GetArcAppIdFromShelfAppId(const std::string& shelf_app_id); 51 static std::string GetArcAppIdFromShelfAppId(const std::string& shelf_app_id);
50 52
51 // AppWindowLauncherControllre: 53 // AppWindowLauncherControllre:
52 void ActiveUserChanged(const std::string& user_email) override; 54 void ActiveUserChanged(const std::string& user_email) override;
53 void AdditionalUserAddedToSession(Profile* profile) override; 55 void AdditionalUserAddedToSession(Profile* profile) override;
54 56
55 // aura::EnvObserver: 57 // aura::EnvObserver:
56 void OnWindowInitialized(aura::Window* window) override; 58 void OnWindowInitialized(aura::Window* window) override;
57 59
58 // aura::WindowObserver: 60 // aura::WindowObserver:
59 void OnWindowVisibilityChanging(aura::Window* window, bool visible) override; 61 void OnWindowVisibilityChanging(aura::Window* window, bool visible) override;
60 void OnWindowDestroying(aura::Window* window) override; 62 void OnWindowDestroying(aura::Window* window) override;
61 63
62 // aura::client::ActivationChangeObserver: 64 // aura::client::ActivationChangeObserver:
63 void OnWindowActivated( 65 void OnWindowActivated(
64 aura::client::ActivationChangeObserver::ActivationReason reason, 66 aura::client::ActivationChangeObserver::ActivationReason reason,
65 aura::Window* gained_active, 67 aura::Window* gained_active,
66 aura::Window* lost_active) override; 68 aura::Window* lost_active) override;
67 69
70 // ash::ShellObserver:
71 void OnMaximizeModeStarted() override;
72 void OnMaximizeModeEnded() override;
73
68 // ArcAppListPrefs::Observer: 74 // ArcAppListPrefs::Observer:
69 void OnAppReadyChanged(const std::string& app_id, bool ready) override; 75 void OnAppReadyChanged(const std::string& app_id, bool ready) override;
70 void OnAppRemoved(const std::string& app_id) override; 76 void OnAppRemoved(const std::string& app_id) override;
71 void OnTaskCreated(int task_id, 77 void OnTaskCreated(int task_id,
72 const std::string& package_name, 78 const std::string& package_name,
73 const std::string& activity) override; 79 const std::string& activity) override;
74 void OnTaskDestroyed(int task_id) override; 80 void OnTaskDestroyed(int task_id) override;
75 void OnTaskSetActive(int32_t task_id) override; 81 void OnTaskSetActive(int32_t task_id) override;
82 void OnTaskOrientationLockRequested(
83 int32_t task_id,
84 const arc::mojom::OrientationLock orientation_lock) override;
76 85
77 private: 86 private:
78 class AppWindow; 87 class AppWindow;
79 88
80 using TaskIdToAppWindow = std::map<int, std::unique_ptr<AppWindow>>; 89 using TaskIdToAppWindow = std::map<int, std::unique_ptr<AppWindow>>;
81 using AppControllerMap = 90 using AppControllerMap =
82 std::map<std::string, ArcAppWindowLauncherItemController*>; 91 std::map<std::string, ArcAppWindowLauncherItemController*>;
83 92
84 void StartObserving(Profile* profile); 93 void StartObserving(Profile* profile);
85 void StopObserving(Profile* profile); 94 void StopObserving(Profile* profile);
86 95
87 void RegisterApp(AppWindow* app_window); 96 void RegisterApp(AppWindow* app_window);
88 void UnregisterApp(AppWindow* app_window); 97 void UnregisterApp(AppWindow* app_window);
89 98
90 AppWindow* GetAppWindowForTask(int task_id); 99 AppWindow* GetAppWindowForTask(int task_id);
91 100
92 void CheckForAppWindowWidget(aura::Window* window); 101 void CheckForAppWindowWidget(aura::Window* window);
93 102
103 void SetOrientationLockForAppWindow(AppWindow* app_window);
104
94 // AppWindowLauncherController: 105 // AppWindowLauncherController:
95 AppWindowLauncherItemController* ControllerForWindow( 106 AppWindowLauncherItemController* ControllerForWindow(
96 aura::Window* window) override; 107 aura::Window* window) override;
97 108
98 // Not owned 109 // Not owned
99 ash::ShelfDelegate* shelf_delegate_; 110 ash::ShelfDelegate* shelf_delegate_;
100 int active_task_id_ = -1; 111 int active_task_id_ = -1;
101 TaskIdToAppWindow task_id_to_app_window_; 112 TaskIdToAppWindow task_id_to_app_window_;
102 AppControllerMap app_controller_map_; 113 AppControllerMap app_controller_map_;
103 std::vector<aura::Window*> observed_windows_; 114 std::vector<aura::Window*> observed_windows_;
104 Profile* observed_profile_ = nullptr; 115 Profile* observed_profile_ = nullptr;
116 bool observing_shell_ = false;
105 117
106 DISALLOW_COPY_AND_ASSIGN(ArcAppWindowLauncherController); 118 DISALLOW_COPY_AND_ASSIGN(ArcAppWindowLauncherController);
107 }; 119 };
108 120
109 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_ 121 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_ARC_APP_WINDOW_LAUNCHER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698