| 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/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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 ProfileSyncService* service = | 326 ProfileSyncService* service = |
| 327 ProfileSyncServiceFactory::GetInstance()->GetForProfile( | 327 ProfileSyncServiceFactory::GetInstance()->GetForProfile( |
| 328 browser_->profile()->GetOriginalProfile()); | 328 browser_->profile()->GetOriginalProfile()); |
| 329 SyncGlobalError* error = service->sync_global_error(); | 329 SyncGlobalError* error = service->sync_global_error(); |
| 330 if (error && error->HasCustomizedSyncMenuItem()) { | 330 if (error && error->HasCustomizedSyncMenuItem()) { |
| 331 error->ExecuteMenuItem(browser_); | 331 error->ExecuteMenuItem(browser_); |
| 332 return; | 332 return; |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 | 335 |
| 336 if (command_id == IDC_HELP_PAGE) | 336 if (command_id == IDC_HELP_PAGE_VIA_MENU) |
| 337 content::RecordAction(UserMetricsAction("ShowHelpTabViaWrenchMenu")); | 337 content::RecordAction(UserMetricsAction("ShowHelpTabViaWrenchMenu")); |
| 338 | 338 |
| 339 browser_->ExecuteCommand(command_id); | 339 browser_->ExecuteCommand(command_id); |
| 340 } | 340 } |
| 341 | 341 |
| 342 bool WrenchMenuModel::IsCommandIdChecked(int command_id) const { | 342 bool WrenchMenuModel::IsCommandIdChecked(int command_id) const { |
| 343 if (command_id == IDC_SHOW_BOOKMARK_BAR) { | 343 if (command_id == IDC_SHOW_BOOKMARK_BAR) { |
| 344 return browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); | 344 return browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); |
| 345 } else if (command_id == IDC_PROFILING_ENABLED) { | 345 } else if (command_id == IDC_PROFILING_ENABLED) { |
| 346 return Profiling::BeingProfiled(); | 346 return Profiling::BeingProfiled(); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 AddItem(IDC_VIEW_INCOMPATIBILITIES, l10n_util::GetStringUTF16( | 497 AddItem(IDC_VIEW_INCOMPATIBILITIES, l10n_util::GetStringUTF16( |
| 498 IDS_VIEW_INCOMPATIBILITIES)); | 498 IDS_VIEW_INCOMPATIBILITIES)); |
| 499 | 499 |
| 500 #if defined(OS_WIN) | 500 #if defined(OS_WIN) |
| 501 SetIcon(GetIndexOfCommandId(IDC_VIEW_INCOMPATIBILITIES), | 501 SetIcon(GetIndexOfCommandId(IDC_VIEW_INCOMPATIBILITIES), |
| 502 *ui::ResourceBundle::GetSharedInstance(). | 502 *ui::ResourceBundle::GetSharedInstance(). |
| 503 GetImageSkiaNamed(IDR_CONFLICT_MENU)); | 503 GetImageSkiaNamed(IDR_CONFLICT_MENU)); |
| 504 #endif | 504 #endif |
| 505 | 505 |
| 506 if (!is_touch_menu) { | 506 if (!is_touch_menu) { |
| 507 AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); | 507 AddItemWithStringId(IDC_HELP_PAGE_VIA_MENU, IDS_HELP_PAGE); |
| 508 | 508 |
| 509 if (browser_defaults::kShowHelpMenuItemIcon) { | 509 if (browser_defaults::kShowHelpMenuItemIcon) { |
| 510 ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 510 ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 511 SetIcon(GetIndexOfCommandId(IDC_HELP_PAGE), | 511 SetIcon(GetIndexOfCommandId(IDC_HELP_PAGE_VIA_MENU), |
| 512 *rb.GetImageSkiaNamed(IDR_HELP_MENU)); | 512 *rb.GetImageSkiaNamed(IDR_HELP_MENU)); |
| 513 } | 513 } |
| 514 } | 514 } |
| 515 | 515 |
| 516 if (browser_defaults::kShowFeedbackMenuItem) | 516 if (browser_defaults::kShowFeedbackMenuItem) |
| 517 AddItemWithStringId(IDC_FEEDBACK, IDS_FEEDBACK); | 517 AddItemWithStringId(IDC_FEEDBACK, IDS_FEEDBACK); |
| 518 | 518 |
| 519 AddGlobalErrorMenuItems(); | 519 AddGlobalErrorMenuItems(); |
| 520 | 520 |
| 521 if (browser_defaults::kShowExitMenuItem) { | 521 if (browser_defaults::kShowExitMenuItem) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 zoom_label_ = l10n_util::GetStringFUTF16( | 613 zoom_label_ = l10n_util::GetStringFUTF16( |
| 614 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 614 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
| 615 } | 615 } |
| 616 | 616 |
| 617 string16 WrenchMenuModel::GetSyncMenuLabel() const { | 617 string16 WrenchMenuModel::GetSyncMenuLabel() const { |
| 618 Profile* profile = browser_->profile()->GetOriginalProfile(); | 618 Profile* profile = browser_->profile()->GetOriginalProfile(); |
| 619 return sync_ui_util::GetSyncMenuLabel( | 619 return sync_ui_util::GetSyncMenuLabel( |
| 620 ProfileSyncServiceFactory::GetForProfile(profile), | 620 ProfileSyncServiceFactory::GetForProfile(profile), |
| 621 *SigninManagerFactory::GetForProfile(profile)); | 621 *SigninManagerFactory::GetForProfile(profile)); |
| 622 } | 622 } |
| OLD | NEW |