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_MANAGER_WEB_CONTENTS_TAGS_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_WEB_CONTENTS_TAGS_H_ |
6 #define CHROME_BROWSER_TASK_MANAGER_WEB_CONTENTS_TAGS_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_WEB_CONTENTS_TAGS_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "extensions/common/view_type.h" | 9 #include "extensions/common/view_type.h" |
10 | 10 |
11 class BackgroundContents; | 11 class BackgroundContents; |
12 class Panel; | |
13 | 12 |
14 namespace content { | 13 namespace content { |
15 class WebContents; | 14 class WebContents; |
16 } // namespace content | 15 } // namespace content |
17 | 16 |
18 namespace task_manager { | 17 namespace task_manager { |
19 | 18 |
20 // Defines a factory class for creating the TaskManager-specific Tags for the | 19 // Defines a factory class for creating the TaskManager-specific Tags for the |
21 // WebContents that are owned by various types of services. | 20 // WebContents that are owned by various types of services. |
22 // | 21 // |
(...skipping 25 matching lines...) Expand all Loading... |
48 // owned by |web_contents|. | 47 // owned by |web_contents|. |
49 static void CreateForPrerenderContents(content::WebContents* web_contents); | 48 static void CreateForPrerenderContents(content::WebContents* web_contents); |
50 | 49 |
51 // Tag a WebContents owned by the TabStripModel so that it shows up in the | 50 // Tag a WebContents owned by the TabStripModel so that it shows up in the |
52 // task manager. Calling this function creates a TabContentsTag, and attaches | 51 // task manager. Calling this function creates a TabContentsTag, and attaches |
53 // it to |web_contents|. If an instance is already attached, this does | 52 // it to |web_contents|. If an instance is already attached, this does |
54 // nothing. The resulting tag does not have to be cleaned up by the caller, as | 53 // nothing. The resulting tag does not have to be cleaned up by the caller, as |
55 // it is owned by |web_contents|. | 54 // it is owned by |web_contents|. |
56 static void CreateForTabContents(content::WebContents* web_contents); | 55 static void CreateForTabContents(content::WebContents* web_contents); |
57 | 56 |
58 // Tag a WebContents owned by a |panel| in the PanelManager so that it shows | |
59 // up in the task manager. Calling this function creates a PanelTag, and | |
60 // attaches it to |web_contents|. If an instance is already attached, this | |
61 // does nothing. The resulting tag does not have to be cleaned up by the | |
62 // caller, as it is owned by |web_contents|. | |
63 // Note: |web_contents| must be equal to |panel->GetWebContents()|. | |
64 static void CreateForPanel(content::WebContents* web_contents, Panel* panel); | |
65 | |
66 // Tag a WebContents created for a print preview or background printing so | 57 // Tag a WebContents created for a print preview or background printing so |
67 // that it shows up in the task manager. Calling this function creates a | 58 // that it shows up in the task manager. Calling this function creates a |
68 // PrintingTag, and attaches it to |web_contents|. If an instance is already | 59 // PrintingTag, and attaches it to |web_contents|. If an instance is already |
69 // attached, this does nothing. The resulting tag does not have to be cleaned | 60 // attached, this does nothing. The resulting tag does not have to be cleaned |
70 // up by the caller, as it is owned by |web_contents|. | 61 // up by the caller, as it is owned by |web_contents|. |
71 static void CreateForPrintingContents(content::WebContents* web_contents); | 62 static void CreateForPrintingContents(content::WebContents* web_contents); |
72 | 63 |
73 // Tag a WebContents owned by a GuestViewBase so that it shows up in the | 64 // Tag a WebContents owned by a GuestViewBase so that it shows up in the |
74 // task manager. Calling this function creates a GuestTag, and attaches it to | 65 // task manager. Calling this function creates a GuestTag, and attaches it to |
75 // |web_contents|. If an instance is already attached, this does nothing. The | 66 // |web_contents|. If an instance is already attached, this does nothing. The |
76 // resulting tag does not have to be cleaned up by the caller, as it is owned | 67 // resulting tag does not have to be cleaned up by the caller, as it is owned |
77 // by |web_contents|. | 68 // by |web_contents|. |
78 static void CreateForGuestContents(content::WebContents* web_contents); | 69 static void CreateForGuestContents(content::WebContents* web_contents); |
79 | 70 |
80 // Tag a WebContents that belongs to |extension| so that it shows up in the | 71 // Tag a WebContents that belongs to |extension| so that it shows up in the |
81 // task manager. Calling this function creates a ExtensionTag, and attaches | 72 // task manager. Calling this function creates a ExtensionTag, and attaches |
82 // it to |web_contents|. If an instance is already attached, this does | 73 // it to |web_contents|. If an instance is already attached, this does |
83 // nothing. The resulting tag does not have to be cleaned up by the caller, | 74 // nothing. The resulting tag does not have to be cleaned up by the caller, |
84 // as it is owned by |web_contents|. | 75 // as it is owned by |web_contents|. |
85 // |web_contents| must be of a non-tab, non-guest view, non-panel, or | 76 // |web_contents| must be of a non-tab, non-guest view, or |
86 // non-background contents Extension. | 77 // non-background contents Extension. |
87 static void CreateForExtension(content::WebContents* web_contents, | 78 static void CreateForExtension(content::WebContents* web_contents, |
88 extensions::ViewType view_type); | 79 extensions::ViewType view_type); |
89 | 80 |
90 // Clears the task-manager tag, created by any of the above functions, from | 81 // Clears the task-manager tag, created by any of the above functions, from |
91 // the given |web_contents| if any. | 82 // the given |web_contents| if any. |
92 // Clearing the tag is necessary only when you need to re-tag an existing | 83 // Clearing the tag is necessary only when you need to re-tag an existing |
93 // WebContents, to indicate a change in ownership. | 84 // WebContents, to indicate a change in ownership. |
94 static void ClearTag(content::WebContents* web_contents); | 85 static void ClearTag(content::WebContents* web_contents); |
95 | 86 |
96 private: | 87 private: |
97 DISALLOW_COPY_AND_ASSIGN(WebContentsTags); | 88 DISALLOW_COPY_AND_ASSIGN(WebContentsTags); |
98 }; | 89 }; |
99 | 90 |
100 } // namespace task_manager | 91 } // namespace task_manager |
101 | 92 |
102 #endif // CHROME_BROWSER_TASK_MANAGER_WEB_CONTENTS_TAGS_H_ | 93 #endif // CHROME_BROWSER_TASK_MANAGER_WEB_CONTENTS_TAGS_H_ |
OLD | NEW |