Chromium Code Reviews| 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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 #endif | 459 #endif |
| 460 | 460 |
| 461 #if defined(USE_AURA) | 461 #if defined(USE_AURA) |
| 462 if (is_new_menu) | 462 if (is_new_menu) |
| 463 AddSeparator(ui::SPACING_SEPARATOR); | 463 AddSeparator(ui::SPACING_SEPARATOR); |
| 464 #endif | 464 #endif |
| 465 | 465 |
| 466 AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB); | 466 AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB); |
| 467 #if defined(OS_WIN) | 467 #if defined(OS_WIN) |
| 468 if (base::win::IsMetroProcess()) { | 468 if (base::win::IsMetroProcess()) { |
| 469 // Metro mode. | |
| 470 if (base::win::GetVersion() > base::win::VERSION_WIN7) { | |
|
ananta
2012/09/06 18:36:42
We can safely remove the version check here given
| |
| 471 AddSeparator(ui::SPACING_SEPARATOR); | |
| 472 AddItemWithStringId(IDC_WIN8_DESKTOP_RESTART, IDS_WIN8_DESKTOP_RESTART); | |
| 473 AddSeparator(ui::SPACING_SEPARATOR); | |
| 474 } | |
| 469 // In Metro, we only show the New Window options if there isn't already | 475 // In Metro, we only show the New Window options if there isn't already |
| 470 // a the window of the requested type (incognito or not) that is available. | 476 // a window of the requested type (incognito or not) that is available. |
| 471 if (browser_->profile()->IsOffTheRecord()) { | 477 if (browser_->profile()->IsOffTheRecord()) { |
| 472 if (browser::FindBrowserWithProfile( | 478 if (browser::FindBrowserWithProfile( |
| 473 browser_->profile()->GetOriginalProfile(), | 479 browser_->profile()->GetOriginalProfile(), |
| 474 browser_->host_desktop_type()) == NULL) { | 480 browser_->host_desktop_type()) == NULL) { |
| 475 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); | 481 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); |
| 476 } | 482 } |
| 477 } else if (!browser_->profile()->HasOffTheRecordProfile()) { | 483 } else if (!browser_->profile()->HasOffTheRecordProfile()) { |
| 478 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); | 484 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); |
| 479 } | 485 } |
| 480 } else { | 486 } else { |
| 487 // Desktop mode. | |
| 488 if (base::win::GetVersion() > base::win::VERSION_WIN7) { | |
| 489 AddSeparator(ui::SPACING_SEPARATOR); | |
| 490 AddItemWithStringId(IDC_WIN8_METRO_RESTART, IDS_WIN8_METRO_RESTART); | |
| 491 AddSeparator(ui::SPACING_SEPARATOR); | |
| 492 } | |
| 481 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); | 493 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); |
| 482 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); | 494 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); |
| 483 } | 495 } |
| 484 #else // defined(OS_WIN) | 496 #else // defined(OS_WIN) |
| 485 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); | 497 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); |
| 486 #if defined(OS_CHROMEOS) | 498 #if defined(OS_CHROMEOS) |
| 487 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) | 499 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) |
| 488 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); | 500 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); |
| 489 #else | 501 #else |
| 490 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); | 502 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 686 zoom_label_ = l10n_util::GetStringFUTF16( | 698 zoom_label_ = l10n_util::GetStringFUTF16( |
| 687 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 699 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
| 688 } | 700 } |
| 689 | 701 |
| 690 string16 WrenchMenuModel::GetSyncMenuLabel() const { | 702 string16 WrenchMenuModel::GetSyncMenuLabel() const { |
| 691 Profile* profile = browser_->profile()->GetOriginalProfile(); | 703 Profile* profile = browser_->profile()->GetOriginalProfile(); |
| 692 return sync_ui_util::GetSyncMenuLabel( | 704 return sync_ui_util::GetSyncMenuLabel( |
| 693 ProfileSyncServiceFactory::GetForProfile(profile), | 705 ProfileSyncServiceFactory::GetForProfile(profile), |
| 694 *SigninManagerFactory::GetForProfile(profile)); | 706 *SigninManagerFactory::GetForProfile(profile)); |
| 695 } | 707 } |
| OLD | NEW |