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

Side by Side Diff: chrome/browser/ui/toolbar/wrench_menu_model.cc

Issue 10437006: Converts ui/views/controls, ui/views/examples, ui/base/models to ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 7 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/ui/toolbar/wrench_menu_model.h" 5 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_PRE_SYNCED_LABEL, 274 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_PRE_SYNCED_LABEL,
275 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); 275 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
276 } 276 }
277 default: 277 default:
278 NOTREACHED(); 278 NOTREACHED();
279 return string16(); 279 return string16();
280 } 280 }
281 } 281 }
282 282
283 bool WrenchMenuModel::GetIconForCommandId(int command_id, 283 bool WrenchMenuModel::GetIconForCommandId(int command_id,
284 SkBitmap* icon) const { 284 gfx::ImageSkia* icon) const {
285 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 285 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
286 switch (command_id) { 286 switch (command_id) {
287 case IDC_UPGRADE_DIALOG: { 287 case IDC_UPGRADE_DIALOG: {
288 if (UpgradeDetector::GetInstance()->notify_upgrade()) { 288 if (UpgradeDetector::GetInstance()->notify_upgrade()) {
289 *icon = *rb.GetNativeImageNamed( 289 *icon = *rb.GetImageNamed(
290 UpgradeDetector::GetInstance()->GetIconResourceID( 290 UpgradeDetector::GetInstance()->GetIconResourceID(
291 UpgradeDetector::UPGRADE_ICON_TYPE_MENU_ICON)).ToSkBitmap(); 291 UpgradeDetector::UPGRADE_ICON_TYPE_MENU_ICON)).ToImageSkia();
292 return true; 292 return true;
293 } 293 }
294 return false; 294 return false;
295 } 295 }
296 case IDC_SHOW_SYNC_SETUP: { 296 case IDC_SHOW_SYNC_SETUP: {
297 ProfileSyncService* service = 297 ProfileSyncService* service =
298 ProfileSyncServiceFactory::GetInstance()->GetForProfile( 298 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
299 browser_->profile()->GetOriginalProfile()); 299 browser_->profile()->GetOriginalProfile());
300 SyncGlobalError* error = service->sync_global_error(); 300 SyncGlobalError* error = service->sync_global_error();
301 if (error && error->HasCustomizedSyncMenuItem()) { 301 if (error && error->HasCustomizedSyncMenuItem()) {
302 int icon_id = error->MenuItemIconResourceID(); 302 int icon_id = error->MenuItemIconResourceID();
303 if (icon_id) { 303 if (icon_id) {
304 *icon = *rb.GetNativeImageNamed(icon_id).ToSkBitmap(); 304 *icon = *rb.GetImageNamed(icon_id).ToImageSkia();
305 return true; 305 return true;
306 } 306 }
307 } 307 }
308 return false; 308 return false;
309 } 309 }
310 default: 310 default:
311 break; 311 break;
312 } 312 }
313 return false; 313 return false;
314 } 314 }
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 zoom_label_ = l10n_util::GetStringFUTF16( 607 zoom_label_ = l10n_util::GetStringFUTF16(
608 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); 608 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent));
609 } 609 }
610 610
611 string16 WrenchMenuModel::GetSyncMenuLabel() const { 611 string16 WrenchMenuModel::GetSyncMenuLabel() const {
612 Profile* profile = browser_->profile()->GetOriginalProfile(); 612 Profile* profile = browser_->profile()->GetOriginalProfile();
613 return sync_ui_util::GetSyncMenuLabel( 613 return sync_ui_util::GetSyncMenuLabel(
614 ProfileSyncServiceFactory::GetForProfile(profile), 614 ProfileSyncServiceFactory::GetForProfile(profile),
615 *SigninManagerFactory::GetForProfile(profile)); 615 *SigninManagerFactory::GetForProfile(profile));
616 } 616 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698