OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_WEB_CONTENTS_TAGS_
MANAGER_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_WEB_CONTENTS_TAGS_
MANAGER_H_ |
6 #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_WEB_CONTENTS_TAGS_
MANAGER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_WEB_CONTENTS_TAGS_
MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "chrome/browser/task_management/providers/web_contents/web_contents_tag
.h" | 10 #include "chrome/browser/task_management/providers/web_contents/web_contents_tag
.h" |
11 | 11 |
| 12 namespace base { |
12 template<typename T> | 13 template<typename T> |
13 struct DefaultSingletonTraits; | 14 struct DefaultSingletonTraits; |
| 15 } // namespace base |
14 | 16 |
15 namespace task_management { | 17 namespace task_management { |
16 | 18 |
17 class WebContentsTaskProvider; | 19 class WebContentsTaskProvider; |
18 | 20 |
19 // Defines a manager to track the various TaskManager-specific WebContents | 21 // Defines a manager to track the various TaskManager-specific WebContents |
20 // UserData (task_management::WebContentsTags). This is used by the | 22 // UserData (task_management::WebContentsTags). This is used by the |
21 // WebContentsTaskProvider to get all the pre-existing WebContents once | 23 // WebContentsTaskProvider to get all the pre-existing WebContents once |
22 // WebContentsTaskProvider::StartUpdating() is called. | 24 // WebContentsTaskProvider::StartUpdating() is called. |
23 class WebContentsTagsManager { | 25 class WebContentsTagsManager { |
(...skipping 13 matching lines...) Expand all Loading... |
37 // whose destruction does not correspond to the destruction of their | 39 // whose destruction does not correspond to the destruction of their |
38 // WebContents. In this case the provider (if any) must be manually cleared, | 40 // WebContents. In this case the provider (if any) must be manually cleared, |
39 // or else the corresponding task for the |tag| will continue to exist. | 41 // or else the corresponding task for the |tag| will continue to exist. |
40 void ClearFromProvider(const WebContentsTag* tag); | 42 void ClearFromProvider(const WebContentsTag* tag); |
41 | 43 |
42 const std::vector<WebContentsTag*>& tracked_tags() const { | 44 const std::vector<WebContentsTag*>& tracked_tags() const { |
43 return tracked_tags_; | 45 return tracked_tags_; |
44 } | 46 } |
45 | 47 |
46 private: | 48 private: |
47 friend struct DefaultSingletonTraits<WebContentsTagsManager>; | 49 friend struct base::DefaultSingletonTraits<WebContentsTagsManager>; |
48 | 50 |
49 WebContentsTagsManager(); | 51 WebContentsTagsManager(); |
50 ~WebContentsTagsManager(); | 52 ~WebContentsTagsManager(); |
51 | 53 |
52 // The provider that's currently observing the creation of WebContents. | 54 // The provider that's currently observing the creation of WebContents. |
53 WebContentsTaskProvider* provider_; | 55 WebContentsTaskProvider* provider_; |
54 | 56 |
55 // A set of all the WebContentsTags seen so far. | 57 // A set of all the WebContentsTags seen so far. |
56 std::vector<WebContentsTag*> tracked_tags_; | 58 std::vector<WebContentsTag*> tracked_tags_; |
57 | 59 |
58 DISALLOW_COPY_AND_ASSIGN(WebContentsTagsManager); | 60 DISALLOW_COPY_AND_ASSIGN(WebContentsTagsManager); |
59 }; | 61 }; |
60 | 62 |
61 } // namespace task_management | 63 } // namespace task_management |
62 | 64 |
63 | 65 |
64 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_WEB_CONTENTS_TA
GS_MANAGER_H_ | 66 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_WEB_CONTENTS_TA
GS_MANAGER_H_ |
OLD | NEW |