| 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" |
| 11 #include "base/i18n/number_formatting.h" | 11 #include "base/i18n/number_formatting.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/defaults.h" | 18 #include "chrome/browser/defaults.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 21 #include "chrome/browser/signin/signin_manager.h" |
| 22 #include "chrome/browser/signin/signin_manager_factory.h" |
| 21 #include "chrome/browser/signin/signin_ui_util.h" | 23 #include "chrome/browser/signin/signin_ui_util.h" |
| 22 #include "chrome/browser/task_manager/task_manager.h" | 24 #include "chrome/browser/task_manager/task_manager.h" |
| 23 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_commands.h" | 26 #include "chrome/browser/ui/browser_commands.h" |
| 25 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
| 26 #include "chrome/browser/ui/browser_window.h" | 28 #include "chrome/browser/ui/browser_window.h" |
| 27 #include "chrome/browser/ui/global_error/global_error.h" | 29 #include "chrome/browser/ui/global_error/global_error.h" |
| 28 #include "chrome/browser/ui/global_error/global_error_service.h" | 30 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 29 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 31 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 30 #include "chrome/browser/ui/search/search.h" | 32 #include "chrome/browser/ui/search/search.h" |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 CreateZoomMenu(is_new_menu); | 545 CreateZoomMenu(is_new_menu); |
| 544 else | 546 else |
| 545 AddSeparator(ui::NORMAL_SEPARATOR); | 547 AddSeparator(ui::NORMAL_SEPARATOR); |
| 546 | 548 |
| 547 AddItemWithStringId(IDC_SHOW_HISTORY, IDS_SHOW_HISTORY); | 549 AddItemWithStringId(IDC_SHOW_HISTORY, IDS_SHOW_HISTORY); |
| 548 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); | 550 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); |
| 549 AddSeparator(ui::NORMAL_SEPARATOR); | 551 AddSeparator(ui::NORMAL_SEPARATOR); |
| 550 | 552 |
| 551 #if !defined(OS_CHROMEOS) | 553 #if !defined(OS_CHROMEOS) |
| 552 // No "Sign in to Chromium..." menu item on ChromeOS. | 554 // No "Sign in to Chromium..." menu item on ChromeOS. |
| 553 const string16 short_product_name = | 555 SigninManager* signin = SigninManagerFactory::GetForProfile( |
| 554 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME); | 556 browser_->profile()->GetOriginalProfile()); |
| 555 AddItem(IDC_SHOW_SYNC_SETUP, l10n_util::GetStringFUTF16( | 557 if (signin && signin->IsSigninAllowed()) { |
| 556 IDS_SYNC_MENU_PRE_SYNCED_LABEL, short_product_name)); | 558 const string16 short_product_name = |
| 557 AddSeparator(ui::NORMAL_SEPARATOR); | 559 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME); |
| 560 AddItem(IDC_SHOW_SYNC_SETUP, l10n_util::GetStringFUTF16( |
| 561 IDS_SYNC_MENU_PRE_SYNCED_LABEL, short_product_name)); |
| 562 AddSeparator(ui::NORMAL_SEPARATOR); |
| 563 } |
| 558 #endif | 564 #endif |
| 559 | 565 |
| 560 AddItemWithStringId(IDC_OPTIONS, IDS_SETTINGS); | 566 AddItemWithStringId(IDC_OPTIONS, IDS_SETTINGS); |
| 561 | 567 |
| 562 #if defined(OS_CHROMEOS) | 568 #if defined(OS_CHROMEOS) |
| 563 if (CommandLine::ForCurrentProcess()->HasSwitch( | 569 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 564 switches::kEnableRequestTabletSite)) | 570 switches::kEnableRequestTabletSite)) |
| 565 AddCheckItemWithStringId(IDC_TOGGLE_REQUEST_TABLET_SITE, | 571 AddCheckItemWithStringId(IDC_TOGGLE_REQUEST_TABLET_SITE, |
| 566 IDS_TOGGLE_REQUEST_TABLET_SITE); | 572 IDS_TOGGLE_REQUEST_TABLET_SITE); |
| 567 #endif | 573 #endif |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 browser_->tab_strip_model()->GetActiveWebContents()->GetZoomPercent( | 715 browser_->tab_strip_model()->GetActiveWebContents()->GetZoomPercent( |
| 710 &enable_increment, &enable_decrement); | 716 &enable_increment, &enable_decrement); |
| 711 } | 717 } |
| 712 zoom_label_ = l10n_util::GetStringFUTF16( | 718 zoom_label_ = l10n_util::GetStringFUTF16( |
| 713 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 719 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
| 714 } | 720 } |
| 715 | 721 |
| 716 void WrenchMenuModel::OnZoomLevelChanged(const std::string& host) { | 722 void WrenchMenuModel::OnZoomLevelChanged(const std::string& host) { |
| 717 UpdateZoomControls(); | 723 UpdateZoomControls(); |
| 718 } | 724 } |
| OLD | NEW |