| 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_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 9 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 10 #include "components/prefs/pref_change_registrar.h" | 10 #include "components/prefs/pref_change_registrar.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void OnDisplayMetricsChanged(const display::Display& display, | 45 void OnDisplayMetricsChanged(const display::Display& display, |
| 46 uint32_t changed_metrics) override; | 46 uint32_t changed_metrics) override; |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 ArcSupportHost(); | 49 ArcSupportHost(); |
| 50 | 50 |
| 51 bool Initialize(); | 51 bool Initialize(); |
| 52 void OnMetricsPreferenceChanged(); | 52 void OnMetricsPreferenceChanged(); |
| 53 void OnBackupAndRestorePreferenceChanged(); | 53 void OnBackupAndRestorePreferenceChanged(); |
| 54 void OnLocationServicePreferenceChanged(); | 54 void OnLocationServicePreferenceChanged(); |
| 55 |
| 56 // Utilities on preference update. |
| 55 void SendMetricsMode(); | 57 void SendMetricsMode(); |
| 56 void SendBackupAndRestoreMode(); | 58 void SendBackupAndRestoreMode(); |
| 57 void SendLocationServicesMode(); | 59 void SendLocationServicesMode(); |
| 58 void SendOptionMode(const std::string& action_name, | 60 void SendOptionMode(const std::string& action_name, |
| 59 const std::string& pref_name); | 61 const std::string& pref_name); |
| 62 |
| 63 // Sends a preference update to the extension. |
| 64 // The message will be |
| 65 // { |
| 66 // 'action': action_name, |
| 67 // 'enabled': is_enabled, |
| 68 // 'managed': is_managed |
| 69 // } |
| 70 void SendPreferenceUpdate(const std::string& action_name, |
| 71 bool is_enabled, |
| 72 bool is_managed); |
| 73 |
| 60 void EnableMetrics(bool is_enabled); | 74 void EnableMetrics(bool is_enabled); |
| 61 void EnableBackupRestore(bool is_enabled); | 75 void EnableBackupRestore(bool is_enabled); |
| 62 void EnableLocationService(bool is_enabled); | 76 void EnableLocationService(bool is_enabled); |
| 63 | 77 |
| 64 // Unowned pointer. | 78 // Unowned pointer. |
| 65 Client* client_ = nullptr; | 79 Client* client_ = nullptr; |
| 66 | 80 |
| 67 // Keep if Close() is requested from the browser. | 81 // Keep if Close() is requested from the browser. |
| 68 // TODO(hidehiko): Remove this. This is temporarily introduced for checking | 82 // TODO(hidehiko): Remove this. This is temporarily introduced for checking |
| 69 // if ArcAuthService::CancelAuthCode() needs to be invoked or not. | 83 // if ArcAuthService::CancelAuthCode() needs to be invoked or not. |
| 70 // ArcAuthService should know its own state and the transition so moving to | 84 // ArcAuthService should know its own state and the transition so moving to |
| 71 // there should simplify the structure. However, it is blocked by the current | 85 // there should simplify the structure. However, it is blocked by the current |
| 72 // dependency. For the clean up, more refactoring is needed, which can be | 86 // dependency. For the clean up, more refactoring is needed, which can be |
| 73 // bigger changes. | 87 // bigger changes. |
| 74 bool close_requested_ = false; | 88 bool close_requested_ = false; |
| 75 | 89 |
| 76 // Used to track metrics preference. | 90 // Used to track metrics preference. |
| 77 PrefChangeRegistrar pref_local_change_registrar_; | 91 PrefChangeRegistrar pref_local_change_registrar_; |
| 78 // Used to track backup&restore and location service preference. | 92 // Used to track backup&restore and location service preference. |
| 79 PrefChangeRegistrar pref_change_registrar_; | 93 PrefChangeRegistrar pref_change_registrar_; |
| 80 | 94 |
| 81 DISALLOW_COPY_AND_ASSIGN(ArcSupportHost); | 95 DISALLOW_COPY_AND_ASSIGN(ArcSupportHost); |
| 82 }; | 96 }; |
| 83 | 97 |
| 84 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ | 98 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ |
| OLD | NEW |