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

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: copyright 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
« no previous file with comments | « no previous file | chrome/browser/ui/toolbar/wrench_menu_model_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); 415 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_));
420 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, 416 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU,
421 bookmark_sub_menu_model_.get()); 417 bookmark_sub_menu_model_.get());
422 418
423 AddSeparator(); 419 AddSeparator();
424 #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) 420 #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS)
425 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the 421 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the
426 // layout for this menu item in Toolbar.xib. It does, however, use the 422 // layout for this menu item in Toolbar.xib. It does, however, use the
427 // command_id value from AddButtonItem() to identify this special item. 423 // command_id value from AddButtonItem() to identify this special item.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 tools_menu_model_.reset(new ToolsMenuModel(this, browser_)); 459 tools_menu_model_.reset(new ToolsMenuModel(this, browser_));
464 AddSubMenuWithStringId(IDC_ZOOM_MENU, IDS_TOOLS_MENU, 460 AddSubMenuWithStringId(IDC_ZOOM_MENU, IDS_TOOLS_MENU,
465 tools_menu_model_.get()); 461 tools_menu_model_.get());
466 462
467 AddSeparator(); 463 AddSeparator();
468 464
469 AddItemWithStringId(IDC_SHOW_HISTORY, IDS_SHOW_HISTORY); 465 AddItemWithStringId(IDC_SHOW_HISTORY, IDS_SHOW_HISTORY);
470 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); 466 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS);
471 AddSeparator(); 467 AddSeparator();
472 468
473 #if !defined(OS_CHROMEOS)
474 if (browser_->profile()->GetOriginalProfile()->IsSyncAccessible()) { 469 if (browser_->profile()->GetOriginalProfile()->IsSyncAccessible()) {
475 const string16 short_product_name = 470 const string16 short_product_name =
476 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME); 471 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME);
477 AddItem(IDC_SHOW_SYNC_SETUP, l10n_util::GetStringFUTF16( 472 AddItem(IDC_SHOW_SYNC_SETUP, l10n_util::GetStringFUTF16(
478 IDS_SHOW_SYNC_SETUP, short_product_name)); 473 IDS_SHOW_SYNC_SETUP, short_product_name));
479 AddSeparator(); 474 AddSeparator();
480 } 475 }
481 #endif
482 476
483 #if defined(OS_CHROMEOS) 477 #if defined(OS_MACOSX)
484 AddItemWithStringId(IDC_OPTIONS, IDS_SETTINGS);
485 #elif defined(OS_MACOSX)
486 AddItemWithStringId(IDC_OPTIONS, IDS_PREFERENCES); 478 AddItemWithStringId(IDC_OPTIONS, IDS_PREFERENCES);
487 #elif defined(TOOLKIT_USES_GTK) 479 #elif defined(TOOLKIT_USES_GTK)
488 string16 preferences = gtk_util::GetStockPreferencesMenuLabel(); 480 string16 preferences = gtk_util::GetStockPreferencesMenuLabel();
489 if (!preferences.empty()) 481 if (!preferences.empty())
490 AddItem(IDC_OPTIONS, preferences); 482 AddItem(IDC_OPTIONS, preferences);
491 else 483 else
492 AddItemWithStringId(IDC_OPTIONS, IDS_PREFERENCES); 484 AddItemWithStringId(IDC_OPTIONS, IDS_PREFERENCES);
493 #else 485 #else
494 AddItemWithStringId(IDC_OPTIONS, IDS_OPTIONS); 486 AddItemWithStringId(IDC_OPTIONS, IDS_OPTIONS);
495 #endif 487 #endif
496 488
497 #if defined(OS_CHROMEOS)
498 const string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME);
499 #else
500 const string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); 489 const string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
501 #endif
502 AddItem(IDC_ABOUT, l10n_util::GetStringFUTF16(IDS_ABOUT, product_name)); 490 AddItem(IDC_ABOUT, l10n_util::GetStringFUTF16(IDS_ABOUT, product_name));
503 string16 num_background_pages = base::FormatNumber( 491 string16 num_background_pages = base::FormatNumber(
504 TaskManager::GetBackgroundPageCount()); 492 TaskManager::GetBackgroundPageCount());
505 AddItem(IDC_VIEW_BACKGROUND_PAGES, l10n_util::GetStringFUTF16( 493 AddItem(IDC_VIEW_BACKGROUND_PAGES, l10n_util::GetStringFUTF16(
506 IDS_VIEW_BACKGROUND_PAGES, num_background_pages)); 494 IDS_VIEW_BACKGROUND_PAGES, num_background_pages));
507 AddItem(IDC_UPGRADE_DIALOG, l10n_util::GetStringFUTF16( 495 AddItem(IDC_UPGRADE_DIALOG, l10n_util::GetStringFUTF16(
508 IDS_UPDATE_NOW, product_name)); 496 IDS_UPDATE_NOW, product_name));
509 AddItem(IDC_VIEW_INCOMPATIBILITIES, l10n_util::GetStringUTF16( 497 AddItem(IDC_VIEW_INCOMPATIBILITIES, l10n_util::GetStringUTF16(
510 IDS_VIEW_INCOMPATIBILITIES)); 498 IDS_VIEW_INCOMPATIBILITIES));
511 499
512 #if defined(OS_WIN) 500 #if defined(OS_WIN)
513 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 501 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
514 SetIcon(GetIndexOfCommandId(IDC_VIEW_INCOMPATIBILITIES), 502 SetIcon(GetIndexOfCommandId(IDC_VIEW_INCOMPATIBILITIES),
515 *rb.GetBitmapNamed(IDR_CONFLICT_MENU)); 503 *rb.GetBitmapNamed(IDR_CONFLICT_MENU));
516 #endif 504 #endif
517 505
518 AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); 506 AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE);
519 #if defined(OS_CHROMEOS)
520 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
521 // Use an icon for IDC_HELP_PAGE menu item.
522 SetIcon(GetIndexOfCommandId(IDC_HELP_PAGE),
523 *rb.GetBitmapNamed(IDR_HELP_MENU));
524
525 // Show IDC_FEEDBACK in top-tier wrench menu for ChromeOS.
526 AddItemWithStringId(IDC_FEEDBACK, IDS_FEEDBACK);
527 #endif
528 507
529 if (browser_defaults::kShowExitMenuItem) { 508 if (browser_defaults::kShowExitMenuItem) {
530 AddSeparator(); 509 AddSeparator();
531 #if defined(OS_CHROMEOS)
532 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) {
533 AddItemWithStringId(IDC_EXIT, IDS_EXIT_GUEST_MODE);
534 } else {
535 AddItemWithStringId(IDC_EXIT, IDS_SIGN_OUT);
536 }
537 #else
538 AddItemWithStringId(IDC_EXIT, IDS_EXIT); 510 AddItemWithStringId(IDC_EXIT, IDS_EXIT);
539 #endif
540 } 511 }
541 } 512 }
513 #endif // !OS_CHROMEOS
542 514
543 void WrenchMenuModel::CreateCutCopyPaste() { 515 void WrenchMenuModel::CreateCutCopyPaste() {
544 // WARNING: views/wrench_menu assumes these items are added in this order. If 516 // WARNING: views/wrench_menu assumes these items are added in this order. If
545 // you change the order you'll need to update wrench_menu as well. 517 // you change the order you'll need to update wrench_menu as well.
546 AddItemWithStringId(IDC_CUT, IDS_CUT); 518 AddItemWithStringId(IDC_CUT, IDS_CUT);
547 AddItemWithStringId(IDC_COPY, IDS_COPY); 519 AddItemWithStringId(IDC_COPY, IDS_COPY);
548 AddItemWithStringId(IDC_PASTE, IDS_PASTE); 520 AddItemWithStringId(IDC_PASTE, IDS_PASTE);
549 } 521 }
550 522
551 void WrenchMenuModel::CreateZoomFullscreen() { 523 void WrenchMenuModel::CreateZoomFullscreen() {
(...skipping 13 matching lines...) Expand all
565 &enable_increment, &enable_decrement); 537 &enable_increment, &enable_decrement);
566 } 538 }
567 zoom_label_ = l10n_util::GetStringFUTF16( 539 zoom_label_ = l10n_util::GetStringFUTF16(
568 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); 540 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent));
569 } 541 }
570 542
571 string16 WrenchMenuModel::GetSyncMenuLabel() const { 543 string16 WrenchMenuModel::GetSyncMenuLabel() const {
572 return sync_ui_util::GetSyncMenuLabel( 544 return sync_ui_util::GetSyncMenuLabel(
573 browser_->profile()->GetOriginalProfile()->GetProfileSyncService()); 545 browser_->profile()->GetOriginalProfile()->GetProfileSyncService());
574 } 546 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/toolbar/wrench_menu_model_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698