OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 5 #include "app/l10n_util.h" |
6 #include "app/resource_bundle.h" | 6 #include "app/resource_bundle.h" |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 #if defined(TOOLKIT_GTK) | 491 #if defined(TOOLKIT_GTK) |
492 string16 preferences = gtk_util::GetStockPreferencesMenuLabel(); | 492 string16 preferences = gtk_util::GetStockPreferencesMenuLabel(); |
493 if (preferences.empty()) | 493 if (preferences.empty()) |
494 menu->AddItemWithStringId(IDC_OPTIONS, IDS_OPTIONS); | 494 menu->AddItemWithStringId(IDC_OPTIONS, IDS_OPTIONS); |
495 else | 495 else |
496 menu->AddItem(IDC_OPTIONS, preferences); | 496 menu->AddItem(IDC_OPTIONS, preferences); |
497 #else | 497 #else |
498 menu->AddItemWithStringId(IDC_OPTIONS, IDS_OPTIONS); | 498 menu->AddItemWithStringId(IDC_OPTIONS, IDS_OPTIONS); |
499 #endif | 499 #endif |
500 } | 500 } |
| 501 menu->AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); |
501 menu->AddSeparator(); | 502 menu->AddSeparator(); |
502 int application_position = 0; | 503 int application_position = 0; |
503 context_menu_application_offset_ = menu->GetItemCount(); | 504 context_menu_application_offset_ = menu->GetItemCount(); |
504 for (ExtensionList::const_iterator cursor = applications_.begin(); | 505 for (ExtensionList::const_iterator cursor = applications_.begin(); |
505 cursor != applications_.end(); | 506 cursor != applications_.end(); |
506 ++cursor, ++application_position) { | 507 ++cursor, ++application_position) { |
507 const SkBitmap* icon = applications_.GetIcon(*cursor); | 508 const SkBitmap* icon = applications_.GetIcon(*cursor); |
508 int sort_position = applications_.GetPosition(*cursor); | 509 int sort_position = applications_.GetPosition(*cursor); |
509 DCHECK(sort_position == application_position); | 510 DCHECK(sort_position == application_position); |
510 const std::string& name = (*cursor)->name(); | 511 const std::string& name = (*cursor)->name(); |
(...skipping 23 matching lines...) Expand all Loading... |
534 return false; | 535 return false; |
535 } | 536 } |
536 | 537 |
537 void BackgroundModeManager::RemoveStatusTrayIcon() { | 538 void BackgroundModeManager::RemoveStatusTrayIcon() { |
538 if (status_icon_) | 539 if (status_icon_) |
539 status_tray_->RemoveStatusIcon(status_icon_); | 540 status_tray_->RemoveStatusIcon(status_icon_); |
540 status_icon_ = NULL; | 541 status_icon_ = NULL; |
541 } | 542 } |
542 | 543 |
543 void BackgroundModeManager::ExecuteApplication(int item) { | 544 void BackgroundModeManager::ExecuteApplication(int item) { |
544 DCHECK(item > 0 && item < static_cast<int>(applications_.size())); | 545 DCHECK(item >= 0 && item < static_cast<int>(applications_.size())); |
545 Browser* browser = BrowserList::GetLastActive(); | 546 Browser* browser = BrowserList::GetLastActive(); |
546 if (!browser) { | 547 if (!browser) { |
547 Browser::OpenEmptyWindow(profile_); | 548 Browser::OpenEmptyWindow(profile_); |
548 browser = BrowserList::GetLastActive(); | 549 browser = BrowserList::GetLastActive(); |
549 } | 550 } |
550 const Extension* extension = applications_.GetExtension(item); | 551 const Extension* extension = applications_.GetExtension(item); |
551 browser->OpenApplicationTab(profile_, extension, NULL); | 552 browser->OpenApplicationTab(profile_, extension, NULL); |
552 } | 553 } |
553 | 554 |
554 void BackgroundModeManager::ExecuteCommand(int item) { | 555 void BackgroundModeManager::ExecuteCommand(int item) { |
555 switch (item) { | 556 switch (item) { |
| 557 case IDC_ABOUT: |
| 558 GetBrowserWindow()->OpenAboutChromeDialog(); |
| 559 break; |
556 case IDC_EXIT: | 560 case IDC_EXIT: |
557 UserMetrics::RecordAction(UserMetricsAction("Exit"), profile_); | 561 UserMetrics::RecordAction(UserMetricsAction("Exit"), profile_); |
558 BrowserList::CloseAllBrowsersAndExit(); | 562 BrowserList::CloseAllBrowsersAndExit(); |
559 break; | 563 break; |
560 case IDC_ABOUT: | |
561 GetBrowserWindow()->OpenAboutChromeDialog(); | |
562 break; | |
563 case IDC_OPTIONS: | 564 case IDC_OPTIONS: |
564 GetBrowserWindow()->OpenOptionsDialog(); | 565 GetBrowserWindow()->OpenOptionsDialog(); |
565 break; | 566 break; |
| 567 case IDC_TASK_MANAGER: |
| 568 GetBrowserWindow()->OpenTaskManager(); |
| 569 break; |
566 default: | 570 default: |
567 ExecuteApplication(item); | 571 ExecuteApplication(item); |
568 break; | 572 break; |
569 } | 573 } |
570 } | 574 } |
571 | 575 |
572 Browser* BackgroundModeManager::GetBrowserWindow() { | 576 Browser* BackgroundModeManager::GetBrowserWindow() { |
573 Browser* browser = BrowserList::GetLastActive(); | 577 Browser* browser = BrowserList::GetLastActive(); |
574 if (!browser) { | 578 if (!browser) { |
575 Browser::OpenEmptyWindow(profile_); | 579 Browser::OpenEmptyWindow(profile_); |
576 browser = BrowserList::GetLastActive(); | 580 browser = BrowserList::GetLastActive(); |
577 } | 581 } |
578 return browser; | 582 return browser; |
579 } | 583 } |
580 | 584 |
581 // static | 585 // static |
582 void BackgroundModeManager::RegisterUserPrefs(PrefService* prefs) { | 586 void BackgroundModeManager::RegisterUserPrefs(PrefService* prefs) { |
583 prefs->RegisterBooleanPref(prefs::kBackgroundModeEnabled, true); | 587 prefs->RegisterBooleanPref(prefs::kBackgroundModeEnabled, true); |
584 prefs->RegisterBooleanPref(prefs::kLaunchOnStartupResetAllowed, false); | 588 prefs->RegisterBooleanPref(prefs::kLaunchOnStartupResetAllowed, false); |
585 } | 589 } |
OLD | NEW |