| Index: chrome/browser/chromeos/note_taking_helper.h
|
| diff --git a/chrome/browser/chromeos/note_taking_helper.h b/chrome/browser/chromeos/note_taking_helper.h
|
| index c90b410fe25c4a4a7cb3fd8770083610af2c7d14..6b6392b72058353cad678e9898dddf9f7b3f1202 100644
|
| --- a/chrome/browser/chromeos/note_taking_helper.h
|
| +++ b/chrome/browser/chromeos/note_taking_helper.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef CHROME_BROWSER_CHROMEOS_NOTE_TAKING_HELPER_H_
|
| #define CHROME_BROWSER_CHROMEOS_NOTE_TAKING_HELPER_H_
|
|
|
| +#include <set>
|
| #include <string>
|
| #include <vector>
|
|
|
| @@ -13,6 +14,12 @@
|
| #include "base/observer_list.h"
|
| #include "chrome/browser/chromeos/arc/arc_session_manager.h"
|
| #include "components/arc/arc_service_manager.h"
|
| +#include "content/public/browser/notification_details.h"
|
| +#include "content/public/browser/notification_observer.h"
|
| +#include "content/public/browser/notification_registrar.h"
|
| +#include "content/public/browser/notification_source.h"
|
| +#include "extensions/browser/extension_registry_observer.h"
|
| +#include "extensions/common/extension.h"
|
|
|
| class Profile;
|
|
|
| @@ -20,8 +27,11 @@ namespace base {
|
| class FilePath;
|
| } // namespace base
|
|
|
| +namespace content {
|
| +class BrowserContext;
|
| +} // namespace content
|
| +
|
| namespace extensions {
|
| -class Extension;
|
| namespace api {
|
| namespace app_runtime {
|
| struct ActionData;
|
| @@ -48,7 +58,9 @@ using NoteTakingAppInfos = std::vector<NoteTakingAppInfo>;
|
|
|
| // Singleton class used to launch a note-taking app.
|
| class NoteTakingHelper : public arc::ArcServiceManager::Observer,
|
| - public arc::ArcSessionManager::Observer {
|
| + public arc::ArcSessionManager::Observer,
|
| + public content::NotificationObserver,
|
| + public extensions::ExtensionRegistryObserver {
|
| public:
|
| // Interface for observing changes to the list of available apps.
|
| class Observer {
|
| @@ -118,6 +130,20 @@ class NoteTakingHelper : public arc::ArcServiceManager::Observer,
|
| NoteTakingHelper();
|
| ~NoteTakingHelper() override;
|
|
|
| + // Returns true if |extension| is a whitelisted note-taking app and false
|
| + // otherwise.
|
| + bool IsWhitelistedChromeApp(const extensions::Extension* extension) const;
|
| +
|
| + // Starts or stops observing |profile|'s ExtensionRegistry and updates
|
| + // |profiles_|.
|
| + void AddProfile(Profile* profile);
|
| + void RemoveProfile(Profile* profile);
|
| +
|
| + // Queries and returns all installed and enabled whitelisted Chrome
|
| + // note-taking apps for |profile|.
|
| + std::vector<const extensions::Extension*> GetChromeApps(
|
| + Profile* profile) const;
|
| +
|
| // Requests a list of Android note-taking apps from ARC.
|
| void UpdateAndroidApps();
|
|
|
| @@ -131,6 +157,19 @@ class NoteTakingHelper : public arc::ArcServiceManager::Observer,
|
| const std::string& app_id,
|
| const base::FilePath& path);
|
|
|
| + // content::NotificationObserver:
|
| + void Observe(int type,
|
| + const content::NotificationSource& source,
|
| + const content::NotificationDetails& details) override;
|
| +
|
| + // extensions::ExtensionRegistryObserver:
|
| + void OnExtensionLoaded(content::BrowserContext* browser_context,
|
| + const extensions::Extension* extension) override;
|
| + void OnExtensionUnloaded(
|
| + content::BrowserContext* browser_context,
|
| + const extensions::Extension* extension,
|
| + extensions::UnloadedExtensionInfo::Reason reason) override;
|
| +
|
| // True iff ARC is enabled (i.e. per the checkbox on the settings page). Note
|
| // that ARC may not be fully started yet when this is true, but it is expected
|
| // to start eventually. Similarly, ARC may not be fully shut down yet when
|
| @@ -143,11 +182,21 @@ class NoteTakingHelper : public arc::ArcServiceManager::Observer,
|
| // Callback used to launch Chrome apps. Can be overridden for tests.
|
| LaunchChromeAppCallback launch_chrome_app_callback_;
|
|
|
| + // Extension IDs of whitelisted (but not necessarily installed) Chrome
|
| + // note-taking apps in the order in which they're chosen if the user hasn't
|
| + // expressed a preference.
|
| + std::vector<extensions::ExtensionId> whitelisted_chrome_app_ids_;
|
| +
|
| // Cached information about available Android note-taking apps.
|
| NoteTakingAppInfos android_apps_;
|
|
|
| + // Profiles being watched.
|
| + std::set<Profile*> profiles_;
|
| +
|
| base::ObserverList<Observer> observers_;
|
|
|
| + content::NotificationRegistrar registrar_;
|
| +
|
| base::WeakPtrFactory<NoteTakingHelper> weak_ptr_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(NoteTakingHelper);
|
|
|