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 #include "chrome/browser/task_management/providers/web_contents/tab_contents_tas
k.h" | 5 #include "chrome/browser/task_management/providers/web_contents/tab_contents_tas
k.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "extensions/browser/extension_registry.h" | 10 #include "extensions/browser/extension_registry.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 base::string16 TabContentsTask::GetCurrentTitle() const { | 53 base::string16 TabContentsTask::GetCurrentTitle() const { |
54 // Check if the URL is an app and if the tab is hoisting an extension. | 54 // Check if the URL is an app and if the tab is hoisting an extension. |
55 Profile* profile = | 55 Profile* profile = |
56 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 56 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
57 extensions::ProcessMap* process_map = extensions::ProcessMap::Get(profile); | 57 extensions::ProcessMap* process_map = extensions::ProcessMap::Get(profile); |
58 extensions::ExtensionRegistry* extension_registry = | 58 extensions::ExtensionRegistry* extension_registry = |
59 extensions::ExtensionRegistry::Get(profile); | 59 extensions::ExtensionRegistry::Get(profile); |
60 GURL url = web_contents()->GetURL(); | 60 GURL url = web_contents()->GetURL(); |
61 | 61 |
62 bool is_app = process_map->Contains(process_id()) && | 62 bool is_app = process_map->Contains(GetChildProcessUniqueID()) && |
63 extension_registry->enabled_extensions().GetAppByURL(url) != nullptr; | 63 extension_registry->enabled_extensions().GetAppByURL(url) != nullptr; |
64 bool is_extension = HostsExtension(web_contents()); | 64 bool is_extension = HostsExtension(web_contents()); |
65 bool is_incognito = profile->IsOffTheRecord(); | 65 bool is_incognito = profile->IsOffTheRecord(); |
66 | 66 |
67 base::string16 tab_title = | 67 base::string16 tab_title = |
68 RendererTask::GetTitleFromWebContents(web_contents()); | 68 RendererTask::GetTitleFromWebContents(web_contents()); |
69 | 69 |
70 // Fall back to the URL if the title is empty. | 70 // Fall back to the URL if the title is empty. |
71 return PrefixRendererTitle(tab_title, | 71 return PrefixRendererTitle(tab_title, |
72 is_app, | 72 is_app, |
73 is_extension, | 73 is_extension, |
74 is_incognito, | 74 is_incognito, |
75 false); // is_background. | 75 false); // is_background. |
76 } | 76 } |
77 | 77 |
78 } // namespace task_management | 78 } // namespace task_management |
OLD | NEW |