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/webui/settings/chromeos/android_apps_handler.h

Issue 2873853002: arc: Handle ARC events in MD Settings (Closed)
Patch Set: fix annotations 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_WEBUI_SETTINGS_CHROMEOS_ANDROID_APPS_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_ANDROID_APPS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_ANDROID_APPS_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_ANDROID_APPS_HANDLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/scoped_observer.h" 12 #include "base/scoped_observer.h"
13 #include "chrome/browser/chromeos/arc/arc_session_manager.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/webui/settings/settings_page_ui_handler.h" 15 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
15 16
16 class Profile; 17 class Profile;
17 18
18 namespace base { 19 namespace base {
19 class DictionaryValue; 20 class DictionaryValue;
20 } 21 }
21 22
22 namespace chromeos { 23 namespace chromeos {
23 namespace settings { 24 namespace settings {
24 25
25 class AndroidAppsHandler : public ::settings::SettingsPageUIHandler, 26 class AndroidAppsHandler : public ::settings::SettingsPageUIHandler,
26 public ArcAppListPrefs::Observer { 27 public ArcAppListPrefs::Observer,
28 public arc::ArcSessionManager::Observer {
27 public: 29 public:
28 explicit AndroidAppsHandler(Profile* profile); 30 explicit AndroidAppsHandler(Profile* profile);
29 ~AndroidAppsHandler() override; 31 ~AndroidAppsHandler() override;
30 32
31 // SettingsPageUIHandler 33 // SettingsPageUIHandler
32 void RegisterMessages() override; 34 void RegisterMessages() override;
33 void OnJavascriptAllowed() override; 35 void OnJavascriptAllowed() override;
34 void OnJavascriptDisallowed() override; 36 void OnJavascriptDisallowed() override;
35 37
36 // ArcAppListPrefs::Observer 38 // ArcAppListPrefs::Observer
37 void OnAppReadyChanged(const std::string& app_id, bool ready) override;
38 void OnAppRemoved(const std::string& app_id) override; 39 void OnAppRemoved(const std::string& app_id) override;
39 void OnAppRegistered(const std::string& app_id, 40 void OnAppRegistered(const std::string& app_id,
40 const ArcAppListPrefs::AppInfo& app_info) override; 41 const ArcAppListPrefs::AppInfo& app_info) override;
41 42
43 // arc::ArcSessionManager::Observer:
44 void OnArcPlayStoreEnabledChanged(bool enabled) override;
45
42 private: 46 private:
43 std::unique_ptr<base::DictionaryValue> BuildAndroidAppsInfo(); 47 std::unique_ptr<base::DictionaryValue> BuildAndroidAppsInfo();
44 void OnAppChanged(const std::string& app_id); 48 void OnAppChanged(const std::string& app_id);
45 void HandleRequestAndroidAppsInfo(const base::ListValue* args); 49 void HandleRequestAndroidAppsInfo(const base::ListValue* args);
46 void SendAndroidAppsInfo(); 50 void SendAndroidAppsInfo();
47 void ShowAndroidAppsSettings(const base::ListValue* args); 51 void ShowAndroidAppsSettings(const base::ListValue* args);
48 52
49 ScopedObserver<ArcAppListPrefs, ArcAppListPrefs::Observer> 53 ScopedObserver<ArcAppListPrefs, ArcAppListPrefs::Observer>
50 arc_prefs_observer_; 54 arc_prefs_observer_;
55 ScopedObserver<arc::ArcSessionManager, arc::ArcSessionManager::Observer>
56 arc_session_manager_observer_;
51 Profile* profile_; // unowned 57 Profile* profile_; // unowned
52 base::WeakPtrFactory<AndroidAppsHandler> weak_ptr_factory_; 58 base::WeakPtrFactory<AndroidAppsHandler> weak_ptr_factory_;
53 59
54 DISALLOW_COPY_AND_ASSIGN(AndroidAppsHandler); 60 DISALLOW_COPY_AND_ASSIGN(AndroidAppsHandler);
55 }; 61 };
56 62
57 } // namespace settings 63 } // namespace settings
58 } // namespace chromeos 64 } // namespace chromeos
59 65
60 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_ANDROID_APPS_HANDLER_H_ 66 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_ANDROID_APPS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698