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

Side by Side Diff: chrome/browser/gtk/browser_titlebar.cc

Issue 159721: GTK: Show shortcuts in title bar context menu and tab context menu.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 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/gtk/browser_window_gtk.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/gtk/browser_titlebar.h" 5 #include "chrome/browser/gtk/browser_titlebar.h"
6 6
7 #include <gdk/gdkkeysyms.h>
7 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
8 9
9 #include <string> 10 #include <string>
10 11
11 #include "app/resource_bundle.h" 12 #include "app/resource_bundle.h"
12 #include "app/l10n_util.h" 13 #include "app/l10n_util.h"
13 #include "base/gfx/gtk_util.h" 14 #include "base/gfx/gtk_util.h"
14 #include "chrome/app/chrome_dll_resource.h" 15 #include "chrome/app/chrome_dll_resource.h"
15 #include "chrome/browser/browser.h" 16 #include "chrome/browser/browser.h"
16 #include "chrome/browser/gtk/browser_window_gtk.h" 17 #include "chrome/browser/gtk/browser_window_gtk.h"
17 #include "chrome/browser/gtk/custom_button.h" 18 #include "chrome/browser/gtk/custom_button.h"
19 #include "chrome/browser/gtk/menu_gtk.h"
18 #include "chrome/browser/gtk/nine_box.h" 20 #include "chrome/browser/gtk/nine_box.h"
21 #include "chrome/browser/gtk/standard_menus.h"
19 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" 22 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h"
20 #include "chrome/browser/profile.h" 23 #include "chrome/browser/profile.h"
21 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
22 #include "chrome/common/pref_service.h" 25 #include "chrome/common/pref_service.h"
23 #include "grit/app_resources.h" 26 #include "grit/app_resources.h"
24 #include "grit/generated_resources.h" 27 #include "grit/generated_resources.h"
25 #include "grit/theme_resources.h" 28 #include "grit/theme_resources.h"
26 29
27 namespace { 30 namespace {
28 31
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 gtk_window_unmaximize(titlebar->window_); 238 gtk_window_unmaximize(titlebar->window_);
236 } else if (titlebar->maximize_button_->widget() == button) { 239 } else if (titlebar->maximize_button_->widget() == button) {
237 gtk_window_maximize(titlebar->window_); 240 gtk_window_maximize(titlebar->window_);
238 } else if (titlebar->minimize_button_->widget() == button) { 241 } else if (titlebar->minimize_button_->widget() == button) {
239 gtk_window_iconify(titlebar->window_); 242 gtk_window_iconify(titlebar->window_);
240 } 243 }
241 } 244 }
242 245
243 void BrowserTitlebar::ShowContextMenu() { 246 void BrowserTitlebar::ShowContextMenu() {
244 if (!context_menu_.get()) { 247 if (!context_menu_.get()) {
245 context_menu_.reset(new MenuGtk(this, false)); 248 static const MenuCreateMaterial context_menu_blueprint[] = {
246 context_menu_->AppendMenuItemWithLabel( 249 { MENU_NORMAL, IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB, 0, NULL,
247 IDC_NEW_TAB, 250 GDK_t, GDK_CONTROL_MASK, true },
248 l10n_util::GetStringUTF8(IDS_TAB_CXMENU_NEWTAB)); 251 { MENU_NORMAL, IDC_RESTORE_TAB, IDS_RESTORE_TAB, 0, NULL,
249 context_menu_->AppendMenuItemWithLabel( 252 GDK_t, GDK_CONTROL_MASK | GDK_SHIFT_MASK, true },
250 IDC_RESTORE_TAB, 253 { MENU_SEPARATOR },
251 l10n_util::GetStringUTF8(IDS_RESTORE_TAB)); 254 { MENU_NORMAL, IDC_TASK_MANAGER, IDS_TASK_MANAGER, 0, NULL,
255 GDK_Escape, GDK_SHIFT_MASK, true },
256 { MENU_SEPARATOR },
257 { MENU_CHECKBOX, kShowWindowDecorationsCommand,
258 IDS_SHOW_WINDOW_DECORATIONS },
259 { MENU_END },
260 };
252 261
253 context_menu_->AppendSeparator(); 262 context_menu_.reset(new MenuGtk(this, context_menu_blueprint, NULL));
254
255 context_menu_->AppendMenuItemWithLabel(
256 IDC_TASK_MANAGER,
257 l10n_util::GetStringUTF8(IDS_TASK_MANAGER));
258
259 context_menu_->AppendSeparator();
260
261 context_menu_->AppendCheckMenuItemWithLabel(
262 kShowWindowDecorationsCommand,
263 l10n_util::GetStringUTF8(IDS_SHOW_WINDOW_DECORATIONS));
264 } 263 }
265 264
266 context_menu_->PopupAsContext(gtk_get_current_event_time()); 265 context_menu_->PopupAsContext(gtk_get_current_event_time());
267 } 266 }
268 267
269 bool BrowserTitlebar::IsCommandEnabled(int command_id) const { 268 bool BrowserTitlebar::IsCommandEnabled(int command_id) const {
270 switch (command_id) { 269 switch (command_id) {
271 case IDC_NEW_TAB: 270 case IDC_NEW_TAB:
272 case kShowWindowDecorationsCommand: 271 case kShowWindowDecorationsCommand:
273 return true; 272 return true;
(...skipping 29 matching lines...) Expand all
303 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs(); 302 PrefService* prefs = browser_window_->browser()->profile()->GetPrefs();
304 prefs->SetBoolean(prefs::kUseCustomChromeFrame, 303 prefs->SetBoolean(prefs::kUseCustomChromeFrame,
305 !prefs->GetBoolean(prefs::kUseCustomChromeFrame)); 304 !prefs->GetBoolean(prefs::kUseCustomChromeFrame));
306 break; 305 break;
307 } 306 }
308 307
309 default: 308 default:
310 NOTREACHED(); 309 NOTREACHED();
311 } 310 }
312 } 311 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/browser_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698