| 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/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/favicon/favicon_tab_helper.h" | 11 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 11 #include "chrome/browser/prerender/prerender_manager.h" | 12 #include "chrome/browser/prerender/prerender_manager.h" |
| 12 #include "chrome/browser/prerender/prerender_manager_factory.h" | 13 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/browser/search/instant_service.h" | 16 #include "chrome/browser/search/instant_service.h" |
| 16 #include "chrome/browser/search/instant_service_factory.h" | 17 #include "chrome/browser/search/instant_service_factory.h" |
| 17 #include "chrome/browser/search/search.h" | 18 #include "chrome/browser/search/search.h" |
| 18 #include "chrome/browser/tab_contents/tab_util.h" | 19 #include "chrome/browser/tab_contents/tab_util.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 return l10n_util::GetStringFUTF16(message_id, tab_title); | 142 return l10n_util::GetStringFUTF16(message_id, tab_title); |
| 142 } | 143 } |
| 143 | 144 |
| 144 string16 TabContentsResource::GetProfileName() const { | 145 string16 TabContentsResource::GetProfileName() const { |
| 145 return util::GetProfileNameFromInfoCache(profile_); | 146 return util::GetProfileNameFromInfoCache(profile_); |
| 146 } | 147 } |
| 147 | 148 |
| 148 gfx::ImageSkia TabContentsResource::GetIcon() const { | 149 gfx::ImageSkia TabContentsResource::GetIcon() const { |
| 149 if (IsContentsPrerendering(web_contents_)) | 150 if (IsContentsPrerendering(web_contents_)) |
| 150 return *prerender_icon_; | 151 return *prerender_icon_; |
| 152 FaviconTabHelper::CreateForWebContents(web_contents_); |
| 151 return FaviconTabHelper::FromWebContents(web_contents_)-> | 153 return FaviconTabHelper::FromWebContents(web_contents_)-> |
| 152 GetFavicon().AsImageSkia(); | 154 GetFavicon().AsImageSkia(); |
| 153 } | 155 } |
| 154 | 156 |
| 155 WebContents* TabContentsResource::GetWebContents() const { | 157 WebContents* TabContentsResource::GetWebContents() const { |
| 156 return web_contents_; | 158 return web_contents_; |
| 157 } | 159 } |
| 158 | 160 |
| 159 const Extension* TabContentsResource::GetExtension() const { | 161 const Extension* TabContentsResource::GetExtension() const { |
| 160 if (HostsExtension()) { | 162 if (HostsExtension()) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 void TabContentsResourceProvider::Add(WebContents* web_contents) { | 286 void TabContentsResourceProvider::Add(WebContents* web_contents) { |
| 285 if (!updating_) | 287 if (!updating_) |
| 286 return; | 288 return; |
| 287 | 289 |
| 288 // The contents that are tracked by this resource provider are those that | 290 // The contents that are tracked by this resource provider are those that |
| 289 // are tab contents (WebContents serving as a tab in a Browser), Instant | 291 // are tab contents (WebContents serving as a tab in a Browser), Instant |
| 290 // pages, prerender pages, and background printed pages. | 292 // pages, prerender pages, and background printed pages. |
| 291 if (!chrome::FindBrowserWithWebContents(web_contents) && | 293 if (!chrome::FindBrowserWithWebContents(web_contents) && |
| 292 !IsContentsPrerendering(web_contents) && | 294 !IsContentsPrerendering(web_contents) && |
| 293 !chrome::IsPreloadedInstantExtendedNTP(web_contents) && | 295 !chrome::IsPreloadedInstantExtendedNTP(web_contents) && |
| 294 !IsContentsBackgroundPrinted(web_contents)) { | 296 !IsContentsBackgroundPrinted(web_contents) && |
| 297 !DevToolsWindow::IsDevToolsWindow(web_contents->GetRenderViewHost())) { |
| 295 return; | 298 return; |
| 296 } | 299 } |
| 297 | 300 |
| 298 // Don't add dead tabs or tabs that haven't yet connected. | 301 // Don't add dead tabs or tabs that haven't yet connected. |
| 299 if (!web_contents->GetRenderProcessHost()->GetHandle() || | 302 if (!web_contents->GetRenderProcessHost()->GetHandle() || |
| 300 !web_contents->WillNotifyDisconnection()) { | 303 !web_contents->WillNotifyDisconnection()) { |
| 301 return; | 304 return; |
| 302 } | 305 } |
| 303 | 306 |
| 304 if (resources_.count(web_contents)) { | 307 if (resources_.count(web_contents)) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 case content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED: | 353 case content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED: |
| 351 Remove(web_contents); | 354 Remove(web_contents); |
| 352 break; | 355 break; |
| 353 default: | 356 default: |
| 354 NOTREACHED() << "Unexpected notification."; | 357 NOTREACHED() << "Unexpected notification."; |
| 355 return; | 358 return; |
| 356 } | 359 } |
| 357 } | 360 } |
| 358 | 361 |
| 359 } // namespace task_manager | 362 } // namespace task_manager |
| OLD | NEW |