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

Side by Side Diff: chrome/browser/task_manager/task_manager_tab_contents_resource_provider.h

Issue 15196003: Create task_manager namespace and wrap classes related to TaskManager with it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_TAB_CONTENTS_RESOURCE_PROVIDER_ H_
6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_TAB_CONTENTS_RESOURCE_PROVIDER_ H_
7
8 #include <map>
9
10 #include "base/basictypes.h"
11 #include "chrome/browser/task_manager/task_manager.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14
15 class TaskManager;
16 class TaskManagerTabContentsResource;
17
18 namespace content {
19 class WebContents;
20 class NotificationSource;
21 class NotificationDetails;
22 }
23
24 // Provides resources for tab contents, prerendered pages, Instant pages, and
25 // background printing pages.
26 class TaskManagerTabContentsResourceProvider
27 : public TaskManager::ResourceProvider,
28 public content::NotificationObserver {
29 public:
30 explicit TaskManagerTabContentsResourceProvider(TaskManager* task_manager);
31
32 virtual TaskManager::Resource* GetResource(int origin_pid,
33 int render_process_host_id,
34 int routing_id) OVERRIDE;
35 virtual void StartUpdating() OVERRIDE;
36 virtual void StopUpdating() OVERRIDE;
37
38 // content::NotificationObserver method:
39 virtual void Observe(int type,
40 const content::NotificationSource& source,
41 const content::NotificationDetails& details) OVERRIDE;
42
43 private:
44 virtual ~TaskManagerTabContentsResourceProvider();
45
46 void Add(content::WebContents* web_contents);
47 void Remove(content::WebContents* web_contents);
48 void InstantCommitted(content::WebContents* web_contents);
49
50 void AddToTaskManager(content::WebContents* web_contents);
51
52 // Whether we are currently reporting to the task manager. Used to ignore
53 // notifications sent after StopUpdating().
54 bool updating_;
55
56 TaskManager* task_manager_;
57
58 // Maps the actual resources (the WebContentses) to the Task Manager
59 // resources.
60 std::map<content::WebContents*, TaskManagerTabContentsResource*> resources_;
61
62 // A scoped container for notification registries.
63 content::NotificationRegistrar registrar_;
64
65 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResourceProvider);
66 };
67
68 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_TAB_CONTENTS_RESOURCE_PROVID ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698