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

Side by Side Diff: chrome/browser/views/frame/browser_view.cc

Issue 62113: Added restore and add tab to the system menu so that these operations... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | « chrome/app/generated_resources.grd ('k') | no next file » | 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/views/frame/browser_view.h" 5 #include "chrome/browser/views/frame/browser_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_version_info.h" 8 #include "base/file_version_info.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
(...skipping 19 matching lines...) Expand all
30 #include "chrome/browser/views/infobars/infobar_container.h" 30 #include "chrome/browser/views/infobars/infobar_container.h"
31 #include "chrome/browser/views/keyword_editor_view.h" 31 #include "chrome/browser/views/keyword_editor_view.h"
32 #include "chrome/browser/views/new_profile_dialog.h" 32 #include "chrome/browser/views/new_profile_dialog.h"
33 #include "chrome/browser/views/password_manager_view.h" 33 #include "chrome/browser/views/password_manager_view.h"
34 #include "chrome/browser/views/select_profile_dialog.h" 34 #include "chrome/browser/views/select_profile_dialog.h"
35 #include "chrome/browser/views/status_bubble_views.h" 35 #include "chrome/browser/views/status_bubble_views.h"
36 #include "chrome/browser/views/tab_contents_container_view.h" 36 #include "chrome/browser/views/tab_contents_container_view.h"
37 #include "chrome/browser/views/tabs/tab_strip.h" 37 #include "chrome/browser/views/tabs/tab_strip.h"
38 #include "chrome/browser/views/toolbar_star_toggle.h" 38 #include "chrome/browser/views/toolbar_star_toggle.h"
39 #include "chrome/browser/views/toolbar_view.h" 39 #include "chrome/browser/views/toolbar_view.h"
40 #include "chrome/browser/sessions/tab_restore_service.h"
40 #include "chrome/browser/tab_contents/navigation_entry.h" 41 #include "chrome/browser/tab_contents/navigation_entry.h"
41 #include "chrome/browser/tab_contents/web_contents.h" 42 #include "chrome/browser/tab_contents/web_contents.h"
42 #include "chrome/browser/tab_contents/web_contents_view.h" 43 #include "chrome/browser/tab_contents/web_contents_view.h"
43 #include "chrome/browser/window_sizer.h" 44 #include "chrome/browser/window_sizer.h"
44 #include "chrome/common/chrome_switches.h" 45 #include "chrome/common/chrome_switches.h"
45 #include "chrome/common/drag_drop_types.h" 46 #include "chrome/common/drag_drop_types.h"
46 #include "chrome/common/gfx/chrome_canvas.h" 47 #include "chrome/common/gfx/chrome_canvas.h"
47 #include "chrome/common/l10n_util.h" 48 #include "chrome/common/l10n_util.h"
48 #include "chrome/common/notification_service.h" 49 #include "chrome/common/notification_service.h"
49 #include "chrome/common/os_exchange_data.h" 50 #include "chrome/common/os_exchange_data.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 { false, IDC_FIND, IDS_FIND }, 114 { false, IDC_FIND, IDS_FIND },
114 { true, 0, 0 }, 115 { true, 0, 0 },
115 { false, IDC_PASTE, IDS_PASTE }, 116 { false, IDC_PASTE, IDS_PASTE },
116 { false, IDC_COPY, IDS_COPY }, 117 { false, IDC_COPY, IDS_COPY },
117 { false, IDC_CUT, IDS_CUT }, 118 { false, IDC_CUT, IDS_CUT },
118 { true, 0, 0 }, 119 { true, 0, 0 },
119 { false, IDC_NEW_TAB, IDS_APP_MENU_NEW_WEB_PAGE }, 120 { false, IDC_NEW_TAB, IDS_APP_MENU_NEW_WEB_PAGE },
120 { false, IDC_SHOW_AS_TAB, IDS_SHOW_AS_TAB }, 121 { false, IDC_SHOW_AS_TAB, IDS_SHOW_AS_TAB },
121 { false, IDC_COPY_URL, IDS_APP_MENU_COPY_URL }, 122 { false, IDC_COPY_URL, IDS_APP_MENU_COPY_URL },
122 { false, IDC_DUPLICATE_TAB, IDS_APP_MENU_DUPLICATE_APP_WINDOW }, 123 { false, IDC_DUPLICATE_TAB, IDS_APP_MENU_DUPLICATE_APP_WINDOW },
124 { false, IDC_RESTORE_TAB, IDS_RESTORE_TAB },
123 { true, 0, 0 }, 125 { true, 0, 0 },
124 { false, IDC_RELOAD, IDS_APP_MENU_RELOAD }, 126 { false, IDC_RELOAD, IDS_APP_MENU_RELOAD },
125 { false, IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD }, 127 { false, IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD },
126 { false, IDC_BACK, IDS_CONTENT_CONTEXT_BACK } 128 { false, IDC_BACK, IDS_CONTENT_CONTEXT_BACK }
127 }; 129 };
128 130
129 /////////////////////////////////////////////////////////////////////////////// 131 ///////////////////////////////////////////////////////////////////////////////
130 // ResizeCorner, private: 132 // ResizeCorner, private:
131 133
132 class ResizeCorner : public views::View { 134 class ResizeCorner : public views::View {
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 } 410 }
409 return otr_avatar_; 411 return otr_avatar_;
410 } 412 }
411 413
412 void BrowserView::PrepareToRunSystemMenu(HMENU menu) { 414 void BrowserView::PrepareToRunSystemMenu(HMENU menu) {
413 for (int i = 0; i < arraysize(kMenuLayout); ++i) { 415 for (int i = 0; i < arraysize(kMenuLayout); ++i) {
414 int command = kMenuLayout[i].command; 416 int command = kMenuLayout[i].command;
415 // |command| can be zero on submenu items (IDS_ENCODING, 417 // |command| can be zero on submenu items (IDS_ENCODING,
416 // IDS_ZOOM) and on separators. 418 // IDS_ZOOM) and on separators.
417 if (command != 0) { 419 if (command != 0) {
418 system_menu_->EnableMenuItemByID( 420 bool enabled = browser_->command_updater()->IsCommandEnabled(command) &&
419 command, 421 ((command != IDC_RESTORE_TAB) ||
Glen Murphy 2009/04/07 21:33:33 I think this should be a four-pixel indent. Thoug
420 browser_->command_updater()->IsCommandEnabled(command)); 422 !browser_->profile()->GetTabRestoreService()->entries().empty());
423 system_menu_->EnableMenuItemByID(command, enabled);
421 } 424 }
422 } 425 }
423 } 426 }
424 427
425 // static 428 // static
426 void BrowserView::RegisterBrowserViewPrefs(PrefService* prefs) { 429 void BrowserView::RegisterBrowserViewPrefs(PrefService* prefs) {
427 prefs->RegisterIntegerPref(prefs::kPluginMessageResponseTimeout, 430 prefs->RegisterIntegerPref(prefs::kPluginMessageResponseTimeout,
428 kDefaultPluginMessageResponseTimeout); 431 kDefaultPluginMessageResponseTimeout);
429 prefs->RegisterIntegerPref(prefs::kHungPluginDetectFrequency, 432 prefs->RegisterIntegerPref(prefs::kHungPluginDetectFrequency,
430 kDefaultHungPluginDetectFrequency); 433 kDefaultHungPluginDetectFrequency);
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 void BrowserView::InitSystemMenu() { 1245 void BrowserView::InitSystemMenu() {
1243 HMENU system_menu = GetSystemMenu(frame_->GetNativeView(), FALSE); 1246 HMENU system_menu = GetSystemMenu(frame_->GetNativeView(), FALSE);
1244 system_menu_.reset(new Menu(system_menu)); 1247 system_menu_.reset(new Menu(system_menu));
1245 int insertion_index = std::max(0, system_menu_->ItemCount() - 1); 1248 int insertion_index = std::max(0, system_menu_->ItemCount() - 1);
1246 // We add the menu items in reverse order so that insertion_index never needs 1249 // We add the menu items in reverse order so that insertion_index never needs
1247 // to change. 1250 // to change.
1248 if (IsBrowserTypeNormal()) { 1251 if (IsBrowserTypeNormal()) {
1249 system_menu_->AddSeparator(insertion_index); 1252 system_menu_->AddSeparator(insertion_index);
1250 system_menu_->AddMenuItemWithLabel(insertion_index, IDC_TASK_MANAGER, 1253 system_menu_->AddMenuItemWithLabel(insertion_index, IDC_TASK_MANAGER,
1251 l10n_util::GetString(IDS_TASK_MANAGER)); 1254 l10n_util::GetString(IDS_TASK_MANAGER));
1255 system_menu_->AddSeparator(insertion_index);
1256 system_menu_->AddMenuItemWithLabel(insertion_index, IDC_RESTORE_TAB,
1257 l10n_util::GetString(IDS_RESTORE_TAB));
1258 system_menu_->AddMenuItemWithLabel(insertion_index, IDC_NEW_TAB,
1259 l10n_util::GetString(IDS_NEW_TAB));
1252 // If it's a regular browser window with tabs, we don't add any more items, 1260 // If it's a regular browser window with tabs, we don't add any more items,
1253 // since it already has menus (Page, Chrome). 1261 // since it already has menus (Page, Chrome).
1254 } else { 1262 } else {
1255 BuildMenuForTabStriplessWindow(system_menu_.get(), insertion_index); 1263 BuildMenuForTabStriplessWindow(system_menu_.get(), insertion_index);
1256 } 1264 }
1257 } 1265 }
1258 1266
1259 int BrowserView::LayoutTabStrip() { 1267 int BrowserView::LayoutTabStrip() {
1260 gfx::Rect tabstrip_bounds = frame_->GetBoundsForTabStrip(tabstrip_); 1268 gfx::Rect tabstrip_bounds = frame_->GetBoundsForTabStrip(tabstrip_);
1261 gfx::Point tabstrip_origin = tabstrip_bounds.origin(); 1269 gfx::Point tabstrip_origin = tabstrip_bounds.origin();
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 1606 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
1599 BrowserView* browser_view = new BrowserView(browser); 1607 BrowserView* browser_view = new BrowserView(browser);
1600 (new BrowserFrame(browser_view))->Init(); 1608 (new BrowserFrame(browser_view))->Init();
1601 return browser_view; 1609 return browser_view;
1602 } 1610 }
1603 1611
1604 // static 1612 // static
1605 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { 1613 FindBar* BrowserWindow::CreateFindBar(Browser* browser) {
1606 return new FindBarWin(static_cast<BrowserView*>(browser->window())); 1614 return new FindBarWin(static_cast<BrowserView*>(browser->window()));
1607 } 1615 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698