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

Side by Side Diff: chrome/browser/task_manager/task_manager_background_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_BACKGROUND_RESOURCE_PROVIDER_H_
6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_BACKGROUND_RESOURCE_PROVIDER_H_
7
8 #include <map>
9
10 #include "base/basictypes.h"
11 #include "base/string16.h"
12 #include "chrome/browser/task_manager/task_manager.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
15
16 class BackgroundContents;
17 class TaskManagerBackgroundContentsResource;
18
19 class TaskManagerBackgroundContentsResourceProvider
20 : public TaskManager::ResourceProvider,
21 public content::NotificationObserver {
22 public:
23 explicit TaskManagerBackgroundContentsResourceProvider(
24 TaskManager* task_manager);
25
26 virtual TaskManager::Resource* GetResource(int origin_pid,
27 int render_process_host_id,
28 int routing_id) OVERRIDE;
29 virtual void StartUpdating() OVERRIDE;
30 virtual void StopUpdating() OVERRIDE;
31
32 // content::NotificationObserver method:
33 virtual void Observe(int type,
34 const content::NotificationSource& source,
35 const content::NotificationDetails& details) OVERRIDE;
36
37 private:
38 virtual ~TaskManagerBackgroundContentsResourceProvider();
39
40 void Add(BackgroundContents* background_contents, const string16& title);
41 void Remove(BackgroundContents* background_contents);
42
43 void AddToTaskManager(BackgroundContents* background_contents,
44 const string16& title);
45
46 // Whether we are currently reporting to the task manager. Used to ignore
47 // notifications sent after StopUpdating().
48 bool updating_;
49
50 TaskManager* task_manager_;
51
52 // Maps the actual resources (the BackgroundContents) to the Task Manager
53 // resources.
54 typedef std::map<BackgroundContents*, TaskManagerBackgroundContentsResource*>
55 Resources;
56 Resources resources_;
57
58 // A scoped container for notification registries.
59 content::NotificationRegistrar registrar_;
60
61 DISALLOW_COPY_AND_ASSIGN(TaskManagerBackgroundContentsResourceProvider);
62 };
63
64 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_BACKGROUND_RESOURCE_PROVIDER _H_
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/task_manager.cc ('k') | chrome/browser/task_manager/task_manager_background_resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698