Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / task_manager / guest_resource_provider.h
blob17d390ad3b4a52439b8bc5409515b9161c2f03dc
1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_TASK_MANAGER_GUEST_RESOURCE_PROVIDER_H_
6 #define CHROME_BROWSER_TASK_MANAGER_GUEST_RESOURCE_PROVIDER_H_
8 #include <map>
10 #include "base/basictypes.h"
11 #include "chrome/browser/task_manager/resource_provider.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
15 class TaskManager;
17 namespace content {
18 class RenderViewHost;
21 namespace task_manager {
23 class GuestResource;
25 class GuestResourceProvider : public ResourceProvider,
26 public content::NotificationObserver {
27 public:
28 explicit GuestResourceProvider(TaskManager* task_manager);
30 // ResourceProvider methods:
31 virtual Resource* GetResource(int origin_pid,
32 int child_id,
33 int route_id) OVERRIDE;
34 virtual void StartUpdating() OVERRIDE;
35 virtual void StopUpdating() OVERRIDE;
37 // content::NotificationObserver method:
38 virtual void Observe(int type,
39 const content::NotificationSource& source,
40 const content::NotificationDetails& details) OVERRIDE;
42 private:
43 virtual ~GuestResourceProvider();
45 void Add(content::RenderViewHost* render_view_host);
46 void Remove(content::RenderViewHost* render_view_host);
48 // Whether we are currently reporting to the task manager. Used to ignore
49 // notifications sent after StopUpdating().
50 bool updating_;
52 TaskManager* task_manager_;
54 typedef std::map<content::RenderViewHost*, GuestResource*> GuestResourceMap;
55 GuestResourceMap resources_;
57 // A scoped container for notification registries.
58 content::NotificationRegistrar registrar_;
60 DISALLOW_COPY_AND_ASSIGN(GuestResourceProvider);
63 } // namespace task_manager
65 #endif // CHROME_BROWSER_TASK_MANAGER_GUEST_RESOURCE_PROVIDER_H_