Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: chrome/browser/extensions/platform_app_registry.h

Issue 10119003: Pull shell window stuff out of ExtensionHost and put in ShellWindow (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
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 virtual ~PlatformAppRegistry();
32
33 // Returns the instance for the given profile, or NULL if none. This is
34 // a convenience wrapper around PlatformAppRegistryFactory::GetForProfile.
35 static PlatformAppRegistry* Get(Profile* profile);
36
37 void AddShellWindow(ShellWindow* shell_window);
38 void RemoveShellWindow(ShellWindow* shell_window);
39
40 const ShellWindowSet& shell_windows() const { return shell_windows_; }
41
42 private:
43 class Factory : public ProfileKeyedServiceFactory {
44 public:
45 static PlatformAppRegistry* GetForProfile(Profile* profile);
46
47 static Factory* GetInstance();
48 private:
49 friend struct DefaultSingletonTraits<Factory>;
50
51 Factory();
52 virtual ~Factory();
53
54 // ProfileKeyedServiceFactory
55 virtual ProfileKeyedService* BuildServiceInstanceFor(
56 Profile* profile) const OVERRIDE;
57 virtual bool ServiceIsCreatedWithProfile() OVERRIDE;
58 virtual bool ServiceIsNULLWhileTesting() OVERRIDE;
59 };
60
61 ShellWindowSet shell_windows_;
62 };
63
64 #endif // CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698