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

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

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_REGISTRY_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_REGISTRY_H_
6 #define CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_REGISTRY_H_ 6 #define CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_REGISTRY_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 14 matching lines...) Expand all
25 25
26 namespace extensions { 26 namespace extensions {
27 27
28 // The ShellWindowRegistry tracks the ShellWindows for all platform apps for a 28 // The ShellWindowRegistry tracks the ShellWindows for all platform apps for a
29 // particular profile. 29 // particular profile.
30 // This class is planned to evolve into tracking all PlatformApps for a 30 // This class is planned to evolve into tracking all PlatformApps for a
31 // particular profile, with a PlatformApp encapsulating all views (background 31 // particular profile, with a PlatformApp encapsulating all views (background
32 // page, shell windows, tray view, panels etc.) and other app level behaviour 32 // page, shell windows, tray view, panels etc.) and other app level behaviour
33 // (e.g. notifications the app is interested in, lifetime of the background 33 // (e.g. notifications the app is interested in, lifetime of the background
34 // page). 34 // page).
35 class ShellWindowRegistry : public ProfileKeyedService { 35 class ShellWindowRegistry : public BrowserContextKeyedService {
36 public: 36 public:
37 class Observer { 37 class Observer {
38 public: 38 public:
39 // Called just after a shell window was added. 39 // Called just after a shell window was added.
40 virtual void OnShellWindowAdded(ShellWindow* shell_window) = 0; 40 virtual void OnShellWindowAdded(ShellWindow* shell_window) = 0;
41 // Called when the window icon changes. 41 // Called when the window icon changes.
42 virtual void OnShellWindowIconChanged(ShellWindow* shell_window) = 0; 42 virtual void OnShellWindowIconChanged(ShellWindow* shell_window) = 0;
43 // Called just after a shell window was removed. 43 // Called just after a shell window was removed.
44 virtual void OnShellWindowRemoved(ShellWindow* shell_window) = 0; 44 virtual void OnShellWindowRemoved(ShellWindow* shell_window) = 0;
45 45
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 // Returns the shell window for |window|, looking in all profiles. 92 // Returns the shell window for |window|, looking in all profiles.
93 static ShellWindow* GetShellWindowForNativeWindowAnyProfile( 93 static ShellWindow* GetShellWindowForNativeWindowAnyProfile(
94 gfx::NativeWindow window); 94 gfx::NativeWindow window);
95 95
96 // Returns true if the number of shell windows registered across all profiles 96 // Returns true if the number of shell windows registered across all profiles
97 // is non-zero. |window_type_mask| is a bitwise OR filter of 97 // is non-zero. |window_type_mask| is a bitwise OR filter of
98 // ShellWindow::WindowType, or 0 for any window type. 98 // ShellWindow::WindowType, or 0 for any window type.
99 static bool IsShellWindowRegisteredInAnyProfile(int window_type_mask); 99 static bool IsShellWindowRegisteredInAnyProfile(int window_type_mask);
100 100
101 class Factory : public ProfileKeyedServiceFactory { 101 class Factory : public BrowserContextKeyedServiceFactory {
102 public: 102 public:
103 static ShellWindowRegistry* GetForProfile(Profile* profile, bool create); 103 static ShellWindowRegistry* GetForProfile(Profile* profile, bool create);
104 104
105 static Factory* GetInstance(); 105 static Factory* GetInstance();
106 private: 106 private:
107 friend struct DefaultSingletonTraits<Factory>; 107 friend struct DefaultSingletonTraits<Factory>;
108 108
109 Factory(); 109 Factory();
110 virtual ~Factory(); 110 virtual ~Factory();
111 111
112 // ProfileKeyedServiceFactory 112 // BrowserContextKeyedServiceFactory
113 virtual ProfileKeyedService* BuildServiceInstanceFor( 113 virtual BrowserContextKeyedService* BuildServiceInstanceFor(
114 content::BrowserContext* profile) const OVERRIDE; 114 content::BrowserContext* profile) const OVERRIDE;
115 virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; 115 virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
116 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; 116 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
117 virtual content::BrowserContext* GetBrowserContextToUse( 117 virtual content::BrowserContext* GetBrowserContextToUse(
118 content::BrowserContext* context) const OVERRIDE; 118 content::BrowserContext* context) const OVERRIDE;
119 }; 119 };
120 120
121 protected: 121 protected:
122 void OnDevToolsStateChanged(content::DevToolsAgentHost*, bool attached); 122 void OnDevToolsStateChanged(content::DevToolsAgentHost*, bool attached);
123 123
124 private: 124 private:
125 Profile* profile_; 125 Profile* profile_;
126 ShellWindowSet shell_windows_; 126 ShellWindowSet shell_windows_;
127 InspectedWindowSet inspected_windows_; 127 InspectedWindowSet inspected_windows_;
128 ObserverList<Observer> observers_; 128 ObserverList<Observer> observers_;
129 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; 129 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_;
130 }; 130 };
131 131
132 } // namespace extensions 132 } // namespace extensions
133 133
134 #endif // CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_REGISTRY_H_ 134 #endif // CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698