| OLD | NEW |
| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 void OnTasksRefreshed(const task_management::TaskIdList& task_ids) override {} | 37 void OnTasksRefreshed(const task_management::TaskIdList& task_ids) override {} |
| 38 void OnTasksRefreshedWithBackgroundCalculations( | 38 void OnTasksRefreshedWithBackgroundCalculations( |
| 39 const task_management::TaskIdList& task_ids) override; | 39 const task_management::TaskIdList& task_ids) override; |
| 40 void OnTaskUnresponsive(task_management::TaskId id) override; | 40 void OnTaskUnresponsive(task_management::TaskId id) override; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 friend class ::ProcessesApiTest; | 43 friend class ::ProcessesApiTest; |
| 44 | 44 |
| 45 void DispatchEvent(events::HistogramValue histogram_value, | 45 void DispatchEvent(events::HistogramValue histogram_value, |
| 46 const std::string& event_name, | 46 const std::string& event_name, |
| 47 scoped_ptr<base::ListValue> event_args) const; | 47 std::unique_ptr<base::ListValue> event_args) const; |
| 48 | 48 |
| 49 // Determines whether there is a registered listener for the specified event. | 49 // Determines whether there is a registered listener for the specified event. |
| 50 // It helps to avoid collecting data if no one is interested in it. | 50 // It helps to avoid collecting data if no one is interested in it. |
| 51 bool HasEventListeners(const std::string& event_name) const; | 51 bool HasEventListeners(const std::string& event_name) const; |
| 52 | 52 |
| 53 // Returns true if the task with the given |id| should be reported as created | 53 // Returns true if the task with the given |id| should be reported as created |
| 54 // or removed. |out_child_process_host_id| will be filled with the valid ID of | 54 // or removed. |out_child_process_host_id| will be filled with the valid ID of |
| 55 // the process to report in the event. | 55 // the process to report in the event. |
| 56 bool ShouldReportOnCreatedOrOnExited(task_management::TaskId id, | 56 bool ShouldReportOnCreatedOrOnExited(task_management::TaskId id, |
| 57 int* out_child_process_host_id) const; | 57 int* out_child_process_host_id) const; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 friend class BrowserContextKeyedAPIFactory<ProcessesAPI>; | 95 friend class BrowserContextKeyedAPIFactory<ProcessesAPI>; |
| 96 | 96 |
| 97 // BrowserContextKeyedAPI: | 97 // BrowserContextKeyedAPI: |
| 98 static const char* service_name() { return "ProcessesAPI"; } | 98 static const char* service_name() { return "ProcessesAPI"; } |
| 99 static const bool kServiceRedirectedInIncognito = true; | 99 static const bool kServiceRedirectedInIncognito = true; |
| 100 static const bool kServiceIsNULLWhileTesting = true; | 100 static const bool kServiceIsNULLWhileTesting = true; |
| 101 | 101 |
| 102 content::BrowserContext* browser_context_; | 102 content::BrowserContext* browser_context_; |
| 103 | 103 |
| 104 // Created lazily on first access. | 104 // Created lazily on first access. |
| 105 scoped_ptr<ProcessesEventRouter> processes_event_router_; | 105 std::unique_ptr<ProcessesEventRouter> processes_event_router_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(ProcessesAPI); | 107 DISALLOW_COPY_AND_ASSIGN(ProcessesAPI); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 //////////////////////////////////////////////////////////////////////////////// | 110 //////////////////////////////////////////////////////////////////////////////// |
| 111 // This extension function returns the Process object for the renderer process | 111 // This extension function returns the Process object for the renderer process |
| 112 // currently in use by the specified Tab. | 112 // currently in use by the specified Tab. |
| 113 class ProcessesGetProcessIdForTabFunction : public UIThreadExtensionFunction { | 113 class ProcessesGetProcessIdForTabFunction : public UIThreadExtensionFunction { |
| 114 public: | 114 public: |
| 115 // UIThreadExtensionFunction: | 115 // UIThreadExtensionFunction: |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // requested. | 187 // requested. |
| 188 void GatherDataAndRespond(const task_management::TaskIdList& task_ids); | 188 void GatherDataAndRespond(const task_management::TaskIdList& task_ids); |
| 189 | 189 |
| 190 std::vector<int> process_host_ids_; | 190 std::vector<int> process_host_ids_; |
| 191 bool include_memory_ = false; | 191 bool include_memory_ = false; |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 } // namespace extensions | 194 } // namespace extensions |
| 195 | 195 |
| 196 #endif // CHROME_BROWSER_EXTENSIONS_API_PROCESSES_PROCESSES_API_H__ | 196 #endif // CHROME_BROWSER_EXTENSIONS_API_PROCESSES_PROCESSES_API_H__ |
| OLD | NEW |