From 52daa301c9749eee9d64932db07281d74dd1d4a2 Mon Sep 17 00:00:00 2001 From: "xiyuan@chromium.org" Date: Tue, 15 Apr 2014 14:31:07 +0000 Subject: Add DriveAppRegistryObserver. So that interested parties get notified when the list of installed Drive apps are updated. BUG=358796 Review URL: https://codereview.chromium.org/235983008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263843 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/drive/drive_app_registry.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'chrome/browser/drive/drive_app_registry.h') diff --git a/chrome/browser/drive/drive_app_registry.h b/chrome/browser/drive/drive_app_registry.h index c86de92..7f8ee0c 100644 --- a/chrome/browser/drive/drive_app_registry.h +++ b/chrome/browser/drive/drive_app_registry.h @@ -13,6 +13,7 @@ #include "base/files/file_path.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" +#include "base/observer_list.h" #include "google_apis/drive/gdata_errorcode.h" #include "google_apis/drive/gdata_wapi_parser.h" #include "url/gurl.h" @@ -23,6 +24,7 @@ class AppList; namespace drive { +class DriveAppRegistryObserver; class DriveServiceInterface; // Data structure that defines Drive app. See @@ -97,6 +99,9 @@ class DriveAppRegistry { // Updates this registry from the |app_list|. void UpdateFromAppList(const google_apis::AppList& app_list); + void AddObserver(DriveAppRegistryObserver* observer); + void RemoveObserver(DriveAppRegistryObserver* observer); + private: // Part of Update(). Runs upon the completion of fetching the Drive apps // data from the server. @@ -121,9 +126,12 @@ class DriveAppRegistry { bool is_updating_; + ObserverList observers_; + // Note: This should remain the last member so it'll be destroyed and // invalidate the weak pointers before any other members are destroyed. base::WeakPtrFactory weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(DriveAppRegistry); }; -- cgit v1.1