OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_resource_provider.h" | 5 #include "chrome/browser/task_manager/tab_contents_resource_provider.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/devtools/devtools_window.h" | 9 #include "chrome/browser/devtools/devtools_window.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/task_manager/task_manager.h" | 22 #include "chrome/browser/task_manager/task_manager.h" |
23 #include "chrome/browser/task_manager/task_manager_util.h" | 23 #include "chrome/browser/task_manager/task_manager_util.h" |
24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/browser/ui/browser_finder.h" | 25 #include "chrome/browser/ui/browser_finder.h" |
26 #include "chrome/browser/ui/browser_iterator.h" | 26 #include "chrome/browser/ui/browser_iterator.h" |
27 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 27 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/render_frame_host.h" | 29 #include "content/public/browser/render_frame_host.h" |
30 #include "content/public/browser/render_process_host.h" | 30 #include "content/public/browser/render_process_host.h" |
31 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| 32 #include "extensions/browser/process_map.h" |
32 #include "extensions/common/constants.h" | 33 #include "extensions/common/constants.h" |
33 #include "grit/theme_resources.h" | 34 #include "grit/theme_resources.h" |
34 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
35 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
36 #include "ui/gfx/image/image_skia.h" | 37 #include "ui/gfx/image/image_skia.h" |
37 | 38 |
38 #if defined(ENABLE_FULL_PRINTING) | 39 #if defined(ENABLE_FULL_PRINTING) |
39 #include "chrome/browser/printing/background_printing_manager.h" | 40 #include "chrome/browser/printing/background_printing_manager.h" |
40 #endif | 41 #endif |
41 | 42 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 123 |
123 base::string16 TabContentsResource::GetTitle() const { | 124 base::string16 TabContentsResource::GetTitle() const { |
124 // Fall back on the URL if there's no title. | 125 // Fall back on the URL if there's no title. |
125 GURL url = web_contents_->GetURL(); | 126 GURL url = web_contents_->GetURL(); |
126 base::string16 tab_title = util::GetTitleFromWebContents(web_contents_); | 127 base::string16 tab_title = util::GetTitleFromWebContents(web_contents_); |
127 | 128 |
128 // Only classify as an app if the URL is an app and the tab is hosting an | 129 // Only classify as an app if the URL is an app and the tab is hosting an |
129 // extension process. (It's possible to be showing the URL from before it | 130 // extension process. (It's possible to be showing the URL from before it |
130 // was installed as an app.) | 131 // was installed as an app.) |
131 ExtensionService* extension_service = profile_->GetExtensionService(); | 132 ExtensionService* extension_service = profile_->GetExtensionService(); |
132 extensions::ProcessMap* process_map = extension_service->process_map(); | 133 extensions::ProcessMap* process_map = extensions::ProcessMap::Get(profile_); |
133 bool is_app = extension_service->IsInstalledApp(url) && | 134 bool is_app = extension_service->IsInstalledApp(url) && |
134 process_map->Contains(web_contents_->GetRenderProcessHost()->GetID()); | 135 process_map->Contains(web_contents_->GetRenderProcessHost()->GetID()); |
135 | 136 |
136 int message_id = util::GetMessagePrefixID( | 137 int message_id = util::GetMessagePrefixID( |
137 is_app, | 138 is_app, |
138 HostsExtension(), | 139 HostsExtension(), |
139 profile_->IsOffTheRecord(), | 140 profile_->IsOffTheRecord(), |
140 IsContentsPrerendering(web_contents_), | 141 IsContentsPrerendering(web_contents_), |
141 is_instant_ntp_, | 142 is_instant_ntp_, |
142 false); // is_background | 143 false); // is_background |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 case content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED: | 362 case content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED: |
362 Remove(web_contents); | 363 Remove(web_contents); |
363 break; | 364 break; |
364 default: | 365 default: |
365 NOTREACHED() << "Unexpected notification."; | 366 NOTREACHED() << "Unexpected notification."; |
366 return; | 367 return; |
367 } | 368 } |
368 } | 369 } |
369 | 370 |
370 } // namespace task_manager | 371 } // namespace task_manager |
OLD | NEW |