| OLD | NEW |
| 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/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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 if (command_id == IDC_SHOW_BOOKMARK_BAR) { | 311 if (command_id == IDC_SHOW_BOOKMARK_BAR) { |
| 312 return browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); | 312 return browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); |
| 313 } else if (command_id == IDC_PROFILING_ENABLED) { | 313 } else if (command_id == IDC_PROFILING_ENABLED) { |
| 314 return Profiling::BeingProfiled(); | 314 return Profiling::BeingProfiled(); |
| 315 } | 315 } |
| 316 | 316 |
| 317 return false; | 317 return false; |
| 318 } | 318 } |
| 319 | 319 |
| 320 bool WrenchMenuModel::IsCommandIdEnabled(int command_id) const { | 320 bool WrenchMenuModel::IsCommandIdEnabled(int command_id) const { |
| 321 switch (command_id) { | 321 return browser_->command_updater()->IsCommandEnabled(command_id); |
| 322 case IDC_SHOW_BOOKMARK_BAR: | |
| 323 return !browser_->profile()->GetPrefs()->IsManagedPreference( | |
| 324 prefs::kEnableBookmarkBar); | |
| 325 default: | |
| 326 return browser_->command_updater()->IsCommandEnabled(command_id); | |
| 327 } | |
| 328 } | 322 } |
| 329 | 323 |
| 330 bool WrenchMenuModel::IsCommandIdVisible(int command_id) const { | 324 bool WrenchMenuModel::IsCommandIdVisible(int command_id) const { |
| 331 if (command_id == IDC_UPGRADE_DIALOG) { | 325 if (command_id == IDC_UPGRADE_DIALOG) { |
| 332 return UpgradeDetector::GetInstance()->notify_upgrade(); | 326 return UpgradeDetector::GetInstance()->notify_upgrade(); |
| 333 } else if (command_id == IDC_VIEW_INCOMPATIBILITIES) { | 327 } else if (command_id == IDC_VIEW_INCOMPATIBILITIES) { |
| 334 #if defined(OS_WIN) | 328 #if defined(OS_WIN) |
| 335 EnumerateModulesModel* loaded_modules = | 329 EnumerateModulesModel* loaded_modules = |
| 336 EnumerateModulesModel::GetInstance(); | 330 EnumerateModulesModel::GetInstance(); |
| 337 if (loaded_modules->confirmed_bad_modules_detected() <= 0) | 331 if (loaded_modules->confirmed_bad_modules_detected() <= 0) |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 &enable_increment, &enable_decrement); | 549 &enable_increment, &enable_decrement); |
| 556 } | 550 } |
| 557 zoom_label_ = l10n_util::GetStringFUTF16( | 551 zoom_label_ = l10n_util::GetStringFUTF16( |
| 558 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 552 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
| 559 } | 553 } |
| 560 | 554 |
| 561 string16 WrenchMenuModel::GetSyncMenuLabel() const { | 555 string16 WrenchMenuModel::GetSyncMenuLabel() const { |
| 562 return sync_ui_util::GetSyncMenuLabel( | 556 return sync_ui_util::GetSyncMenuLabel( |
| 563 browser_->profile()->GetOriginalProfile()->GetProfileSyncService()); | 557 browser_->profile()->GetOriginalProfile()->GetProfileSyncService()); |
| 564 } | 558 } |
| OLD | NEW |