summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoridanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 14:14:35 +0000
committeridanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 14:14:35 +0000
commit985b4bebe40fcf7af248c4580fa8cf0d503f87a7 (patch)
tree927aa54a2e0bfc320eaf970e239de095f9dcf4dc /chrome
parent9b9d728c445b3c1c2ac0b3f66753a205dc2eafc3 (diff)
downloadchromium_src-985b4bebe40fcf7af248c4580fa8cf0d503f87a7.zip
chromium_src-985b4bebe40fcf7af248c4580fa8cf0d503f87a7.tar.gz
chromium_src-985b4bebe40fcf7af248c4580fa8cf0d503f87a7.tar.bz2
Added restore and add tab to the system menu so that these operations
can be done from there. BUG=2144 Review URL: http://codereview.chromium.org/62113 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13348 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/generated_resources.grd3
-rw-r--r--chrome/browser/views/frame/browser_view.cc15
2 files changed, 15 insertions, 3 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 394a5c0..3a69196 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -571,6 +571,9 @@ each locale. -->
<message name="IDS_TASK_MANAGER" desc="The text label of the Task Manager menu item" >
&amp;Task manager
</message>
+ <message name="IDS_RESTORE_TAB" desc="The text label of the Restore Tab menu item" >
+ &amp;Undo Tab Close
+ </message>
<!-- This really belongs under Generic Terms above. -->
<message name="IDS_CLOSE" desc="A generic term for Close on buttons and menus.">
Close
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index be51672..b746436 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -37,6 +37,7 @@
#include "chrome/browser/views/tabs/tab_strip.h"
#include "chrome/browser/views/toolbar_star_toggle.h"
#include "chrome/browser/views/toolbar_view.h"
+#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/browser/tab_contents/web_contents_view.h"
@@ -120,6 +121,7 @@ static const struct {
{ false, IDC_SHOW_AS_TAB, IDS_SHOW_AS_TAB },
{ false, IDC_COPY_URL, IDS_APP_MENU_COPY_URL },
{ false, IDC_DUPLICATE_TAB, IDS_APP_MENU_DUPLICATE_APP_WINDOW },
+ { false, IDC_RESTORE_TAB, IDS_RESTORE_TAB },
{ true, 0, 0 },
{ false, IDC_RELOAD, IDS_APP_MENU_RELOAD },
{ false, IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD },
@@ -415,9 +417,11 @@ void BrowserView::PrepareToRunSystemMenu(HMENU menu) {
// |command| can be zero on submenu items (IDS_ENCODING,
// IDS_ZOOM) and on separators.
if (command != 0) {
- system_menu_->EnableMenuItemByID(
- command,
- browser_->command_updater()->IsCommandEnabled(command));
+ bool enabled = browser_->command_updater()->IsCommandEnabled(command);
+ if (enabled && command == IDC_RESTORE_TAB)
+ enabled = browser_->profile()->GetTabRestoreService() &&
+ !browser_->profile()->GetTabRestoreService()->entries().empty();
+ system_menu_->EnableMenuItemByID(command, enabled);
}
}
}
@@ -1249,6 +1253,11 @@ void BrowserView::InitSystemMenu() {
system_menu_->AddSeparator(insertion_index);
system_menu_->AddMenuItemWithLabel(insertion_index, IDC_TASK_MANAGER,
l10n_util::GetString(IDS_TASK_MANAGER));
+ system_menu_->AddSeparator(insertion_index);
+ system_menu_->AddMenuItemWithLabel(insertion_index, IDC_RESTORE_TAB,
+ l10n_util::GetString(IDS_RESTORE_TAB));
+ system_menu_->AddMenuItemWithLabel(insertion_index, IDC_NEW_TAB,
+ l10n_util::GetString(IDS_NEW_TAB));
// If it's a regular browser window with tabs, we don't add any more items,
// since it already has menus (Page, Chrome).
} else {