| 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_NOTE_TAKING_HELPER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NOTE_TAKING_HELPER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NOTE_TAKING_HELPER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NOTE_TAKING_HELPER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 public arc::ArcSessionManager::Observer, | 64 public arc::ArcSessionManager::Observer, |
| 65 public content::NotificationObserver, | 65 public content::NotificationObserver, |
| 66 public extensions::ExtensionRegistryObserver { | 66 public extensions::ExtensionRegistryObserver { |
| 67 public: | 67 public: |
| 68 // Interface for observing changes to the list of available apps. | 68 // Interface for observing changes to the list of available apps. |
| 69 class Observer { | 69 class Observer { |
| 70 public: | 70 public: |
| 71 virtual ~Observer() = default; | 71 virtual ~Observer() = default; |
| 72 | 72 |
| 73 // Called when the list of available apps that will be returned by | 73 // Called when the list of available apps that will be returned by |
| 74 // GetAvailableApps() changes or when |android_enabled_| changes state. | 74 // GetAvailableApps() changes or when |play_store_enabled_| changes state. |
| 75 virtual void OnAvailableNoteTakingAppsUpdated() = 0; | 75 virtual void OnAvailableNoteTakingAppsUpdated() = 0; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 // Describes the result of an attempt to launch a note-taking app. Values must | 78 // Describes the result of an attempt to launch a note-taking app. Values must |
| 79 // not be renumbered, as this is used by histogram metrics. | 79 // not be renumbered, as this is used by histogram metrics. |
| 80 enum class LaunchResult { | 80 enum class LaunchResult { |
| 81 // A Chrome app was launched successfully. | 81 // A Chrome app was launched successfully. |
| 82 CHROME_SUCCESS = 0, | 82 CHROME_SUCCESS = 0, |
| 83 // The requested Chrome app was unavailable. | 83 // The requested Chrome app was unavailable. |
| 84 CHROME_APP_MISSING = 1, | 84 CHROME_APP_MISSING = 1, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 static const char kProdKeepExtensionId[]; | 117 static const char kProdKeepExtensionId[]; |
| 118 | 118 |
| 119 // Names of histograms. | 119 // Names of histograms. |
| 120 static const char kPreferredLaunchResultHistogramName[]; | 120 static const char kPreferredLaunchResultHistogramName[]; |
| 121 static const char kDefaultLaunchResultHistogramName[]; | 121 static const char kDefaultLaunchResultHistogramName[]; |
| 122 | 122 |
| 123 static void Initialize(); | 123 static void Initialize(); |
| 124 static void Shutdown(); | 124 static void Shutdown(); |
| 125 static NoteTakingHelper* Get(); | 125 static NoteTakingHelper* Get(); |
| 126 | 126 |
| 127 bool android_enabled() const { return android_enabled_; } | 127 bool play_store_enabled() const { return play_store_enabled_; } |
| 128 bool android_apps_received() const { return android_apps_received_; } | 128 bool android_apps_received() const { return android_apps_received_; } |
| 129 | 129 |
| 130 void set_launch_chrome_app_callback_for_test( | 130 void set_launch_chrome_app_callback_for_test( |
| 131 const LaunchChromeAppCallback& callback) { | 131 const LaunchChromeAppCallback& callback) { |
| 132 launch_chrome_app_callback_ = callback; | 132 launch_chrome_app_callback_ = callback; |
| 133 } | 133 } |
| 134 | 134 |
| 135 // Adds or removes an observer. | 135 // Adds or removes an observer. |
| 136 void AddObserver(Observer* observer); | 136 void AddObserver(Observer* observer); |
| 137 void RemoveObserver(Observer* observer); | 137 void RemoveObserver(Observer* observer); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 // extensions::ExtensionRegistryObserver: | 192 // extensions::ExtensionRegistryObserver: |
| 193 void OnExtensionLoaded(content::BrowserContext* browser_context, | 193 void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 194 const extensions::Extension* extension) override; | 194 const extensions::Extension* extension) override; |
| 195 void OnExtensionUnloaded( | 195 void OnExtensionUnloaded( |
| 196 content::BrowserContext* browser_context, | 196 content::BrowserContext* browser_context, |
| 197 const extensions::Extension* extension, | 197 const extensions::Extension* extension, |
| 198 extensions::UnloadedExtensionInfo::Reason reason) override; | 198 extensions::UnloadedExtensionInfo::Reason reason) override; |
| 199 void OnShutdown(extensions::ExtensionRegistry* registry) override; | 199 void OnShutdown(extensions::ExtensionRegistry* registry) override; |
| 200 | 200 |
| 201 // True iff ARC is enabled (i.e. per the checkbox on the settings page). Note | 201 // True iff Play Store is enabled (i.e. per the checkbox on the settings |
| 202 // that ARC may not be fully started yet when this is true, but it is expected | 202 // page). Note that ARC may not be fully started yet when this is true, but it |
| 203 // to start eventually. Similarly, ARC may not be fully shut down yet when | 203 // is expected to start eventually. Similarly, ARC may not be fully shut down |
| 204 // this is false, but will be eventually. | 204 // yet when this is false, but will be eventually. |
| 205 bool android_enabled_ = false; | 205 bool play_store_enabled_ = false; |
| 206 | 206 |
| 207 // This is set to true after |android_apps_| is updated. | 207 // This is set to true after |android_apps_| is updated. |
| 208 bool android_apps_received_ = false; | 208 bool android_apps_received_ = false; |
| 209 | 209 |
| 210 // Callback used to launch Chrome apps. Can be overridden for tests. | 210 // Callback used to launch Chrome apps. Can be overridden for tests. |
| 211 LaunchChromeAppCallback launch_chrome_app_callback_; | 211 LaunchChromeAppCallback launch_chrome_app_callback_; |
| 212 | 212 |
| 213 // Extension IDs of whitelisted (but not necessarily installed) Chrome | 213 // Extension IDs of whitelisted (but not necessarily installed) Chrome |
| 214 // note-taking apps in the order in which they're chosen if the user hasn't | 214 // note-taking apps in the order in which they're chosen if the user hasn't |
| 215 // expressed a preference. | 215 // expressed a preference. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 228 content::NotificationRegistrar registrar_; | 228 content::NotificationRegistrar registrar_; |
| 229 | 229 |
| 230 base::WeakPtrFactory<NoteTakingHelper> weak_ptr_factory_; | 230 base::WeakPtrFactory<NoteTakingHelper> weak_ptr_factory_; |
| 231 | 231 |
| 232 DISALLOW_COPY_AND_ASSIGN(NoteTakingHelper); | 232 DISALLOW_COPY_AND_ASSIGN(NoteTakingHelper); |
| 233 }; | 233 }; |
| 234 | 234 |
| 235 } // namespace chromeos | 235 } // namespace chromeos |
| 236 | 236 |
| 237 #endif // CHROME_BROWSER_CHROMEOS_NOTE_TAKING_HELPER_H_ | 237 #endif // CHROME_BROWSER_CHROMEOS_NOTE_TAKING_HELPER_H_ |
| OLD | NEW |