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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #include <gtk/gtk.h> | 63 #include <gtk/gtk.h> |
64 #include "chrome/browser/ui/gtk/gtk_util.h" | 64 #include "chrome/browser/ui/gtk/gtk_util.h" |
65 #endif | 65 #endif |
66 | 66 |
67 #if defined(OS_WIN) | 67 #if defined(OS_WIN) |
68 #include "base/win/metro.h" | 68 #include "base/win/metro.h" |
69 #include "base/win/windows_version.h" | 69 #include "base/win/windows_version.h" |
70 #include "chrome/browser/enumerate_modules_model_win.h" | 70 #include "chrome/browser/enumerate_modules_model_win.h" |
71 #endif | 71 #endif |
72 | 72 |
| 73 #if defined(USE_ASH) |
| 74 #include "ash/shell.h" |
| 75 #endif |
| 76 |
73 using content::HostZoomMap; | 77 using content::HostZoomMap; |
74 using content::UserMetricsAction; | 78 using content::UserMetricsAction; |
75 using content::WebContents; | 79 using content::WebContents; |
76 | 80 |
77 //////////////////////////////////////////////////////////////////////////////// | 81 //////////////////////////////////////////////////////////////////////////////// |
78 // EncodingMenuModel | 82 // EncodingMenuModel |
79 | 83 |
80 EncodingMenuModel::EncodingMenuModel(Browser* browser) | 84 EncodingMenuModel::EncodingMenuModel(Browser* browser) |
81 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), | 85 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), |
82 browser_(browser) { | 86 browser_(browser) { |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); | 494 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); |
491 #if defined(OS_CHROMEOS) | 495 #if defined(OS_CHROMEOS) |
492 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) | 496 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) |
493 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); | 497 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); |
494 #else | 498 #else |
495 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); | 499 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); |
496 #endif | 500 #endif |
497 | 501 |
498 #endif // else of defined(OS_WIN) | 502 #endif // else of defined(OS_WIN) |
499 | 503 |
| 504 #if defined(USE_ASH) |
| 505 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAsh)) { |
| 506 if (!ash::Shell::HasInstance()) |
| 507 AddItemWithStringId(IDC_TOGGLE_ASH_DESKTOP, IDS_OPEN_ASH_DESKTOP); |
| 508 else |
| 509 AddItemWithStringId(IDC_TOGGLE_ASH_DESKTOP, IDS_CLOSE_ASH_DESKTOP); |
| 510 } |
| 511 #endif |
| 512 |
500 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); | 513 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); |
501 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, | 514 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, |
502 bookmark_sub_menu_model_.get()); | 515 bookmark_sub_menu_model_.get()); |
503 | 516 |
504 #if defined(OS_WIN) | 517 #if defined(OS_WIN) |
505 if (base::win::IsMetroProcess()) { | 518 if (base::win::IsMetroProcess()) { |
506 // Metro mode, add the 'Relaunch Chrome in desktop mode'. | 519 // Metro mode, add the 'Relaunch Chrome in desktop mode'. |
507 AddSeparator(ui::SPACING_SEPARATOR); | 520 AddSeparator(ui::SPACING_SEPARATOR); |
508 AddItemWithStringId(IDC_WIN8_DESKTOP_RESTART, IDS_WIN8_DESKTOP_RESTART); | 521 AddItemWithStringId(IDC_WIN8_DESKTOP_RESTART, IDS_WIN8_DESKTOP_RESTART); |
509 AddSeparator(ui::SPACING_SEPARATOR); | 522 AddSeparator(ui::SPACING_SEPARATOR); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 zoom_label_ = l10n_util::GetStringFUTF16( | 719 zoom_label_ = l10n_util::GetStringFUTF16( |
707 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 720 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
708 } | 721 } |
709 | 722 |
710 string16 WrenchMenuModel::GetSyncMenuLabel() const { | 723 string16 WrenchMenuModel::GetSyncMenuLabel() const { |
711 Profile* profile = browser_->profile()->GetOriginalProfile(); | 724 Profile* profile = browser_->profile()->GetOriginalProfile(); |
712 return sync_ui_util::GetSyncMenuLabel( | 725 return sync_ui_util::GetSyncMenuLabel( |
713 ProfileSyncServiceFactory::GetForProfile(profile), | 726 ProfileSyncServiceFactory::GetForProfile(profile), |
714 *SigninManagerFactory::GetForProfile(profile)); | 727 *SigninManagerFactory::GetForProfile(profile)); |
715 } | 728 } |
OLD | NEW |