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

Side by Side Diff: chrome/browser/background/background_mode_manager.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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // When there are no background applications, we want to display 110 // When there are no background applications, we want to display
111 // just a label stating that none are running. 111 // just a label stating that none are running.
112 if (applications_->size() < 1) { 112 if (applications_->size() < 1) {
113 menu->AddItemWithStringId(IDC_MinimumLabelValue, 113 menu->AddItemWithStringId(IDC_MinimumLabelValue,
114 IDS_BACKGROUND_APP_NOT_INSTALLED); 114 IDS_BACKGROUND_APP_NOT_INSTALLED);
115 } else { 115 } else {
116 for (extensions::ExtensionList::const_iterator cursor = 116 for (extensions::ExtensionList::const_iterator cursor =
117 applications_->begin(); 117 applications_->begin();
118 cursor != applications_->end(); 118 cursor != applications_->end();
119 ++cursor, ++position) { 119 ++cursor, ++position) {
120 const SkBitmap* icon = applications_->GetIcon(*cursor); 120 const gfx::ImageSkia* icon = applications_->GetIcon(*cursor);
121 DCHECK(position == applications_->GetPosition(*cursor)); 121 DCHECK(position == applications_->GetPosition(*cursor));
122 const std::string& name = (*cursor)->name(); 122 const std::string& name = (*cursor)->name();
123 menu->AddItem(position, UTF8ToUTF16(name)); 123 menu->AddItem(position, UTF8ToUTF16(name));
124 if (icon) 124 if (icon)
125 menu->SetIcon(menu->GetItemCount() - 1, *icon); 125 menu->SetIcon(menu->GetItemCount() - 1, *icon);
126 } 126 }
127 } 127 }
128 if (containing_menu) 128 if (containing_menu)
129 containing_menu->AddSubMenu(command_id_, name_, menu); 129 containing_menu->AddSubMenu(command_id_, name_, menu);
130 } 130 }
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 // our status icon, just return. 656 // our status icon, just return.
657 if (!status_tray_ || status_icon_) 657 if (!status_tray_ || status_icon_)
658 return; 658 return;
659 659
660 status_icon_ = status_tray_->CreateStatusIcon(); 660 status_icon_ = status_tray_->CreateStatusIcon();
661 if (!status_icon_) 661 if (!status_icon_)
662 return; 662 return;
663 663
664 // Set the image and add ourselves as a click observer on it. 664 // Set the image and add ourselves as a click observer on it.
665 // TODO(rlp): Status tray icon should have submenus for each profile. 665 // TODO(rlp): Status tray icon should have submenus for each profile.
666 SkBitmap* bitmap = ResourceBundle::GetSharedInstance().GetBitmapNamed( 666 gfx::ImageSkia* image_skia = ResourceBundle::GetSharedInstance().
667 IDR_STATUS_TRAY_ICON); 667 GetImageSkiaNamed(IDR_STATUS_TRAY_ICON);
668 status_icon_->SetImage(*bitmap); 668 status_icon_->SetImage(*image_skia);
669 status_icon_->SetToolTip(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 669 status_icon_->SetToolTip(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
670 UpdateStatusTrayIconContextMenu(); 670 UpdateStatusTrayIconContextMenu();
671 } 671 }
672 672
673 void BackgroundModeManager::UpdateStatusTrayIconContextMenu() { 673 void BackgroundModeManager::UpdateStatusTrayIconContextMenu() {
674 // If no status icon exists, it's either because one wasn't created when 674 // If no status icon exists, it's either because one wasn't created when
675 // it should have been which can happen when extensions load after the 675 // it should have been which can happen when extensions load after the
676 // profile has already been registered with the background mode manager. 676 // profile has already been registered with the background mode manager.
677 if (in_background_mode_ && !status_icon_) 677 if (in_background_mode_ && !status_icon_)
678 CreateStatusTrayIcon(); 678 CreateStatusTrayIcon();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 } 768 }
769 } 769 }
770 return profile_it; 770 return profile_it;
771 } 771 }
772 772
773 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { 773 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const {
774 PrefService* service = g_browser_process->local_state(); 774 PrefService* service = g_browser_process->local_state();
775 DCHECK(service); 775 DCHECK(service);
776 return service->GetBoolean(prefs::kBackgroundModeEnabled); 776 return service->GetBoolean(prefs::kBackgroundModeEnabled);
777 } 777 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698