Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: chrome/browser/task_manager/task_manager_resource_providers.cc

Issue 10453101: Convert most of the rest of chrome to ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/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"
11 #include "base/file_version_info.h" 11 #include "base/file_version_info.h"
12 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
13 #include "base/memory/scoped_ptr.h"
13 #include "base/process_util.h" 14 #include "base/process_util.h"
14 #include "base/stl_util.h" 15 #include "base/stl_util.h"
15 #include "base/string_util.h" 16 #include "base/string_util.h"
16 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
17 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
18 #include "build/build_config.h" 19 #include "build/build_config.h"
19 #include "chrome/app/chrome_command_ids.h" 20 #include "chrome/app/chrome_command_ids.h"
20 #include "chrome/browser/background/background_contents_service.h" 21 #include "chrome/browser/background/background_contents_service.h"
21 #include "chrome/browser/background/background_contents_service_factory.h" 22 #include "chrome/browser/background/background_contents_service_factory.h"
22 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
(...skipping 28 matching lines...) Expand all
51 #include "content/public/browser/render_process_host.h" 52 #include "content/public/browser/render_process_host.h"
52 #include "content/public/browser/render_view_host.h" 53 #include "content/public/browser/render_view_host.h"
53 #include "content/public/browser/web_contents.h" 54 #include "content/public/browser/web_contents.h"
54 #include "content/public/common/process_type.h" 55 #include "content/public/common/process_type.h"
55 #include "grit/generated_resources.h" 56 #include "grit/generated_resources.h"
56 #include "grit/theme_resources.h" 57 #include "grit/theme_resources.h"
57 #include "grit/theme_resources_standard.h" 58 #include "grit/theme_resources_standard.h"
58 #include "third_party/sqlite/sqlite3.h" 59 #include "third_party/sqlite/sqlite3.h"
59 #include "ui/base/l10n/l10n_util.h" 60 #include "ui/base/l10n/l10n_util.h"
60 #include "ui/base/resource/resource_bundle.h" 61 #include "ui/base/resource/resource_bundle.h"
62 #include "ui/gfx/image/image_skia.h"
61 #include "v8/include/v8.h" 63 #include "v8/include/v8.h"
62 64
63 #if defined(OS_MACOSX) 65 #if defined(OS_MACOSX)
64 #include "skia/ext/skia_utils_mac.h" 66 #include "skia/ext/skia_utils_mac.h"
65 #endif 67 #endif
66 #if defined(OS_WIN) 68 #if defined(OS_WIN)
67 #include "chrome/browser/app_icon_win.h" 69 #include "chrome/browser/app_icon_win.h"
68 #include "ui/gfx/icon_util.h" 70 #include "ui/gfx/icon_util.h"
69 #endif // defined(OS_WIN) 71 #endif // defined(OS_WIN)
70 72
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 217
216 bool TaskManagerRendererResource::SupportNetworkUsage() const { 218 bool TaskManagerRendererResource::SupportNetworkUsage() const {
217 return true; 219 return true;
218 } 220 }
219 221
220 //////////////////////////////////////////////////////////////////////////////// 222 ////////////////////////////////////////////////////////////////////////////////
221 // TaskManagerTabContentsResource class 223 // TaskManagerTabContentsResource class
222 //////////////////////////////////////////////////////////////////////////////// 224 ////////////////////////////////////////////////////////////////////////////////
223 225
224 // static 226 // static
225 SkBitmap* TaskManagerTabContentsResource::prerender_icon_ = NULL; 227 gfx::ImageSkia* TaskManagerTabContentsResource::prerender_icon_ = NULL;
226 228
227 TaskManagerTabContentsResource::TaskManagerTabContentsResource( 229 TaskManagerTabContentsResource::TaskManagerTabContentsResource(
228 TabContentsWrapper* tab_contents) 230 TabContentsWrapper* tab_contents)
229 : TaskManagerRendererResource( 231 : TaskManagerRendererResource(
230 tab_contents->web_contents()->GetRenderProcessHost()->GetHandle(), 232 tab_contents->web_contents()->GetRenderProcessHost()->GetHandle(),
231 tab_contents->web_contents()->GetRenderViewHost()), 233 tab_contents->web_contents()->GetRenderViewHost()),
232 tab_contents_(tab_contents), 234 tab_contents_(tab_contents),
233 is_instant_preview_(false) { 235 is_instant_preview_(false) {
234 if (!prerender_icon_) { 236 if (!prerender_icon_) {
235 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 237 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
236 prerender_icon_ = rb.GetBitmapNamed(IDR_PRERENDER); 238 prerender_icon_ = rb.GetImageSkiaNamed(IDR_PRERENDER);
237 } 239 }
238 for (BrowserList::const_iterator i = BrowserList::begin(); 240 for (BrowserList::const_iterator i = BrowserList::begin();
239 i != BrowserList::end(); ++i) { 241 i != BrowserList::end(); ++i) {
240 if ((*i)->instant() && 242 if ((*i)->instant() &&
241 (*i)->instant()->GetPreviewContents() == tab_contents_) { 243 (*i)->instant()->GetPreviewContents() == tab_contents_) {
242 is_instant_preview_ = true; 244 is_instant_preview_ = true;
243 break; 245 break;
244 } 246 }
245 } 247 }
246 } 248 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 ProfileInfoCache& cache = 317 ProfileInfoCache& cache =
316 g_browser_process->profile_manager()->GetProfileInfoCache(); 318 g_browser_process->profile_manager()->GetProfileInfoCache();
317 Profile* profile = tab_contents_->profile()->GetOriginalProfile(); 319 Profile* profile = tab_contents_->profile()->GetOriginalProfile();
318 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); 320 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath());
319 if (index == std::string::npos) 321 if (index == std::string::npos)
320 return string16(); 322 return string16();
321 else 323 else
322 return cache.GetNameOfProfileAtIndex(index); 324 return cache.GetNameOfProfileAtIndex(index);
323 } 325 }
324 326
325 SkBitmap TaskManagerTabContentsResource::GetIcon() const { 327 gfx::ImageSkia TaskManagerTabContentsResource::GetIcon() const {
326 if (IsPrerendering()) 328 if (IsPrerendering())
327 return *prerender_icon_; 329 return *prerender_icon_;
328 return tab_contents_->favicon_tab_helper()->GetFavicon(); 330 return tab_contents_->favicon_tab_helper()->GetFavicon();
329 } 331 }
330 332
331 TabContentsWrapper* TaskManagerTabContentsResource::GetTabContents() const { 333 TabContentsWrapper* TaskManagerTabContentsResource::GetTabContents() const {
332 return tab_contents_; 334 return tab_contents_;
333 } 335 }
334 336
335 const Extension* TaskManagerTabContentsResource::GetExtension() const { 337 const Extension* TaskManagerTabContentsResource::GetExtension() const {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 default: 523 default:
522 NOTREACHED() << "Unexpected notification."; 524 NOTREACHED() << "Unexpected notification.";
523 return; 525 return;
524 } 526 }
525 } 527 }
526 528
527 //////////////////////////////////////////////////////////////////////////////// 529 ////////////////////////////////////////////////////////////////////////////////
528 // TaskManagerBackgroundContentsResource class 530 // TaskManagerBackgroundContentsResource class
529 //////////////////////////////////////////////////////////////////////////////// 531 ////////////////////////////////////////////////////////////////////////////////
530 532
531 SkBitmap* TaskManagerBackgroundContentsResource::default_icon_ = NULL; 533 gfx::ImageSkia* TaskManagerBackgroundContentsResource::default_icon_ = NULL;
532 534
533 // TODO(atwilson): http://crbug.com/116893 535 // TODO(atwilson): http://crbug.com/116893
534 // HACK: if the process handle is invalid, we use the current process's handle. 536 // HACK: if the process handle is invalid, we use the current process's handle.
535 // This preserves old behavior but is incorrect, and should be fixed. 537 // This preserves old behavior but is incorrect, and should be fixed.
536 TaskManagerBackgroundContentsResource::TaskManagerBackgroundContentsResource( 538 TaskManagerBackgroundContentsResource::TaskManagerBackgroundContentsResource(
537 BackgroundContents* background_contents, 539 BackgroundContents* background_contents,
538 const string16& application_name) 540 const string16& application_name)
539 : TaskManagerRendererResource( 541 : TaskManagerRendererResource(
540 background_contents->web_contents()->GetRenderProcessHost()-> 542 background_contents->web_contents()->GetRenderProcessHost()->
541 GetHandle() ? 543 GetHandle() ?
542 background_contents->web_contents()->GetRenderProcessHost()-> 544 background_contents->web_contents()->GetRenderProcessHost()->
543 GetHandle() : 545 GetHandle() :
544 base::Process::Current().handle(), 546 base::Process::Current().handle(),
545 background_contents->web_contents()->GetRenderViewHost()), 547 background_contents->web_contents()->GetRenderViewHost()),
546 background_contents_(background_contents), 548 background_contents_(background_contents),
547 application_name_(application_name) { 549 application_name_(application_name) {
548 // Just use the same icon that other extension resources do. 550 // Just use the same icon that other extension resources do.
549 // TODO(atwilson): Use the favicon when that's available. 551 // TODO(atwilson): Use the favicon when that's available.
550 if (!default_icon_) { 552 if (!default_icon_) {
551 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 553 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
552 default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); 554 default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGIN);
553 } 555 }
554 // Ensure that the string has the appropriate direction markers (see comment 556 // Ensure that the string has the appropriate direction markers (see comment
555 // in TaskManagerTabContentsResource::GetTitle()). 557 // in TaskManagerTabContentsResource::GetTitle()).
556 base::i18n::AdjustStringForLocaleDirection(&application_name_); 558 base::i18n::AdjustStringForLocaleDirection(&application_name_);
557 } 559 }
558 560
559 TaskManagerBackgroundContentsResource::~TaskManagerBackgroundContentsResource( 561 TaskManagerBackgroundContentsResource::~TaskManagerBackgroundContentsResource(
560 ) { 562 ) {
561 } 563 }
562 564
563 string16 TaskManagerBackgroundContentsResource::GetTitle() const { 565 string16 TaskManagerBackgroundContentsResource::GetTitle() const {
564 string16 title = application_name_; 566 string16 title = application_name_;
565 567
566 if (title.empty()) { 568 if (title.empty()) {
567 // No title (can't locate the parent app for some reason) so just display 569 // No title (can't locate the parent app for some reason) so just display
568 // the URL (properly forced to be LTR). 570 // the URL (properly forced to be LTR).
569 title = base::i18n::GetDisplayStringInLTRDirectionality( 571 title = base::i18n::GetDisplayStringInLTRDirectionality(
570 UTF8ToUTF16(background_contents_->GetURL().spec())); 572 UTF8ToUTF16(background_contents_->GetURL().spec()));
571 } 573 }
572 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_BACKGROUND_PREFIX, title); 574 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_BACKGROUND_PREFIX, title);
573 } 575 }
574 576
575 string16 TaskManagerBackgroundContentsResource::GetProfileName() const { 577 string16 TaskManagerBackgroundContentsResource::GetProfileName() const {
576 return string16(); 578 return string16();
577 } 579 }
578 580
579 SkBitmap TaskManagerBackgroundContentsResource::GetIcon() const { 581 gfx::ImageSkia TaskManagerBackgroundContentsResource::GetIcon() const {
580 return *default_icon_; 582 return *default_icon_;
581 } 583 }
582 584
583 bool TaskManagerBackgroundContentsResource::IsBackground() const { 585 bool TaskManagerBackgroundContentsResource::IsBackground() const {
584 return true; 586 return true;
585 } 587 }
586 588
587 //////////////////////////////////////////////////////////////////////////////// 589 ////////////////////////////////////////////////////////////////////////////////
588 // TaskManagerBackgroundContentsResourceProvider class 590 // TaskManagerBackgroundContentsResourceProvider class
589 //////////////////////////////////////////////////////////////////////////////// 591 ////////////////////////////////////////////////////////////////////////////////
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 break; 780 break;
779 default: 781 default:
780 NOTREACHED() << "Unexpected notification."; 782 NOTREACHED() << "Unexpected notification.";
781 return; 783 return;
782 } 784 }
783 } 785 }
784 786
785 //////////////////////////////////////////////////////////////////////////////// 787 ////////////////////////////////////////////////////////////////////////////////
786 // TaskManagerChildProcessResource class 788 // TaskManagerChildProcessResource class
787 //////////////////////////////////////////////////////////////////////////////// 789 ////////////////////////////////////////////////////////////////////////////////
788 SkBitmap* TaskManagerChildProcessResource::default_icon_ = NULL; 790 gfx::ImageSkia* TaskManagerChildProcessResource::default_icon_ = NULL;
789 791
790 TaskManagerChildProcessResource::TaskManagerChildProcessResource( 792 TaskManagerChildProcessResource::TaskManagerChildProcessResource(
791 content::ProcessType type, 793 content::ProcessType type,
792 const string16& name, 794 const string16& name,
793 base::ProcessHandle handle, 795 base::ProcessHandle handle,
794 int unique_process_id) 796 int unique_process_id)
795 : type_(type), 797 : type_(type),
796 name_(name), 798 name_(name),
797 handle_(handle), 799 handle_(handle),
798 unique_process_id_(unique_process_id), 800 unique_process_id_(unique_process_id),
799 network_usage_support_(false) { 801 network_usage_support_(false) {
800 // We cache the process id because it's not cheap to calculate, and it won't 802 // We cache the process id because it's not cheap to calculate, and it won't
801 // be available when we get the plugin disconnected notification. 803 // be available when we get the plugin disconnected notification.
802 pid_ = base::GetProcId(handle); 804 pid_ = base::GetProcId(handle);
803 if (!default_icon_) { 805 if (!default_icon_) {
804 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 806 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
805 default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); 807 default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGIN);
806 // TODO(jabdelmalek): use different icon for web workers. 808 // TODO(jabdelmalek): use different icon for web workers.
807 } 809 }
808 } 810 }
809 811
810 TaskManagerChildProcessResource::~TaskManagerChildProcessResource() { 812 TaskManagerChildProcessResource::~TaskManagerChildProcessResource() {
811 } 813 }
812 814
813 // TaskManagerResource methods: 815 // TaskManagerResource methods:
814 string16 TaskManagerChildProcessResource::GetTitle() const { 816 string16 TaskManagerChildProcessResource::GetTitle() const {
815 if (title_.empty()) 817 if (title_.empty())
816 title_ = GetLocalizedTitle(); 818 title_ = GetLocalizedTitle();
817 819
818 return title_; 820 return title_;
819 } 821 }
820 822
821 string16 TaskManagerChildProcessResource::GetProfileName() const { 823 string16 TaskManagerChildProcessResource::GetProfileName() const {
822 return string16(); 824 return string16();
823 } 825 }
824 826
825 SkBitmap TaskManagerChildProcessResource::GetIcon() const { 827 gfx::ImageSkia TaskManagerChildProcessResource::GetIcon() const {
826 return *default_icon_; 828 return *default_icon_;
827 } 829 }
828 830
829 base::ProcessHandle TaskManagerChildProcessResource::GetProcess() const { 831 base::ProcessHandle TaskManagerChildProcessResource::GetProcess() const {
830 return handle_; 832 return handle_;
831 } 833 }
832 834
833 int TaskManagerChildProcessResource::GetUniqueChildProcessId() const { 835 int TaskManagerChildProcessResource::GetUniqueChildProcessId() const {
834 return unique_process_id_; 836 return unique_process_id_;
835 } 837 }
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 content::NotificationService::current()->Notify( 1103 content::NotificationService::current()->Notify(
1102 chrome::NOTIFICATION_TASK_MANAGER_CHILD_PROCESSES_DATA_READY, 1104 chrome::NOTIFICATION_TASK_MANAGER_CHILD_PROCESSES_DATA_READY,
1103 content::Source<TaskManagerChildProcessResourceProvider>(this), 1105 content::Source<TaskManagerChildProcessResourceProvider>(this),
1104 content::NotificationService::NoDetails()); 1106 content::NotificationService::NoDetails());
1105 } 1107 }
1106 1108
1107 //////////////////////////////////////////////////////////////////////////////// 1109 ////////////////////////////////////////////////////////////////////////////////
1108 // TaskManagerExtensionProcessResource class 1110 // TaskManagerExtensionProcessResource class
1109 //////////////////////////////////////////////////////////////////////////////// 1111 ////////////////////////////////////////////////////////////////////////////////
1110 1112
1111 SkBitmap* TaskManagerExtensionProcessResource::default_icon_ = NULL; 1113 gfx::ImageSkia* TaskManagerExtensionProcessResource::default_icon_ = NULL;
1112 1114
1113 TaskManagerExtensionProcessResource::TaskManagerExtensionProcessResource( 1115 TaskManagerExtensionProcessResource::TaskManagerExtensionProcessResource(
1114 content::RenderViewHost* render_view_host) 1116 content::RenderViewHost* render_view_host)
1115 : render_view_host_(render_view_host) { 1117 : render_view_host_(render_view_host) {
1116 if (!default_icon_) { 1118 if (!default_icon_) {
1117 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 1119 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
1118 default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); 1120 default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGIN);
1119 } 1121 }
1120 process_handle_ = render_view_host_->GetProcess()->GetHandle(); 1122 process_handle_ = render_view_host_->GetProcess()->GetHandle();
1121 unique_process_id_ = render_view_host->GetProcess()->GetID(); 1123 unique_process_id_ = render_view_host->GetProcess()->GetID();
1122 pid_ = base::GetProcId(process_handle_); 1124 pid_ = base::GetProcId(process_handle_);
1123 string16 extension_name = UTF8ToUTF16(GetExtension()->name()); 1125 string16 extension_name = UTF8ToUTF16(GetExtension()->name());
1124 DCHECK(!extension_name.empty()); 1126 DCHECK(!extension_name.empty());
1125 1127
1126 Profile* profile = Profile::FromBrowserContext( 1128 Profile* profile = Profile::FromBrowserContext(
1127 render_view_host->GetProcess()->GetBrowserContext()); 1129 render_view_host->GetProcess()->GetBrowserContext());
1128 int message_id = GetMessagePrefixID(GetExtension()->is_app(), true, 1130 int message_id = GetMessagePrefixID(GetExtension()->is_app(), true,
(...skipping 14 matching lines...) Expand all
1143 Profile* profile = Profile::FromBrowserContext( 1145 Profile* profile = Profile::FromBrowserContext(
1144 render_view_host_->GetProcess()->GetBrowserContext()); 1146 render_view_host_->GetProcess()->GetBrowserContext());
1145 profile = profile->GetOriginalProfile(); 1147 profile = profile->GetOriginalProfile();
1146 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); 1148 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath());
1147 if (index == std::string::npos) 1149 if (index == std::string::npos)
1148 return string16(); 1150 return string16();
1149 else 1151 else
1150 return cache.GetNameOfProfileAtIndex(index); 1152 return cache.GetNameOfProfileAtIndex(index);
1151 } 1153 }
1152 1154
1153 SkBitmap TaskManagerExtensionProcessResource::GetIcon() const { 1155 gfx::ImageSkia TaskManagerExtensionProcessResource::GetIcon() const {
1154 return *default_icon_; 1156 return *default_icon_;
1155 } 1157 }
1156 1158
1157 base::ProcessHandle TaskManagerExtensionProcessResource::GetProcess() const { 1159 base::ProcessHandle TaskManagerExtensionProcessResource::GetProcess() const {
1158 return process_handle_; 1160 return process_handle_;
1159 } 1161 }
1160 1162
1161 int TaskManagerExtensionProcessResource::GetUniqueChildProcessId() const { 1163 int TaskManagerExtensionProcessResource::GetUniqueChildProcessId() const {
1162 return unique_process_id_; 1164 return unique_process_id_;
1163 } 1165 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 pid_to_resources_.erase(pid_iter); 1361 pid_to_resources_.erase(pid_iter);
1360 1362
1361 // Finally, delete the resource. 1363 // Finally, delete the resource.
1362 delete resource; 1364 delete resource;
1363 } 1365 }
1364 1366
1365 //////////////////////////////////////////////////////////////////////////////// 1367 ////////////////////////////////////////////////////////////////////////////////
1366 // TaskManagerBrowserProcessResource class 1368 // TaskManagerBrowserProcessResource class
1367 //////////////////////////////////////////////////////////////////////////////// 1369 ////////////////////////////////////////////////////////////////////////////////
1368 1370
1369 SkBitmap* TaskManagerBrowserProcessResource::default_icon_ = NULL; 1371 gfx::ImageSkia* TaskManagerBrowserProcessResource::default_icon_ = NULL;
1370 1372
1371 TaskManagerBrowserProcessResource::TaskManagerBrowserProcessResource() 1373 TaskManagerBrowserProcessResource::TaskManagerBrowserProcessResource()
1372 : title_() { 1374 : title_() {
1373 int pid = base::GetCurrentProcId(); 1375 int pid = base::GetCurrentProcId();
1374 bool success = base::OpenPrivilegedProcessHandle(pid, &process_); 1376 bool success = base::OpenPrivilegedProcessHandle(pid, &process_);
1375 DCHECK(success); 1377 DCHECK(success);
1376 #if defined(OS_WIN) 1378 #if defined(OS_WIN)
1377 if (!default_icon_) { 1379 if (!default_icon_) {
1378 HICON icon = GetAppIcon(); 1380 HICON icon = GetAppIcon();
1379 if (icon) { 1381 if (icon) {
1380 default_icon_ = IconUtil::CreateSkBitmapFromHICON(icon); 1382 scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(icon));
1383 default_icon_ = new gfx::ImageSkia(*bitmap);
1381 } 1384 }
1382 } 1385 }
1383 #elif defined(OS_POSIX) && !defined(OS_MACOSX) 1386 #elif defined(OS_POSIX) && !defined(OS_MACOSX)
1384 if (!default_icon_) { 1387 if (!default_icon_) {
1385 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 1388 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
1386 default_icon_ = rb.GetBitmapNamed(IDR_PRODUCT_LOGO_16); 1389 default_icon_ = rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_16);
1387 } 1390 }
1388 #elif defined(OS_MACOSX) 1391 #elif defined(OS_MACOSX)
1389 if (!default_icon_) { 1392 if (!default_icon_) {
1390 // IDR_PRODUCT_LOGO_16 doesn't quite look like chrome/mac's icns icon. Load 1393 // IDR_PRODUCT_LOGO_16 doesn't quite look like chrome/mac's icns icon. Load
1391 // the real app icon (requires a nsimage->skbitmap->nsimage conversion :-(). 1394 // the real app icon (requires a nsimage->skbitmap->nsimage conversion :-().
1392 default_icon_ = new SkBitmap(gfx::AppplicationIconAtSize(16)); 1395 default_icon_ = new gfx::ImageSkia(gfx::AppplicationIconAtSize(16));
1393 } 1396 }
1394 #else 1397 #else
1395 // TODO(port): Port icon code. 1398 // TODO(port): Port icon code.
1396 NOTIMPLEMENTED(); 1399 NOTIMPLEMENTED();
1397 #endif // defined(OS_WIN) 1400 #endif // defined(OS_WIN)
1398 } 1401 }
1399 1402
1400 TaskManagerBrowserProcessResource::~TaskManagerBrowserProcessResource() { 1403 TaskManagerBrowserProcessResource::~TaskManagerBrowserProcessResource() {
1401 base::CloseProcessHandle(process_); 1404 base::CloseProcessHandle(process_);
1402 } 1405 }
1403 1406
1404 // TaskManagerResource methods: 1407 // TaskManagerResource methods:
1405 string16 TaskManagerBrowserProcessResource::GetTitle() const { 1408 string16 TaskManagerBrowserProcessResource::GetTitle() const {
1406 if (title_.empty()) { 1409 if (title_.empty()) {
1407 title_ = l10n_util::GetStringUTF16(IDS_TASK_MANAGER_WEB_BROWSER_CELL_TEXT); 1410 title_ = l10n_util::GetStringUTF16(IDS_TASK_MANAGER_WEB_BROWSER_CELL_TEXT);
1408 } 1411 }
1409 return title_; 1412 return title_;
1410 } 1413 }
1411 1414
1412 string16 TaskManagerBrowserProcessResource::GetProfileName() const { 1415 string16 TaskManagerBrowserProcessResource::GetProfileName() const {
1413 return string16(); 1416 return string16();
1414 } 1417 }
1415 1418
1416 SkBitmap TaskManagerBrowserProcessResource::GetIcon() const { 1419 gfx::ImageSkia TaskManagerBrowserProcessResource::GetIcon() const {
1417 return *default_icon_; 1420 return *default_icon_;
1418 } 1421 }
1419 1422
1420 size_t TaskManagerBrowserProcessResource::SqliteMemoryUsedBytes() const { 1423 size_t TaskManagerBrowserProcessResource::SqliteMemoryUsedBytes() const {
1421 return static_cast<size_t>(sqlite3_memory_used()); 1424 return static_cast<size_t>(sqlite3_memory_used());
1422 } 1425 }
1423 1426
1424 base::ProcessHandle TaskManagerBrowserProcessResource::GetProcess() const { 1427 base::ProcessHandle TaskManagerBrowserProcessResource::GetProcess() const {
1425 return base::GetCurrentProcessHandle(); // process_; 1428 return base::GetCurrentProcessHandle(); // process_;
1426 } 1429 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 1494
1492 return &resource_; 1495 return &resource_;
1493 } 1496 }
1494 1497
1495 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { 1498 void TaskManagerBrowserProcessResourceProvider::StartUpdating() {
1496 task_manager_->AddResource(&resource_); 1499 task_manager_->AddResource(&resource_);
1497 } 1500 }
1498 1501
1499 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { 1502 void TaskManagerBrowserProcessResourceProvider::StopUpdating() {
1500 } 1503 }
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/task_manager_resource_providers.h ('k') | chrome/browser/task_manager/task_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698