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

Side by Side Diff: chrome/browser/extensions/api/processes/processes_api.h

Issue 624153002: replace OVERRIDE and FINAL with override and final in chrome/browser/extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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_API_PROCESSES_PROCESSES_API_H__ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PROCESSES_PROCESSES_API_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_PROCESSES_PROCESSES_API_H__ 6 #define CHROME_BROWSER_EXTENSIONS_API_PROCESSES_PROCESSES_API_H__
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // out to the Task Manager to start listening for notifications. Returns 46 // out to the Task Manager to start listening for notifications. Returns
47 // true if this was the first call and false if this has already been called. 47 // true if this was the first call and false if this has already been called.
48 void StartTaskManagerListening(); 48 void StartTaskManagerListening();
49 49
50 bool is_task_manager_listening() { return task_manager_listening_; } 50 bool is_task_manager_listening() { return task_manager_listening_; }
51 51
52 private: 52 private:
53 // content::NotificationObserver implementation. 53 // content::NotificationObserver implementation.
54 virtual void Observe(int type, 54 virtual void Observe(int type,
55 const content::NotificationSource& source, 55 const content::NotificationSource& source,
56 const content::NotificationDetails& details) OVERRIDE; 56 const content::NotificationDetails& details) override;
57 57
58 // TaskManagerModelObserver methods. 58 // TaskManagerModelObserver methods.
59 virtual void OnItemsAdded(int start, int length) OVERRIDE; 59 virtual void OnItemsAdded(int start, int length) override;
60 virtual void OnModelChanged() OVERRIDE {} 60 virtual void OnModelChanged() override {}
61 virtual void OnItemsChanged(int start, int length) OVERRIDE; 61 virtual void OnItemsChanged(int start, int length) override;
62 virtual void OnItemsRemoved(int start, int length) OVERRIDE {} 62 virtual void OnItemsRemoved(int start, int length) override {}
63 virtual void OnItemsToBeRemoved(int start, int length) OVERRIDE; 63 virtual void OnItemsToBeRemoved(int start, int length) override;
64 64
65 // Internal helpers for processing notifications. 65 // Internal helpers for processing notifications.
66 void ProcessHangEvent(content::RenderWidgetHost* widget); 66 void ProcessHangEvent(content::RenderWidgetHost* widget);
67 void ProcessClosedEvent( 67 void ProcessClosedEvent(
68 content::RenderProcessHost* rph, 68 content::RenderProcessHost* rph,
69 content::RenderProcessHost::RendererClosedDetails* details); 69 content::RenderProcessHost::RendererClosedDetails* details);
70 70
71 void DispatchEvent(const std::string& event_name, 71 void DispatchEvent(const std::string& event_name,
72 scoped_ptr<base::ListValue> event_args); 72 scoped_ptr<base::ListValue> event_args);
73 73
(...skipping 20 matching lines...) Expand all
94 }; 94 };
95 95
96 // The profile-keyed service that manages the processes extension API. 96 // The profile-keyed service that manages the processes extension API.
97 class ProcessesAPI : public BrowserContextKeyedAPI, 97 class ProcessesAPI : public BrowserContextKeyedAPI,
98 public EventRouter::Observer { 98 public EventRouter::Observer {
99 public: 99 public:
100 explicit ProcessesAPI(content::BrowserContext* context); 100 explicit ProcessesAPI(content::BrowserContext* context);
101 virtual ~ProcessesAPI(); 101 virtual ~ProcessesAPI();
102 102
103 // KeyedService implementation. 103 // KeyedService implementation.
104 virtual void Shutdown() OVERRIDE; 104 virtual void Shutdown() override;
105 105
106 // BrowserContextKeyedAPI implementation. 106 // BrowserContextKeyedAPI implementation.
107 static BrowserContextKeyedAPIFactory<ProcessesAPI>* GetFactoryInstance(); 107 static BrowserContextKeyedAPIFactory<ProcessesAPI>* GetFactoryInstance();
108 108
109 // Convenience method to get the ProcessesAPI for a profile. 109 // Convenience method to get the ProcessesAPI for a profile.
110 static ProcessesAPI* Get(content::BrowserContext* context); 110 static ProcessesAPI* Get(content::BrowserContext* context);
111 111
112 ProcessesEventRouter* processes_event_router(); 112 ProcessesEventRouter* processes_event_router();
113 113
114 // EventRouter::Observer implementation. 114 // EventRouter::Observer implementation.
115 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; 115 virtual void OnListenerAdded(const EventListenerInfo& details) override;
116 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; 116 virtual void OnListenerRemoved(const EventListenerInfo& details) override;
117 117
118 private: 118 private:
119 friend class BrowserContextKeyedAPIFactory<ProcessesAPI>; 119 friend class BrowserContextKeyedAPIFactory<ProcessesAPI>;
120 120
121 content::BrowserContext* browser_context_; 121 content::BrowserContext* browser_context_;
122 122
123 // BrowserContextKeyedAPI implementation. 123 // BrowserContextKeyedAPI implementation.
124 static const char* service_name() { 124 static const char* service_name() {
125 return "ProcessesAPI"; 125 return "ProcessesAPI";
126 } 126 }
127 static const bool kServiceRedirectedInIncognito = true; 127 static const bool kServiceRedirectedInIncognito = true;
128 static const bool kServiceIsNULLWhileTesting = true; 128 static const bool kServiceIsNULLWhileTesting = true;
129 129
130 // Created lazily on first access. 130 // Created lazily on first access.
131 scoped_ptr<ProcessesEventRouter> processes_event_router_; 131 scoped_ptr<ProcessesEventRouter> processes_event_router_;
132 }; 132 };
133 133
134 // This extension function returns the Process object for the renderer process 134 // This extension function returns the Process object for the renderer process
135 // currently in use by the specified Tab. 135 // currently in use by the specified Tab.
136 class GetProcessIdForTabFunction : public ChromeAsyncExtensionFunction { 136 class GetProcessIdForTabFunction : public ChromeAsyncExtensionFunction {
137 public: 137 public:
138 GetProcessIdForTabFunction(); 138 GetProcessIdForTabFunction();
139 139
140 private: 140 private:
141 virtual ~GetProcessIdForTabFunction() {} 141 virtual ~GetProcessIdForTabFunction() {}
142 virtual bool RunAsync() OVERRIDE; 142 virtual bool RunAsync() override;
143 143
144 void GetProcessIdForTab(); 144 void GetProcessIdForTab();
145 145
146 // Storage for the tab ID parameter. 146 // Storage for the tab ID parameter.
147 int tab_id_; 147 int tab_id_;
148 148
149 DECLARE_EXTENSION_FUNCTION("processes.getProcessIdForTab", 149 DECLARE_EXTENSION_FUNCTION("processes.getProcessIdForTab",
150 PROCESSES_GETPROCESSIDFORTAB) 150 PROCESSES_GETPROCESSIDFORTAB)
151 }; 151 };
152 152
153 // Extension function that allows terminating Chrome subprocesses, by supplying 153 // Extension function that allows terminating Chrome subprocesses, by supplying
154 // the unique ID for the process coming from the ChildProcess ID pool. 154 // the unique ID for the process coming from the ChildProcess ID pool.
155 // Using unique IDs instead of OS process IDs allows two advantages: 155 // Using unique IDs instead of OS process IDs allows two advantages:
156 // * guaranteed uniqueness, since OS process IDs can be reused 156 // * guaranteed uniqueness, since OS process IDs can be reused
157 // * guards against killing non-Chrome processes 157 // * guards against killing non-Chrome processes
158 class TerminateFunction : public ChromeAsyncExtensionFunction { 158 class TerminateFunction : public ChromeAsyncExtensionFunction {
159 public: 159 public:
160 TerminateFunction(); 160 TerminateFunction();
161 161
162 private: 162 private:
163 virtual ~TerminateFunction() {} 163 virtual ~TerminateFunction() {}
164 virtual bool RunAsync() OVERRIDE; 164 virtual bool RunAsync() override;
165 165
166 void TerminateProcess(); 166 void TerminateProcess();
167 167
168 // Storage for the process ID parameter. 168 // Storage for the process ID parameter.
169 int process_id_; 169 int process_id_;
170 170
171 DECLARE_EXTENSION_FUNCTION("processes.terminate", 171 DECLARE_EXTENSION_FUNCTION("processes.terminate",
172 PROCESSES_TERMINATE) 172 PROCESSES_TERMINATE)
173 }; 173 };
174 174
175 // Extension function which returns a set of Process objects, containing the 175 // Extension function which returns a set of Process objects, containing the
176 // details corresponding to the process IDs supplied as input. 176 // details corresponding to the process IDs supplied as input.
177 class GetProcessInfoFunction : public ChromeAsyncExtensionFunction { 177 class GetProcessInfoFunction : public ChromeAsyncExtensionFunction {
178 public: 178 public:
179 GetProcessInfoFunction(); 179 GetProcessInfoFunction();
180 180
181 private: 181 private:
182 virtual ~GetProcessInfoFunction(); 182 virtual ~GetProcessInfoFunction();
183 virtual bool RunAsync() OVERRIDE; 183 virtual bool RunAsync() override;
184 184
185 void GatherProcessInfo(); 185 void GatherProcessInfo();
186 186
187 // Member variables to store the function parameters 187 // Member variables to store the function parameters
188 std::vector<int> process_ids_; 188 std::vector<int> process_ids_;
189 #if defined(ENABLE_TASK_MANAGER) 189 #if defined(ENABLE_TASK_MANAGER)
190 bool memory_; 190 bool memory_;
191 #endif 191 #endif
192 192
193 DECLARE_EXTENSION_FUNCTION("processes.getProcessInfo", 193 DECLARE_EXTENSION_FUNCTION("processes.getProcessInfo",
194 PROCESSES_GETPROCESSINFO) 194 PROCESSES_GETPROCESSINFO)
195 }; 195 };
196 196
197 } // namespace extensions 197 } // namespace extensions
198 198
199 #endif // CHROME_BROWSER_EXTENSIONS_API_PROCESSES_PROCESSES_API_H__ 199 #endif // CHROME_BROWSER_EXTENSIONS_API_PROCESSES_PROCESSES_API_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698