| 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 AddSeparator(ui::SPACING_SEPARATOR); |
| 471 AddItemWithStringId(IDC_WIN8_DESKTOP_RESTART, IDS_WIN8_DESKTOP_RESTART); |
| 472 AddSeparator(ui::SPACING_SEPARATOR); |
| 469 // In Metro, we only show the New Window options if there isn't already | 473 // 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. | 474 // a window of the requested type (incognito or not) that is available. |
| 471 if (browser_->profile()->IsOffTheRecord()) { | 475 if (browser_->profile()->IsOffTheRecord()) { |
| 472 if (browser::FindBrowserWithProfile( | 476 if (browser::FindBrowserWithProfile( |
| 473 browser_->profile()->GetOriginalProfile(), | 477 browser_->profile()->GetOriginalProfile(), |
| 474 browser_->host_desktop_type()) == NULL) { | 478 browser_->host_desktop_type()) == NULL) { |
| 475 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); | 479 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); |
| 476 } | 480 } |
| 477 } else if (!browser_->profile()->HasOffTheRecordProfile()) { | 481 } else if (!browser_->profile()->HasOffTheRecordProfile()) { |
| 478 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); | 482 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); |
| 479 } | 483 } |
| 480 } else { | 484 } else { |
| 485 // Desktop mode. |
| 486 if (base::win::GetVersion() > base::win::VERSION_WIN7) { |
| 487 AddSeparator(ui::SPACING_SEPARATOR); |
| 488 AddItemWithStringId(IDC_WIN8_METRO_RESTART, IDS_WIN8_METRO_RESTART); |
| 489 AddSeparator(ui::SPACING_SEPARATOR); |
| 490 } |
| 481 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); | 491 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); |
| 482 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); | 492 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); |
| 483 } | 493 } |
| 484 #else // defined(OS_WIN) | 494 #else // defined(OS_WIN) |
| 485 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); | 495 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); |
| 486 #if defined(OS_CHROMEOS) | 496 #if defined(OS_CHROMEOS) |
| 487 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) | 497 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) |
| 488 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); | 498 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); |
| 489 #else | 499 #else |
| 490 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); | 500 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( | 696 zoom_label_ = l10n_util::GetStringFUTF16( |
| 687 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 697 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
| 688 } | 698 } |
| 689 | 699 |
| 690 string16 WrenchMenuModel::GetSyncMenuLabel() const { | 700 string16 WrenchMenuModel::GetSyncMenuLabel() const { |
| 691 Profile* profile = browser_->profile()->GetOriginalProfile(); | 701 Profile* profile = browser_->profile()->GetOriginalProfile(); |
| 692 return sync_ui_util::GetSyncMenuLabel( | 702 return sync_ui_util::GetSyncMenuLabel( |
| 693 ProfileSyncServiceFactory::GetForProfile(profile), | 703 ProfileSyncServiceFactory::GetForProfile(profile), |
| 694 *SigninManagerFactory::GetForProfile(profile)); | 704 *SigninManagerFactory::GetForProfile(profile)); |
| 695 } | 705 } |
| OLD | NEW |