| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser_process_resource_provider.h" | 5 #include "chrome/browser/task_manager/browser_process_resource_provider.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "chrome/browser/task_manager/resource_provider.h" | 9 #include "chrome/browser/task_manager/resource_provider.h" |
| 10 #include "chrome/browser/task_manager/task_manager.h" | 10 #include "chrome/browser/task_manager/task_manager.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 bool success = base::OpenPrivilegedProcessHandle(pid, &process_); | 36 bool success = base::OpenPrivilegedProcessHandle(pid, &process_); |
| 37 DCHECK(success); | 37 DCHECK(success); |
| 38 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
| 39 if (!default_icon_) { | 39 if (!default_icon_) { |
| 40 HICON icon = GetAppIcon(); | 40 HICON icon = GetAppIcon(); |
| 41 if (icon) { | 41 if (icon) { |
| 42 scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(icon)); | 42 scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(icon)); |
| 43 default_icon_ = new gfx::ImageSkia(gfx::ImageSkiaRep(*bitmap, 1.0f)); | 43 default_icon_ = new gfx::ImageSkia(gfx::ImageSkiaRep(*bitmap, 1.0f)); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 46 #elif defined(OS_POSIX) |
| 47 if (!default_icon_) { | 47 if (!default_icon_) { |
| 48 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 48 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 49 default_icon_ = rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_16); | 49 default_icon_ = rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_16); |
| 50 } | 50 } |
| 51 #elif defined(OS_MACOSX) | |
| 52 if (!default_icon_) { | |
| 53 // IDR_PRODUCT_LOGO_16 doesn't quite look like chrome/mac's icns icon. Load | |
| 54 // the real app icon (requires a nsimage->image_skia->nsimage | |
| 55 // conversion :-(). | |
| 56 default_icon_ = new gfx::ImageSkia(gfx::ApplicationIconAtSize(16)); | |
| 57 } | |
| 58 #else | |
| 59 // TODO(port): Port icon code. | 51 // TODO(port): Port icon code. |
| 60 NOTIMPLEMENTED(); | 52 NOTIMPLEMENTED(); |
| 61 #endif // defined(OS_WIN) | 53 #endif // defined(OS_WIN) |
| 62 default_icon_->MakeThreadSafe(); | 54 default_icon_->MakeThreadSafe(); |
| 63 } | 55 } |
| 64 | 56 |
| 65 BrowserProcessResource::~BrowserProcessResource() { | 57 BrowserProcessResource::~BrowserProcessResource() { |
| 66 base::CloseProcessHandle(process_); | 58 base::CloseProcessHandle(process_); |
| 67 } | 59 } |
| 68 | 60 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 145 } |
| 154 | 146 |
| 155 void BrowserProcessResourceProvider::StartUpdating() { | 147 void BrowserProcessResourceProvider::StartUpdating() { |
| 156 task_manager_->AddResource(&resource_); | 148 task_manager_->AddResource(&resource_); |
| 157 } | 149 } |
| 158 | 150 |
| 159 void BrowserProcessResourceProvider::StopUpdating() { | 151 void BrowserProcessResourceProvider::StopUpdating() { |
| 160 } | 152 } |
| 161 | 153 |
| 162 } // namespace task_manager | 154 } // namespace task_manager |
| OLD | NEW |