OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_ANDROID_APPS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_ANDROID_APPS_HANDLER_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/scoped_observer.h" |
| 13 #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 |
| 16 class Profile; |
| 17 |
| 18 namespace base { |
| 19 class DictionaryValue; |
| 20 } |
| 21 |
| 22 namespace chromeos { |
| 23 namespace settings { |
| 24 |
| 25 class AndroidAppsHandler : public ::settings::SettingsPageUIHandler, |
| 26 public ArcAppListPrefs::Observer { |
| 27 public: |
| 28 explicit AndroidAppsHandler(Profile* profile); |
| 29 ~AndroidAppsHandler() override; |
| 30 |
| 31 // SettingsPageUIHandler |
| 32 void RegisterMessages() override; |
| 33 void OnJavascriptAllowed() override; |
| 34 void OnJavascriptDisallowed() override; |
| 35 |
| 36 // ArcAppListPrefs::Observer |
| 37 void OnAppReadyChanged(const std::string& app_id, bool ready) override; |
| 38 void OnAppRemoved(const std::string& app_id) override; |
| 39 void OnAppRegistered(const std::string& app_id, |
| 40 const ArcAppListPrefs::AppInfo& app_info) override; |
| 41 |
| 42 private: |
| 43 std::unique_ptr<base::DictionaryValue> BuildAndroidAppsInfo(); |
| 44 void OnAppChanged(const std::string& app_id); |
| 45 void HandleRequestAndroidAppsInfo(const base::ListValue* args); |
| 46 void SendAndroidAppsInfo(); |
| 47 void ShowAndroidAppsSettings(const base::ListValue* args); |
| 48 |
| 49 ScopedObserver<ArcAppListPrefs, ArcAppListPrefs::Observer> |
| 50 arc_prefs_observer_; |
| 51 Profile* profile_; // unowned |
| 52 base::WeakPtrFactory<AndroidAppsHandler> weak_ptr_factory_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(AndroidAppsHandler); |
| 55 }; |
| 56 |
| 57 } // namespace settings |
| 58 } // namespace chromeos |
| 59 |
| 60 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_ANDROID_APPS_HANDLER_H_ |
OLD | NEW |