Chromium Code Reviews| Index: chrome/browser/extensions/platform_app_registry.h | 
| diff --git a/chrome/browser/extensions/platform_app_registry.h b/chrome/browser/extensions/platform_app_registry.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..5e9524f0ad98ec6cc657bcf9c309379c08b329df | 
| --- /dev/null | 
| +++ b/chrome/browser/extensions/platform_app_registry.h | 
| @@ -0,0 +1,65 @@ | 
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#ifndef CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_REGISTRY_H_ | 
| +#define CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_REGISTRY_H_ | 
| +#pragma once | 
| + | 
| +#include <set> | 
| + | 
| +#include "base/compiler_specific.h" | 
| +#include "base/memory/singleton.h" | 
| +#include "chrome/browser/profiles/profile_keyed_service.h" | 
| +#include "chrome/browser/profiles/profile_keyed_service_factory.h" | 
| + | 
| +class Profile; | 
| +class ShellWindow; | 
| + | 
| +// The PlatformAppRegistry tracks the ShellWindows for all platform apps for a | 
| 
 
Aaron Boodman
2012/04/27 16:20:31
ShellWindowRegistry?
 
benwells
2012/05/03 09:22:40
Done.
 
 | 
| +// particular profile. | 
| +// This class is planned to evolve into tracking all PlatformApps for a | 
| +// particular profile, with a PlatformApp encapsulating all views (background | 
| +// page, shell windows, tray view, panels etc.) and other app level behaviour | 
| +// (e.g. notifications the app is interested in, lifetime of the background | 
| +// page). | 
| +class PlatformAppRegistry : public ProfileKeyedService { | 
| + public: | 
| + typedef std::set<ShellWindow*> ShellWindowSet; | 
| + typedef ShellWindowSet::const_iterator const_iterator; | 
| + | 
| + PlatformAppRegistry(); | 
| + virtual ~PlatformAppRegistry(); | 
| + | 
| + // Returns the instance for the given profile, or NULL if none. This is | 
| + // a convenience wrapper around PlatformAppRegistryFactory::GetForProfile. | 
| + static PlatformAppRegistry* Get(Profile* profile); | 
| + | 
| + void AddShellWindow(ShellWindow* shell_window); | 
| + void RemoveShellWindow(ShellWindow* shell_window); | 
| + | 
| + const ShellWindowSet& shell_windows() const { return shell_windows_; } | 
| + | 
| + private: | 
| + class Factory : public ProfileKeyedServiceFactory { | 
| + public: | 
| + static PlatformAppRegistry* GetForProfile(Profile* profile); | 
| + | 
| + static Factory* GetInstance(); | 
| + private: | 
| + friend struct DefaultSingletonTraits<Factory>; | 
| + | 
| + Factory(); | 
| + virtual ~Factory(); | 
| + | 
| + // ProfileKeyedServiceFactory | 
| + virtual ProfileKeyedService* BuildServiceInstanceFor( | 
| + Profile* profile) const OVERRIDE; | 
| + virtual bool ServiceIsCreatedWithProfile() OVERRIDE; | 
| + virtual bool ServiceIsNULLWhileTesting() OVERRIDE; | 
| + }; | 
| + | 
| + ShellWindowSet shell_windows_; | 
| +}; | 
| + | 
| +#endif // CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_REGISTRY_H_ |