OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/task_manager_resource_providers.h" | 5 #include "chrome/browser/task_manager/task_manager_resource_providers.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "chrome/browser/ui/browser_list.h" | 35 #include "chrome/browser/ui/browser_list.h" |
36 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 36 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
37 #include "chrome/common/chrome_notification_types.h" | 37 #include "chrome/common/chrome_notification_types.h" |
38 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
39 #include "chrome/common/chrome_view_types.h" | 39 #include "chrome/common/chrome_view_types.h" |
40 #include "chrome/common/extensions/extension.h" | 40 #include "chrome/common/extensions/extension.h" |
41 #include "chrome/common/render_messages.h" | 41 #include "chrome/common/render_messages.h" |
42 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
43 #include "content/browser/browser_child_process_host.h" | 43 #include "content/browser/browser_child_process_host.h" |
44 #include "content/browser/renderer_host/render_message_filter.h" | 44 #include "content/browser/renderer_host/render_message_filter.h" |
45 #include "content/browser/renderer_host/render_process_host.h" | |
46 #include "content/browser/renderer_host/render_view_host.h" | 45 #include "content/browser/renderer_host/render_view_host.h" |
47 #include "content/browser/tab_contents/tab_contents.h" | 46 #include "content/browser/tab_contents/tab_contents.h" |
48 #include "content/public/browser/browser_thread.h" | 47 #include "content/public/browser/browser_thread.h" |
49 #include "content/public/browser/notification_service.h" | 48 #include "content/public/browser/notification_service.h" |
| 49 #include "content/public/browser/render_process_host.h" |
50 #include "grit/generated_resources.h" | 50 #include "grit/generated_resources.h" |
51 #include "grit/theme_resources.h" | 51 #include "grit/theme_resources.h" |
52 #include "grit/theme_resources_standard.h" | 52 #include "grit/theme_resources_standard.h" |
53 #include "third_party/sqlite/sqlite3.h" | 53 #include "third_party/sqlite/sqlite3.h" |
54 #include "ui/base/l10n/l10n_util.h" | 54 #include "ui/base/l10n/l10n_util.h" |
55 #include "ui/base/resource/resource_bundle.h" | 55 #include "ui/base/resource/resource_bundle.h" |
56 #include "v8/include/v8.h" | 56 #include "v8/include/v8.h" |
57 | 57 |
58 #if defined(OS_MACOSX) | 58 #if defined(OS_MACOSX) |
59 #include "skia/ext/skia_utils_mac.h" | 59 #include "skia/ext/skia_utils_mac.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 base::i18n::AdjustStringForLocaleDirection(&tab_title); | 265 base::i18n::AdjustStringForLocaleDirection(&tab_title); |
266 } | 266 } |
267 | 267 |
268 // Only classify as an app if the URL is an app and the tab is hosting an | 268 // Only classify as an app if the URL is an app and the tab is hosting an |
269 // extension process. (It's possible to be showing the URL from before it | 269 // extension process. (It's possible to be showing the URL from before it |
270 // was installed as an app.) | 270 // was installed as an app.) |
271 ExtensionService* extension_service = | 271 ExtensionService* extension_service = |
272 tab_contents_->profile()->GetExtensionService(); | 272 tab_contents_->profile()->GetExtensionService(); |
273 extensions::ProcessMap* process_map = extension_service->process_map(); | 273 extensions::ProcessMap* process_map = extension_service->process_map(); |
274 bool is_app = extension_service->IsInstalledApp(url) && | 274 bool is_app = extension_service->IsInstalledApp(url) && |
275 process_map->Contains(contents->GetRenderProcessHost()->id()); | 275 process_map->Contains(contents->GetRenderProcessHost()->GetID()); |
276 | 276 |
277 int message_id = GetMessagePrefixID( | 277 int message_id = GetMessagePrefixID( |
278 is_app, | 278 is_app, |
279 HostsExtension(), | 279 HostsExtension(), |
280 tab_contents_->profile()->IsOffTheRecord(), | 280 tab_contents_->profile()->IsOffTheRecord(), |
281 IsPrerendering()); | 281 IsPrerendering()); |
282 return l10n_util::GetStringFUTF16(message_id, tab_title); | 282 return l10n_util::GetStringFUTF16(message_id, tab_title); |
283 } | 283 } |
284 | 284 |
285 string16 TaskManagerTabContentsResource::GetProfileName() const { | 285 string16 TaskManagerTabContentsResource::GetProfileName() const { |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 int origin_pid, | 560 int origin_pid, |
561 int render_process_host_id, | 561 int render_process_host_id, |
562 int routing_id) { | 562 int routing_id) { |
563 // If an origin PID was specified, the request is from a plugin, not the | 563 // If an origin PID was specified, the request is from a plugin, not the |
564 // render view host process | 564 // render view host process |
565 if (origin_pid) | 565 if (origin_pid) |
566 return NULL; | 566 return NULL; |
567 | 567 |
568 for (Resources::iterator i = resources_.begin(); i != resources_.end(); i++) { | 568 for (Resources::iterator i = resources_.begin(); i != resources_.end(); i++) { |
569 TabContents* tab = i->first->tab_contents(); | 569 TabContents* tab = i->first->tab_contents(); |
570 if (tab->render_view_host()->process()->id() == render_process_host_id && | 570 if (tab->render_view_host()->process()->GetID() == render_process_host_id |
571 tab->render_view_host()->routing_id() == routing_id) { | 571 && tab->render_view_host()->routing_id() == routing_id) { |
572 return i->second; | 572 return i->second; |
573 } | 573 } |
574 } | 574 } |
575 | 575 |
576 // Can happen if the page went away while a network request was being | 576 // Can happen if the page went away while a network request was being |
577 // performed. | 577 // performed. |
578 return NULL; | 578 return NULL; |
579 } | 579 } |
580 | 580 |
581 void TaskManagerBackgroundContentsResourceProvider::StartUpdating() { | 581 void TaskManagerBackgroundContentsResourceProvider::StartUpdating() { |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 | 1391 |
1392 return &resource_; | 1392 return &resource_; |
1393 } | 1393 } |
1394 | 1394 |
1395 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { | 1395 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { |
1396 task_manager_->AddResource(&resource_); | 1396 task_manager_->AddResource(&resource_); |
1397 } | 1397 } |
1398 | 1398 |
1399 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { | 1399 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { |
1400 } | 1400 } |
OLD | NEW |