Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: chrome/browser/ui/toolbar/wrench_menu_model.cc

Issue 7825024: For Touch: remove some menu items for experimentation, adjust sizes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Typo Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 } 399 }
400 400
401 // For testing. 401 // For testing.
402 WrenchMenuModel::WrenchMenuModel() 402 WrenchMenuModel::WrenchMenuModel()
403 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), 403 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)),
404 provider_(NULL), 404 provider_(NULL),
405 browser_(NULL), 405 browser_(NULL),
406 tabstrip_model_(NULL) { 406 tabstrip_model_(NULL) {
407 } 407 }
408 408
409 #if !defined(OS_CHROMEOS)
409 void WrenchMenuModel::Build() { 410 void WrenchMenuModel::Build() {
410 AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB); 411 AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB);
411 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); 412 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW);
412 #if defined(OS_CHROMEOS)
413 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession))
414 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW);
415 #else
416 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); 413 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW);
417 #endif
418 414
419 AddSeparator(); 415 AddSeparator();
420 #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) 416 #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS)
421 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the 417 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the
422 // layout for this menu item in Toolbar.xib. It does, however, use the 418 // layout for this menu item in Toolbar.xib. It does, however, use the
423 // command_id value from AddButtonItem() to identify this special item. 419 // command_id value from AddButtonItem() to identify this special item.
424 edit_menu_item_model_.reset(new ui::ButtonMenuItemModel(IDS_EDIT, this)); 420 edit_menu_item_model_.reset(new ui::ButtonMenuItemModel(IDS_EDIT, this));
425 edit_menu_item_model_->AddGroupItemWithStringId(IDC_CUT, IDS_CUT); 421 edit_menu_item_model_->AddGroupItemWithStringId(IDC_CUT, IDS_CUT);
426 edit_menu_item_model_->AddGroupItemWithStringId(IDC_COPY, IDS_COPY); 422 edit_menu_item_model_->AddGroupItemWithStringId(IDC_COPY, IDS_COPY);
427 edit_menu_item_model_->AddGroupItemWithStringId(IDC_PASTE, IDS_PASTE); 423 edit_menu_item_model_->AddGroupItemWithStringId(IDC_PASTE, IDS_PASTE);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 458
463 AddSeparator(); 459 AddSeparator();
464 460
465 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); 461 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_));
466 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, 462 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU,
467 bookmark_sub_menu_model_.get()); 463 bookmark_sub_menu_model_.get());
468 AddItemWithStringId(IDC_SHOW_HISTORY, IDS_SHOW_HISTORY); 464 AddItemWithStringId(IDC_SHOW_HISTORY, IDS_SHOW_HISTORY);
469 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); 465 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS);
470 AddSeparator(); 466 AddSeparator();
471 467
472 #if !defined(OS_CHROMEOS)
473 if (browser_->profile()->GetOriginalProfile()->IsSyncAccessible()) { 468 if (browser_->profile()->GetOriginalProfile()->IsSyncAccessible()) {
474 const string16 short_product_name = 469 const string16 short_product_name =
475 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME); 470 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME);
476 AddItem(IDC_SHOW_SYNC_SETUP, l10n_util::GetStringFUTF16( 471 AddItem(IDC_SHOW_SYNC_SETUP, l10n_util::GetStringFUTF16(
477 IDS_SHOW_SYNC_SETUP, short_product_name)); 472 IDS_SHOW_SYNC_SETUP, short_product_name));
478 AddSeparator(); 473 AddSeparator();
479 } 474 }
480 #endif
481 475
482 #if defined(OS_CHROMEOS) 476 #if defined(OS_MACOSX)
483 AddItemWithStringId(IDC_OPTIONS, IDS_SETTINGS);
484 #elif defined(OS_MACOSX)
485 AddItemWithStringId(IDC_OPTIONS, IDS_PREFERENCES); 477 AddItemWithStringId(IDC_OPTIONS, IDS_PREFERENCES);
486 #elif defined(TOOLKIT_USES_GTK) 478 #elif defined(TOOLKIT_USES_GTK)
487 string16 preferences = gtk_util::GetStockPreferencesMenuLabel(); 479 string16 preferences = gtk_util::GetStockPreferencesMenuLabel();
488 if (!preferences.empty()) 480 if (!preferences.empty())
489 AddItem(IDC_OPTIONS, preferences); 481 AddItem(IDC_OPTIONS, preferences);
490 else 482 else
491 AddItemWithStringId(IDC_OPTIONS, IDS_PREFERENCES); 483 AddItemWithStringId(IDC_OPTIONS, IDS_PREFERENCES);
492 #else 484 #else
493 AddItemWithStringId(IDC_OPTIONS, IDS_OPTIONS); 485 AddItemWithStringId(IDC_OPTIONS, IDS_OPTIONS);
494 #endif 486 #endif
495 487
496 #if defined(OS_CHROMEOS)
497 const string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME);
498 #else
499 const string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); 488 const string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
500 #endif
501 AddItem(IDC_ABOUT, l10n_util::GetStringFUTF16(IDS_ABOUT, product_name)); 489 AddItem(IDC_ABOUT, l10n_util::GetStringFUTF16(IDS_ABOUT, product_name));
502 string16 num_background_pages = base::FormatNumber( 490 string16 num_background_pages = base::FormatNumber(
503 TaskManager::GetBackgroundPageCount()); 491 TaskManager::GetBackgroundPageCount());
504 AddItem(IDC_VIEW_BACKGROUND_PAGES, l10n_util::GetStringFUTF16( 492 AddItem(IDC_VIEW_BACKGROUND_PAGES, l10n_util::GetStringFUTF16(
505 IDS_VIEW_BACKGROUND_PAGES, num_background_pages)); 493 IDS_VIEW_BACKGROUND_PAGES, num_background_pages));
506 AddItem(IDC_UPGRADE_DIALOG, l10n_util::GetStringFUTF16( 494 AddItem(IDC_UPGRADE_DIALOG, l10n_util::GetStringFUTF16(
507 IDS_UPDATE_NOW, product_name)); 495 IDS_UPDATE_NOW, product_name));
508 AddItem(IDC_VIEW_INCOMPATIBILITIES, l10n_util::GetStringUTF16( 496 AddItem(IDC_VIEW_INCOMPATIBILITIES, l10n_util::GetStringUTF16(
509 IDS_VIEW_INCOMPATIBILITIES)); 497 IDS_VIEW_INCOMPATIBILITIES));
510 498
511 #if defined(OS_WIN) 499 #if defined(OS_WIN)
512 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 500 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
513 SetIcon(GetIndexOfCommandId(IDC_VIEW_INCOMPATIBILITIES), 501 SetIcon(GetIndexOfCommandId(IDC_VIEW_INCOMPATIBILITIES),
514 *rb.GetBitmapNamed(IDR_CONFLICT_MENU)); 502 *rb.GetBitmapNamed(IDR_CONFLICT_MENU));
515 #endif 503 #endif
516 504
517 AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); 505 AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE);
518 #if defined(OS_CHROMEOS)
519 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
520 // Use an icon for IDC_HELP_PAGE menu item.
521 SetIcon(GetIndexOfCommandId(IDC_HELP_PAGE),
522 *rb.GetBitmapNamed(IDR_HELP_MENU));
523
524 // Show IDC_FEEDBACK in top-tier wrench menu for ChromeOS.
525 AddItemWithStringId(IDC_FEEDBACK, IDS_FEEDBACK);
526 #endif
527 506
528 if (browser_defaults::kShowExitMenuItem) { 507 if (browser_defaults::kShowExitMenuItem) {
529 AddSeparator(); 508 AddSeparator();
530 #if defined(OS_CHROMEOS)
531 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) {
532 AddItemWithStringId(IDC_EXIT, IDS_EXIT_GUEST_MODE);
533 } else {
534 AddItemWithStringId(IDC_EXIT, IDS_SIGN_OUT);
535 }
536 #else
537 AddItemWithStringId(IDC_EXIT, IDS_EXIT); 509 AddItemWithStringId(IDC_EXIT, IDS_EXIT);
538 #endif
539 } 510 }
540 } 511 }
512 #endif // !OS_CHROMEOS
541 513
542 void WrenchMenuModel::CreateCutCopyPaste() { 514 void WrenchMenuModel::CreateCutCopyPaste() {
543 // WARNING: views/wrench_menu assumes these items are added in this order. If 515 // WARNING: views/wrench_menu assumes these items are added in this order. If
544 // you change the order you'll need to update wrench_menu as well. 516 // you change the order you'll need to update wrench_menu as well.
545 AddItemWithStringId(IDC_CUT, IDS_CUT); 517 AddItemWithStringId(IDC_CUT, IDS_CUT);
546 AddItemWithStringId(IDC_COPY, IDS_COPY); 518 AddItemWithStringId(IDC_COPY, IDS_COPY);
547 AddItemWithStringId(IDC_PASTE, IDS_PASTE); 519 AddItemWithStringId(IDC_PASTE, IDS_PASTE);
548 } 520 }
549 521
550 void WrenchMenuModel::CreateZoomFullscreen() { 522 void WrenchMenuModel::CreateZoomFullscreen() {
(...skipping 13 matching lines...) Expand all
564 &enable_increment, &enable_decrement); 536 &enable_increment, &enable_decrement);
565 } 537 }
566 zoom_label_ = l10n_util::GetStringFUTF16( 538 zoom_label_ = l10n_util::GetStringFUTF16(
567 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); 539 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent));
568 } 540 }
569 541
570 string16 WrenchMenuModel::GetSyncMenuLabel() const { 542 string16 WrenchMenuModel::GetSyncMenuLabel() const {
571 return sync_ui_util::GetSyncMenuLabel( 543 return sync_ui_util::GetSyncMenuLabel(
572 browser_->profile()->GetOriginalProfile()->GetProfileSyncService()); 544 browser_->profile()->GetOriginalProfile()->GetProfileSyncService());
573 } 545 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698