summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_processes_api.h
diff options
context:
space:
mode:
authorcreis@google.com <creis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-13 22:24:14 +0000
committercreis@google.com <creis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-13 22:24:14 +0000
commit6ec6313db465cf63b31344307df78f2baf394dce (patch)
tree6c8913551b5a1b85cd2712d0424030823644c51d /chrome/browser/extensions/extension_processes_api.h
parent0c328d95376293dac03e78bbe6bac625b5e9fdbb (diff)
downloadchromium_src-6ec6313db465cf63b31344307df78f2baf394dce.zip
chromium_src-6ec6313db465cf63b31344307df78f2baf394dce.tar.gz
chromium_src-6ec6313db465cf63b31344307df78f2baf394dce.tar.bz2
Revert 62458 - Expands the chrome.experimental.processes extension API.
Adds an onUpdated event that reports process metrics from the TaskManager, and modifies the TaskManager to support multiple independent observers. BUG=32302 TEST=ExtensionApiTest.Processes browsertest TEST=process_monitor sample extension Review URL: http://codereview.chromium.org/3597016 TBR=jrg@google.com git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62464 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_processes_api.h')
-rw-r--r--chrome/browser/extensions/extension_processes_api.h60
1 files changed, 1 insertions, 59 deletions
diff --git a/chrome/browser/extensions/extension_processes_api.h b/chrome/browser/extensions/extension_processes_api.h
index 497e0f6..b58cb56 100644
--- a/chrome/browser/extensions/extension_processes_api.h
+++ b/chrome/browser/extensions/extension_processes_api.h
@@ -6,72 +6,14 @@
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESSES_API_H__
#pragma once
-#include <set>
-#include <string>
-
#include "chrome/browser/extensions/extension_function.h"
-#include "chrome/browser/task_manager/task_manager.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-
-// Observes the Task Manager and routes the notifications as events to the
-// extension system.
-class ExtensionProcessesEventRouter : public TaskManagerModelObserver {
- public:
- // Single instance of the event router.
- static ExtensionProcessesEventRouter* GetInstance();
-
- // Safe to call multiple times.
- void ObserveProfile(Profile* profile);
-
- // Called when an extension process wants to listen to process events.
- void ListenerAdded();
-
- // Called when an extension process with a listener exits or removes it.
- void ListenerRemoved();
-
- private:
- friend struct DefaultSingletonTraits<ExtensionProcessesEventRouter>;
-
- ExtensionProcessesEventRouter();
- virtual ~ExtensionProcessesEventRouter();
-
- // TaskManagerModelObserver::OnModelChanged.
- virtual void OnModelChanged() {}
-
- // TaskManagerModelObserver::OnItemsChanged.
- virtual void OnItemsChanged(int start, int length);
-
- // TaskManagerModelObserver::OnItemsAdded.
- virtual void OnItemsAdded(int start, int length) {}
-
- // TaskManagerModelObserver::OnItemsRemoved.
- virtual void OnItemsRemoved(int start, int length) {}
-
- void DispatchEvent(Profile* profile,
- const char* event_name,
- const std::string& json_args);
-
- // Used for tracking registrations to process related notifications.
- NotificationRegistrar registrar_;
-
- // Registered profiles.
- typedef std::set<Profile*> ProfileSet;
- ProfileSet profiles_;
-
- // TaskManager to observe for updates.
- TaskManagerModel* model_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionProcessesEventRouter);
-};
-
// This extension function returns the Process object for the renderer process
// currently in use by the specified Tab.
class GetProcessForTabFunction : public SyncExtensionFunction {
virtual ~GetProcessForTabFunction() {}
virtual bool RunImpl();
- DECLARE_EXTENSION_FUNCTION_NAME("experimental.processes.getProcessIdForTab")
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.processes.getProcessForTab")
};
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESSES_API_H__