OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_manager/tab_contents_information.h" | 5 #include "chrome/browser/task_manager/tab_contents_information.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/devtools/devtools_window.h" | 10 #include "chrome/browser/devtools/devtools_window.h" |
11 #include "chrome/browser/extensions/extension_service.h" | |
12 #include "chrome/browser/favicon/favicon_tab_helper.h" | 11 #include "chrome/browser/favicon/favicon_tab_helper.h" |
13 #include "chrome/browser/prerender/prerender_manager.h" | 12 #include "chrome/browser/prerender/prerender_manager.h" |
14 #include "chrome/browser/prerender/prerender_manager_factory.h" | 13 #include "chrome/browser/prerender/prerender_manager_factory.h" |
15 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
17 #include "chrome/browser/task_manager/renderer_resource.h" | 16 #include "chrome/browser/task_manager/renderer_resource.h" |
18 #include "chrome/browser/task_manager/task_manager_util.h" | 17 #include "chrome/browser/task_manager/task_manager_util.h" |
19 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
20 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
21 #include "chrome/browser/ui/browser_iterator.h" | 20 #include "chrome/browser/ui/browser_iterator.h" |
22 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 21 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
23 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
24 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 24 #include "extensions/browser/extension_registry.h" |
25 #include "extensions/browser/process_map.h" | 25 #include "extensions/browser/process_map.h" |
26 #include "extensions/common/constants.h" | 26 #include "extensions/common/constants.h" |
| 27 #include "extensions/common/extension_set.h" |
27 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
28 #include "grit/theme_resources.h" | 29 #include "grit/theme_resources.h" |
29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
30 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
31 #include "ui/gfx/image/image_skia.h" | 32 #include "ui/gfx/image/image_skia.h" |
32 | 33 |
33 using content::WebContents; | 34 using content::WebContents; |
34 | 35 |
35 namespace task_manager { | 36 namespace task_manager { |
36 | 37 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 99 } |
99 | 100 |
100 base::string16 TabContentsResource::GetTitle() const { | 101 base::string16 TabContentsResource::GetTitle() const { |
101 // Fall back on the URL if there's no title. | 102 // Fall back on the URL if there's no title. |
102 GURL url = web_contents_->GetURL(); | 103 GURL url = web_contents_->GetURL(); |
103 base::string16 tab_title = util::GetTitleFromWebContents(web_contents_); | 104 base::string16 tab_title = util::GetTitleFromWebContents(web_contents_); |
104 | 105 |
105 // Only classify as an app if the URL is an app and the tab is hosting an | 106 // Only classify as an app if the URL is an app and the tab is hosting an |
106 // extension process. (It's possible to be showing the URL from before it | 107 // extension process. (It's possible to be showing the URL from before it |
107 // was installed as an app.) | 108 // was installed as an app.) |
108 ExtensionService* extension_service = profile_->GetExtensionService(); | |
109 extensions::ProcessMap* process_map = extensions::ProcessMap::Get(profile_); | 109 extensions::ProcessMap* process_map = extensions::ProcessMap::Get(profile_); |
110 bool is_app = extension_service->IsInstalledApp(url) && | 110 bool is_app = |
| 111 extensions::ExtensionRegistry::Get(profile_) |
| 112 ->enabled_extensions().GetAppByURL(url) != NULL && |
111 process_map->Contains(web_contents_->GetRenderProcessHost()->GetID()); | 113 process_map->Contains(web_contents_->GetRenderProcessHost()->GetID()); |
112 | 114 |
113 int message_id = util::GetMessagePrefixID( | 115 int message_id = util::GetMessagePrefixID( |
114 is_app, | 116 is_app, |
115 HostsExtension(), | 117 HostsExtension(), |
116 profile_->IsOffTheRecord(), | 118 profile_->IsOffTheRecord(), |
117 IsContentsPrerendering(web_contents_), | 119 IsContentsPrerendering(web_contents_), |
118 false); // is_background | 120 false); // is_background |
119 return l10n_util::GetStringFUTF16(message_id, tab_title); | 121 return l10n_util::GetStringFUTF16(message_id, tab_title); |
120 } | 122 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 169 } |
168 } | 170 } |
169 } | 171 } |
170 | 172 |
171 scoped_ptr<RendererResource> TabContentsInformation::MakeResource( | 173 scoped_ptr<RendererResource> TabContentsInformation::MakeResource( |
172 content::WebContents* web_contents) { | 174 content::WebContents* web_contents) { |
173 return scoped_ptr<RendererResource>(new TabContentsResource(web_contents)); | 175 return scoped_ptr<RendererResource>(new TabContentsResource(web_contents)); |
174 } | 176 } |
175 | 177 |
176 } // namespace task_manager | 178 } // namespace task_manager |
OLD | NEW |