Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_REGISTRY_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_REGISTRY_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <set> | |
| 10 | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "base/memory/singleton.h" | |
| 13 #include "chrome/browser/profiles/profile_keyed_service.h" | |
| 14 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | |
| 15 | |
| 16 class Profile; | |
| 17 class ShellWindow; | |
| 18 | |
| 19 // 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.
| |
| 20 // particular profile. | |
| 21 // This class is planned to evolve into tracking all PlatformApps for a | |
| 22 // particular profile, with a PlatformApp encapsulating all views (background | |
| 23 // page, shell windows, tray view, panels etc.) and other app level behaviour | |
| 24 // (e.g. notifications the app is interested in, lifetime of the background | |
| 25 // page). | |
| 26 class PlatformAppRegistry : public ProfileKeyedService { | |
| 27 public: | |
| 28 typedef std::set<ShellWindow*> ShellWindowSet; | |
| 29 typedef ShellWindowSet::const_iterator const_iterator; | |
| 30 | |
| 31 PlatformAppRegistry(); | |
| 32 virtual ~PlatformAppRegistry(); | |
| 33 | |
| 34 // Returns the instance for the given profile, or NULL if none. This is | |
| 35 // a convenience wrapper around PlatformAppRegistryFactory::GetForProfile. | |
| 36 static PlatformAppRegistry* Get(Profile* profile); | |
| 37 | |
| 38 void AddShellWindow(ShellWindow* shell_window); | |
| 39 void RemoveShellWindow(ShellWindow* shell_window); | |
| 40 | |
| 41 const ShellWindowSet& shell_windows() const { return shell_windows_; } | |
| 42 | |
| 43 private: | |
| 44 class Factory : public ProfileKeyedServiceFactory { | |
| 45 public: | |
| 46 static PlatformAppRegistry* GetForProfile(Profile* profile); | |
| 47 | |
| 48 static Factory* GetInstance(); | |
| 49 private: | |
| 50 friend struct DefaultSingletonTraits<Factory>; | |
| 51 | |
| 52 Factory(); | |
| 53 virtual ~Factory(); | |
| 54 | |
| 55 // ProfileKeyedServiceFactory | |
| 56 virtual ProfileKeyedService* BuildServiceInstanceFor( | |
| 57 Profile* profile) const OVERRIDE; | |
| 58 virtual bool ServiceIsCreatedWithProfile() OVERRIDE; | |
| 59 virtual bool ServiceIsNULLWhileTesting() OVERRIDE; | |
| 60 }; | |
| 61 | |
| 62 ShellWindowSet shell_windows_; | |
| 63 }; | |
| 64 | |
| 65 #endif // CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_REGISTRY_H_ | |
| OLD | NEW |