| OLD | NEW |
| 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/app_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/app_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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 #endif | 354 #endif |
| 355 case IDC_UPGRADE_DIALOG: | 355 case IDC_UPGRADE_DIALOG: |
| 356 return GetUpgradeDialogMenuItemName(); | 356 return GetUpgradeDialogMenuItemName(); |
| 357 default: | 357 default: |
| 358 NOTREACHED(); | 358 NOTREACHED(); |
| 359 return base::string16(); | 359 return base::string16(); |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 | 362 |
| 363 bool AppMenuModel::GetIconForCommandId(int command_id, gfx::Image* icon) const { | 363 bool AppMenuModel::GetIconForCommandId(int command_id, gfx::Image* icon) const { |
| 364 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 364 if (command_id == IDC_UPGRADE_DIALOG && |
| 365 switch (command_id) { | 365 UpgradeDetector::GetInstance()->notify_upgrade()) { |
| 366 case IDC_UPGRADE_DIALOG: { | 366 *icon = UpgradeDetector::GetInstance()->GetIcon(); |
| 367 if (UpgradeDetector::GetInstance()->notify_upgrade()) { | 367 return true; |
| 368 *icon = rb.GetNativeImageNamed( | |
| 369 UpgradeDetector::GetInstance()->GetIconResourceID()); | |
| 370 return true; | |
| 371 } | |
| 372 return false; | |
| 373 } | |
| 374 default: | |
| 375 break; | |
| 376 } | 368 } |
| 377 return false; | 369 return false; |
| 378 } | 370 } |
| 379 | 371 |
| 380 void AppMenuModel::ExecuteCommand(int command_id, int event_flags) { | 372 void AppMenuModel::ExecuteCommand(int command_id, int event_flags) { |
| 381 GlobalError* error = GlobalErrorServiceFactory::GetForProfile( | 373 GlobalError* error = GlobalErrorServiceFactory::GetForProfile( |
| 382 browser_->profile())->GetGlobalErrorByMenuItemCommandID(command_id); | 374 browser_->profile())->GetGlobalErrorByMenuItemCommandID(command_id); |
| 383 if (error) { | 375 if (error) { |
| 384 error->ExecuteMenuItem(browser_); | 376 error->ExecuteMenuItem(browser_); |
| 385 return; | 377 return; |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 ->GetZoomPercent(); | 935 ->GetZoomPercent(); |
| 944 } | 936 } |
| 945 zoom_label_ = l10n_util::GetStringFUTF16( | 937 zoom_label_ = l10n_util::GetStringFUTF16( |
| 946 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 938 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
| 947 } | 939 } |
| 948 | 940 |
| 949 void AppMenuModel::OnZoomLevelChanged( | 941 void AppMenuModel::OnZoomLevelChanged( |
| 950 const content::HostZoomMap::ZoomLevelChange& change) { | 942 const content::HostZoomMap::ZoomLevelChange& change) { |
| 951 UpdateZoomControls(); | 943 UpdateZoomControls(); |
| 952 } | 944 } |
| OLD | NEW |