OLD | NEW |
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_APP_LIST_ARC_ARC_APP_LAUNCHER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LAUNCHER_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LAUNCHER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LAUNCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 11 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class BrowserContext; | 14 class BrowserContext; |
15 } | 15 } |
16 | 16 |
17 // Helper class for deferred Arc app launching in case app is not ready on the | 17 // Helper class for deferred ARC app launching in case app is not ready on the |
18 // moment of request. | 18 // moment of request. |
19 class ArcAppLauncher : public ArcAppListPrefs::Observer { | 19 class ArcAppLauncher : public ArcAppListPrefs::Observer { |
20 public: | 20 public: |
21 ArcAppLauncher(content::BrowserContext* context, | 21 ArcAppLauncher(content::BrowserContext* context, |
22 const std::string& app_id, | 22 const std::string& app_id, |
23 bool landscape_layout); | 23 bool landscape_layout); |
24 ~ArcAppLauncher() override; | 24 ~ArcAppLauncher() override; |
25 | 25 |
26 bool app_launched() const { return app_launched_; } | 26 bool app_launched() const { return app_launched_; } |
27 | 27 |
28 // ArcAppListPrefs::Observer: | 28 // ArcAppListPrefs::Observer: |
29 void OnAppRegistered(const std::string& app_id, | 29 void OnAppRegistered(const std::string& app_id, |
30 const ArcAppListPrefs::AppInfo& app_info) override; | 30 const ArcAppListPrefs::AppInfo& app_info) override; |
31 void OnAppReadyChanged(const std::string& app_id, bool ready) override; | 31 void OnAppReadyChanged(const std::string& app_id, bool ready) override; |
32 | 32 |
33 private: | 33 private: |
34 void LaunchApp(); | 34 void LaunchApp(); |
35 | 35 |
36 // Unowned pointer. | 36 // Unowned pointer. |
37 content::BrowserContext* context_; | 37 content::BrowserContext* context_; |
38 // Arc app id and requested layout. | 38 // ARC app id and requested layout. |
39 const std::string app_id_; | 39 const std::string app_id_; |
40 const bool landscape_layout_; | 40 const bool landscape_layout_; |
41 // Flag idicating that Arc app was launched. | 41 // Flag idicating that ARC app was launched. |
42 bool app_launched_ = false; | 42 bool app_launched_ = false; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(ArcAppLauncher); | 44 DISALLOW_COPY_AND_ASSIGN(ArcAppLauncher); |
45 }; | 45 }; |
46 | 46 |
47 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LAUNCHER_H_ | 47 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LAUNCHER_H_ |
OLD | NEW |