| 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/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "chrome/browser/task_manager/resource_provider.h" | 10 #include "chrome/browser/task_manager/resource_provider.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/app_icon_win.h" | 26 #include "chrome/browser/app_icon_win.h" |
| 27 #include "ui/gfx/icon_util.h" | 27 #include "ui/gfx/icon_util.h" |
| 28 #endif // defined(OS_WIN) | 28 #endif // defined(OS_WIN) |
| 29 | 29 |
| 30 namespace task_manager { | 30 namespace task_manager { |
| 31 | 31 |
| 32 gfx::ImageSkia* BrowserProcessResource::default_icon_ = NULL; | 32 gfx::ImageSkia* BrowserProcessResource::default_icon_ = NULL; |
| 33 | 33 |
| 34 BrowserProcessResource::BrowserProcessResource() | 34 BrowserProcessResource::BrowserProcessResource() |
| 35 : title_() { | 35 : title_() { |
| 36 // TODO(vadimt): Remove ScopedTracker below once crbug.com/437890 is fixed. | |
| 37 tracked_objects::ScopedTracker tracking_profile1( | |
| 38 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 39 "437890 BrowserProcessResource::BrowserProcessResource1")); | |
| 40 | |
| 41 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
| 42 if (!default_icon_) { | 37 if (!default_icon_) { |
| 43 // TODO(vadimt): Remove ScopedTracker below once crbug.com/437890 is fixed. | 38 // TODO(afakhry): Remove ScopedTracker below once crbug.com/437890 is fixed. |
| 44 tracked_objects::ScopedTracker tracking_profile2( | 39 tracked_objects::ScopedTracker tracking_profile1( |
| 45 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 40 FROM_HERE_WITH_EXPLICIT_FUNCTION("437890 GetAppIcon()")); |
| 46 "437890 BrowserProcessResource::BrowserProcessResource2")); | |
| 47 | 41 |
| 48 HICON icon = GetAppIcon(); | 42 HICON icon = GetAppIcon(); |
| 49 if (icon) { | 43 if (icon) { |
| 50 // TODO(vadimt): Remove ScopedTracker below once crbug.com/437890 is | 44 // TODO(afakhry): Remove ScopedTracker below once crbug.com/437890 is |
| 51 // fixed. | 45 // fixed. |
| 52 tracked_objects::ScopedTracker tracking_profile3( | 46 tracked_objects::ScopedTracker tracking_profile2( |
| 53 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 47 FROM_HERE_WITH_EXPLICIT_FUNCTION("437890 CreateSkBitmapFromHICON()")); |
| 54 "437890 BrowserProcessResource::BrowserProcessResource3")); | |
| 55 | 48 |
| 56 scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(icon)); | 49 scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(icon)); |
| 57 default_icon_ = new gfx::ImageSkia(gfx::ImageSkiaRep(*bitmap, 1.0f)); | 50 default_icon_ = new gfx::ImageSkia(gfx::ImageSkiaRep(*bitmap, 1.0f)); |
| 58 } | 51 } |
| 59 } | 52 } |
| 60 #elif defined(OS_POSIX) | 53 #elif defined(OS_POSIX) |
| 61 if (!default_icon_) { | 54 if (!default_icon_) { |
| 55 // TODO(afakhry): Remove ScopedTracker below once crbug.com/437890 is fixed. |
| 56 tracked_objects::ScopedTracker tracking_profile3( |
| 57 FROM_HERE_WITH_EXPLICIT_FUNCTION("437890 POSIX icon construction")); |
| 58 |
| 62 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 59 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 63 default_icon_ = rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_16); | 60 default_icon_ = rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_16); |
| 64 } | 61 } |
| 65 #else | 62 #else |
| 66 // TODO(port): Port icon code. | 63 // TODO(port): Port icon code. |
| 67 NOTIMPLEMENTED(); | 64 NOTIMPLEMENTED(); |
| 68 #endif // defined(OS_WIN) | 65 #endif // defined(OS_WIN) |
| 69 | 66 |
| 70 // TODO(vadimt): Remove ScopedTracker below once crbug.com/437890 is | 67 // TODO(afakhry): Remove ScopedTracker below once crbug.com/437890 is fixed. |
| 71 // fixed. | |
| 72 tracked_objects::ScopedTracker tracking_profile4( | 68 tracked_objects::ScopedTracker tracking_profile4( |
| 73 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 69 FROM_HERE_WITH_EXPLICIT_FUNCTION("437890 MakeThreadSafe()")); |
| 74 "437890 BrowserProcessResource::BrowserProcessResource4")); | |
| 75 | |
| 76 default_icon_->MakeThreadSafe(); | 70 default_icon_->MakeThreadSafe(); |
| 77 } | 71 } |
| 78 | 72 |
| 79 BrowserProcessResource::~BrowserProcessResource() { | 73 BrowserProcessResource::~BrowserProcessResource() { |
| 80 } | 74 } |
| 81 | 75 |
| 82 // Resource methods: | 76 // Resource methods: |
| 83 base::string16 BrowserProcessResource::GetTitle() const { | 77 base::string16 BrowserProcessResource::GetTitle() const { |
| 84 if (title_.empty()) { | 78 if (title_.empty()) { |
| 85 title_ = l10n_util::GetStringUTF16(IDS_TASK_MANAGER_WEB_BROWSER_CELL_TEXT); | 79 title_ = l10n_util::GetStringUTF16(IDS_TASK_MANAGER_WEB_BROWSER_CELL_TEXT); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 161 } |
| 168 | 162 |
| 169 void BrowserProcessResourceProvider::StartUpdating() { | 163 void BrowserProcessResourceProvider::StartUpdating() { |
| 170 task_manager_->AddResource(&resource_); | 164 task_manager_->AddResource(&resource_); |
| 171 } | 165 } |
| 172 | 166 |
| 173 void BrowserProcessResourceProvider::StopUpdating() { | 167 void BrowserProcessResourceProvider::StopUpdating() { |
| 174 } | 168 } |
| 175 | 169 |
| 176 } // namespace task_manager | 170 } // namespace task_manager |
| OLD | NEW |