| Index: chrome/browser/task_management/web_contents_tags.cc
|
| diff --git a/chrome/browser/task_management/web_contents_tags.cc b/chrome/browser/task_management/web_contents_tags.cc
|
| index 72adce102c83a93e14b75775f06e336198bc5fbe..9371a0d044e0b9f9067871111a4ce9c180b8b8ce 100644
|
| --- a/chrome/browser/task_management/web_contents_tags.cc
|
| +++ b/chrome/browser/task_management/web_contents_tags.cc
|
| @@ -6,11 +6,13 @@
|
|
|
| #include "chrome/browser/task_management/providers/web_contents/background_contents_tag.h"
|
| #include "chrome/browser/task_management/providers/web_contents/devtools_tag.h"
|
| +#include "chrome/browser/task_management/providers/web_contents/prerender_tag.h"
|
| #include "chrome/browser/task_management/providers/web_contents/web_contents_tags_manager.h"
|
| #include "content/public/browser/web_contents.h"
|
|
|
| namespace task_management {
|
|
|
| +#if defined(ENABLE_TASK_MANAGER)
|
| namespace {
|
|
|
| // Adds the |tag| to |contents|. It also adds the |tag| to the
|
| @@ -27,27 +29,53 @@ void TagWebContents(content::WebContents* contents,
|
| }
|
|
|
| } // namespace
|
| +#endif // defined(ENABLE_TASK_MANAGER)
|
|
|
| // static
|
| void WebContentsTags::CreateForBackgroundContents(
|
| content::WebContents* web_contents,
|
| BackgroundContents* background_contents) {
|
| +#if defined(ENABLE_TASK_MANAGER)
|
| if (!WebContentsTag::FromWebContents(web_contents)) {
|
| TagWebContents(
|
| web_contents,
|
| new BackgroundContentsTag(web_contents, background_contents),
|
| WebContentsTag::kTagKey);
|
| }
|
| +#endif // defined(ENABLE_TASK_MANAGER)
|
| }
|
|
|
| // static
|
| void WebContentsTags::CreateForDevToolsContents(
|
| content::WebContents* web_contents) {
|
| +#if defined(ENABLE_TASK_MANAGER)
|
| if (!WebContentsTag::FromWebContents(web_contents)) {
|
| TagWebContents(web_contents,
|
| new DevToolsTag(web_contents),
|
| WebContentsTag::kTagKey);
|
| }
|
| +#endif // defined(ENABLE_TASK_MANAGER)
|
| +}
|
| +
|
| +// static
|
| +void WebContentsTags::CreateForPrerenderContents(
|
| + content::WebContents* web_contents) {
|
| +#if defined(ENABLE_TASK_MANAGER)
|
| + if (!WebContentsTag::FromWebContents(web_contents)) {
|
| + TagWebContents(web_contents,
|
| + new PrerenderTag(web_contents),
|
| + WebContentsTag::kTagKey);
|
| + }
|
| +#endif // defined(ENABLE_TASK_MANAGER)
|
| +}
|
| +
|
| +// static
|
| +void WebContentsTags::ClearTag(content::WebContents* web_contents) {
|
| +#if defined(ENABLE_TASK_MANAGER)
|
| + const WebContentsTag* tag = WebContentsTag::FromWebContents(web_contents);
|
| + WebContentsTagsManager::GetInstance()->ClearFromProvider(tag);
|
| + web_contents->RemoveUserData(WebContentsTag::kTagKey);
|
| +#endif // defined(ENABLE_TASK_MANAGER)
|
| }
|
|
|
| } // namespace task_management
|
|
|