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

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

Issue 8539043: Refactor ProfileInfoCache (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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) 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/file_version_info.h" 10 #include "base/file_version_info.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 HostsExtension(), 278 HostsExtension(),
279 tab_contents_->profile()->IsOffTheRecord(), 279 tab_contents_->profile()->IsOffTheRecord(),
280 IsPrerendering()); 280 IsPrerendering());
281 return l10n_util::GetStringFUTF16(message_id, tab_title); 281 return l10n_util::GetStringFUTF16(message_id, tab_title);
282 } 282 }
283 283
284 string16 TaskManagerTabContentsResource::GetProfileName() const { 284 string16 TaskManagerTabContentsResource::GetProfileName() const {
285 ProfileInfoCache& cache = 285 ProfileInfoCache& cache =
286 g_browser_process->profile_manager()->GetProfileInfoCache(); 286 g_browser_process->profile_manager()->GetProfileInfoCache();
287 Profile* profile = tab_contents_->profile()->GetOriginalProfile(); 287 Profile* profile = tab_contents_->profile()->GetOriginalProfile();
288 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); 288 ProfileInfoEntry entry;
289 if (index == std::string::npos) 289 if (cache.GetInfoForProfile(profile->GetPath(), &entry))
290 return string16(); 290 return entry.name();
291 else 291 return string16();
292 return cache.GetNameOfProfileAtIndex(index);
293 } 292 }
294 293
295 SkBitmap TaskManagerTabContentsResource::GetIcon() const { 294 SkBitmap TaskManagerTabContentsResource::GetIcon() const {
296 if (IsPrerendering()) 295 if (IsPrerendering())
297 return *prerender_icon_; 296 return *prerender_icon_;
298 return tab_contents_->favicon_tab_helper()->GetFavicon(); 297 return tab_contents_->favicon_tab_helper()->GetFavicon();
299 } 298 }
300 299
301 TabContentsWrapper* TaskManagerTabContentsResource::GetTabContents() const { 300 TabContentsWrapper* TaskManagerTabContentsResource::GetTabContents() const {
302 return tab_contents_; 301 return tab_contents_;
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 } 1072 }
1074 1073
1075 string16 TaskManagerExtensionProcessResource::GetTitle() const { 1074 string16 TaskManagerExtensionProcessResource::GetTitle() const {
1076 return title_; 1075 return title_;
1077 } 1076 }
1078 1077
1079 string16 TaskManagerExtensionProcessResource::GetProfileName() const { 1078 string16 TaskManagerExtensionProcessResource::GetProfileName() const {
1080 ProfileInfoCache& cache = 1079 ProfileInfoCache& cache =
1081 g_browser_process->profile_manager()->GetProfileInfoCache(); 1080 g_browser_process->profile_manager()->GetProfileInfoCache();
1082 Profile* profile = extension_host_->profile()->GetOriginalProfile(); 1081 Profile* profile = extension_host_->profile()->GetOriginalProfile();
1083 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); 1082 ProfileInfoEntry entry;
1084 if (index == std::string::npos) 1083 if (cache.GetInfoForProfile(profile->GetPath(), &entry))
1085 return string16(); 1084 return entry.name();
1086 else 1085 return string16();
1087 return cache.GetNameOfProfileAtIndex(index);
1088 } 1086 }
1089 1087
1090 SkBitmap TaskManagerExtensionProcessResource::GetIcon() const { 1088 SkBitmap TaskManagerExtensionProcessResource::GetIcon() const {
1091 return *default_icon_; 1089 return *default_icon_;
1092 } 1090 }
1093 1091
1094 base::ProcessHandle TaskManagerExtensionProcessResource::GetProcess() const { 1092 base::ProcessHandle TaskManagerExtensionProcessResource::GetProcess() const {
1095 return process_handle_; 1093 return process_handle_;
1096 } 1094 }
1097 1095
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 1387
1390 return &resource_; 1388 return &resource_;
1391 } 1389 }
1392 1390
1393 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { 1391 void TaskManagerBrowserProcessResourceProvider::StartUpdating() {
1394 task_manager_->AddResource(&resource_); 1392 task_manager_->AddResource(&resource_);
1395 } 1393 }
1396 1394
1397 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { 1395 void TaskManagerBrowserProcessResourceProvider::StopUpdating() {
1398 } 1396 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.cc ('k') | chrome/browser/ui/cocoa/browser/avatar_button_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698