OLD | NEW |
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/gtk/standard_menus.h" | 5 #include "chrome/browser/gtk/standard_menus.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "chrome/app/chrome_dll_resource.h" | 12 #include "chrome/app/chrome_dll_resource.h" |
| 13 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/encoding_menu_controller.h" | 14 #include "chrome/browser/encoding_menu_controller.h" |
14 #include "grit/chromium_strings.h" | 15 #include "grit/chromium_strings.h" |
15 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 struct MenuCreateMaterial zoom_menu_materials[] = { | 20 struct MenuCreateMaterial zoom_menu_materials[] = { |
20 { MENU_NORMAL, IDC_ZOOM_PLUS, IDS_ZOOM_PLUS, 0, NULL, | 21 { MENU_NORMAL, IDC_ZOOM_PLUS, IDS_ZOOM_PLUS, 0, NULL, |
21 GDK_KP_Add, GDK_CONTROL_MASK }, | 22 GDK_KP_Add, GDK_CONTROL_MASK }, |
22 { MENU_NORMAL, IDC_ZOOM_NORMAL, IDS_ZOOM_NORMAL, 0, NULL, | 23 { MENU_NORMAL, IDC_ZOOM_NORMAL, IDS_ZOOM_NORMAL, 0, NULL, |
23 GDK_KP_0, GDK_CONTROL_MASK }, | 24 GDK_KP_0, GDK_CONTROL_MASK }, |
24 { MENU_NORMAL, IDC_ZOOM_MINUS, IDS_ZOOM_MINUS, 0, NULL, | 25 { MENU_NORMAL, IDC_ZOOM_MINUS, IDS_ZOOM_MINUS, 0, NULL, |
25 GDK_KP_Subtract, GDK_CONTROL_MASK }, | 26 GDK_KP_Subtract, GDK_CONTROL_MASK }, |
26 { MENU_END } | 27 { MENU_END } |
27 }; | 28 }; |
28 | 29 |
29 struct MenuCreateMaterial developer_menu_materials[] = { | 30 struct MenuCreateMaterial developer_menu_materials[] = { |
30 { MENU_NORMAL, IDC_VIEW_SOURCE, IDS_VIEW_SOURCE, 0, NULL, | 31 { MENU_NORMAL, IDC_VIEW_SOURCE, IDS_VIEW_SOURCE, 0, NULL, |
31 GDK_u, GDK_CONTROL_MASK }, | 32 GDK_u, GDK_CONTROL_MASK }, |
32 { MENU_NORMAL, IDC_DEV_TOOLS, IDS_DEV_TOOLS, 0, NULL, | 33 { MENU_NORMAL, IDC_DEV_TOOLS, IDS_DEV_TOOLS, 0, NULL, |
33 GDK_j, GDK_CONTROL_MASK | GDK_SHIFT_MASK }, | 34 GDK_j, GDK_CONTROL_MASK | GDK_SHIFT_MASK }, |
34 { MENU_NORMAL, IDC_TASK_MANAGER, IDS_TASK_MANAGER, 0, NULL, | 35 { MENU_NORMAL, IDC_TASK_MANAGER, IDS_TASK_MANAGER, 0, NULL, |
35 GDK_Escape, GDK_SHIFT_MASK }, | 36 GDK_Escape, GDK_SHIFT_MASK }, |
36 { MENU_END } | 37 { MENU_END } |
37 }; | 38 }; |
38 | 39 |
| 40 struct MenuCreateMaterial developer_menu_materials_no_inspector[] = { |
| 41 { MENU_NORMAL, IDC_VIEW_SOURCE, IDS_VIEW_SOURCE, 0, NULL, |
| 42 GDK_u, GDK_CONTROL_MASK }, |
| 43 { MENU_NORMAL, IDC_TASK_MANAGER, IDS_TASK_MANAGER, 0, NULL, |
| 44 GDK_Escape, GDK_SHIFT_MASK }, |
| 45 { MENU_END } |
| 46 }; |
| 47 |
39 struct MenuCreateMaterial standard_page_menu_materials[] = { | 48 struct MenuCreateMaterial standard_page_menu_materials[] = { |
40 { MENU_NORMAL, IDC_CREATE_SHORTCUTS, IDS_CREATE_SHORTCUTS }, | 49 { MENU_NORMAL, IDC_CREATE_SHORTCUTS, IDS_CREATE_SHORTCUTS }, |
41 { MENU_SEPARATOR }, | 50 { MENU_SEPARATOR }, |
42 { MENU_NORMAL, IDC_CUT, IDS_CUT, 0, NULL, GDK_x, GDK_CONTROL_MASK, true }, | 51 { MENU_NORMAL, IDC_CUT, IDS_CUT, 0, NULL, GDK_x, GDK_CONTROL_MASK, true }, |
43 { MENU_NORMAL, IDC_COPY, IDS_COPY, 0, NULL, GDK_c, GDK_CONTROL_MASK, true }, | 52 { MENU_NORMAL, IDC_COPY, IDS_COPY, 0, NULL, GDK_c, GDK_CONTROL_MASK, true }, |
44 { MENU_NORMAL, IDC_PASTE, IDS_PASTE, 0, NULL, GDK_v, GDK_CONTROL_MASK, true }, | 53 { MENU_NORMAL, IDC_PASTE, IDS_PASTE, 0, NULL, GDK_v, GDK_CONTROL_MASK, true }, |
45 { MENU_SEPARATOR }, | 54 { MENU_SEPARATOR }, |
46 { MENU_NORMAL, IDC_FIND, IDS_FIND, 0, NULL, GDK_f, GDK_CONTROL_MASK }, | 55 { MENU_NORMAL, IDC_FIND, IDS_FIND, 0, NULL, GDK_f, GDK_CONTROL_MASK }, |
47 { MENU_NORMAL, IDC_SAVE_PAGE, IDS_SAVE_PAGE, 0, NULL, GDK_s, | 56 { MENU_NORMAL, IDC_SAVE_PAGE, IDS_SAVE_PAGE, 0, NULL, GDK_s, |
48 GDK_CONTROL_MASK }, | 57 GDK_CONTROL_MASK }, |
49 { MENU_NORMAL, IDC_PRINT, IDS_PRINT, 0, NULL, GDK_p, GDK_CONTROL_MASK }, | 58 { MENU_NORMAL, IDC_PRINT, IDS_PRINT, 0, NULL, GDK_p, GDK_CONTROL_MASK }, |
50 { MENU_SEPARATOR }, | 59 { MENU_SEPARATOR }, |
51 { MENU_NORMAL, IDC_ZOOM_MENU, IDS_ZOOM_MENU, 0, zoom_menu_materials }, | 60 { MENU_NORMAL, IDC_ZOOM_MENU, IDS_ZOOM_MENU, 0, zoom_menu_materials }, |
52 // The encoding menu submenu is filled in by code below. | 61 // The encoding menu submenu is filled in by code below. |
53 { MENU_NORMAL, IDC_ENCODING_MENU, IDS_ENCODING_MENU }, | 62 { MENU_NORMAL, IDC_ENCODING_MENU, IDS_ENCODING_MENU }, |
54 { MENU_SEPARATOR }, | 63 { MENU_SEPARATOR }, |
55 { MENU_NORMAL, IDC_DEVELOPER_MENU, IDS_DEVELOPER_MENU, 0, | 64 // The developer menu submenu is filled in by code below. |
56 developer_menu_materials }, | 65 { MENU_NORMAL, IDC_DEVELOPER_MENU, IDS_DEVELOPER_MENU }, |
57 | 66 |
58 // The Report Bug menu hasn't been implemented yet. Remove it until it is. | 67 // The Report Bug menu hasn't been implemented yet. Remove it until it is. |
59 // http://code.google.com/p/chromium/issues/detail?id=11600 | 68 // http://code.google.com/p/chromium/issues/detail?id=11600 |
60 // { MENU_SEPARATOR }, | 69 // { MENU_SEPARATOR }, |
61 // { MENU_NORMAL, IDC_REPORT_BUG, IDS_REPORT_BUG }, | 70 // { MENU_NORMAL, IDC_REPORT_BUG, IDS_REPORT_BUG }, |
62 | 71 |
63 { MENU_END } | 72 { MENU_END } |
64 }; | 73 }; |
65 | 74 |
66 // ----------------------------------------------------------------------- | 75 // ----------------------------------------------------------------------- |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 108 |
100 } // namespace | 109 } // namespace |
101 | 110 |
102 | 111 |
103 const MenuCreateMaterial* GetStandardPageMenu(MenuGtk* encodings_menu) { | 112 const MenuCreateMaterial* GetStandardPageMenu(MenuGtk* encodings_menu) { |
104 // Find the encoding menu and attach this menu. | 113 // Find the encoding menu and attach this menu. |
105 for (MenuCreateMaterial* entry = standard_page_menu_materials; | 114 for (MenuCreateMaterial* entry = standard_page_menu_materials; |
106 entry->type != MENU_END; ++entry) { | 115 entry->type != MENU_END; ++entry) { |
107 if (entry->id == IDC_ENCODING_MENU) { | 116 if (entry->id == IDC_ENCODING_MENU) { |
108 entry->custom_submenu = encodings_menu; | 117 entry->custom_submenu = encodings_menu; |
109 break; | 118 } else if (entry->id == IDC_DEVELOPER_MENU) { |
| 119 entry->submenu = g_browser_process->have_inspector_files() ? |
| 120 developer_menu_materials : developer_menu_materials_no_inspector; |
110 } | 121 } |
111 } | 122 } |
112 | 123 |
113 return standard_page_menu_materials; | 124 return standard_page_menu_materials; |
114 } | 125 } |
115 | 126 |
116 const MenuCreateMaterial* GetStandardAppMenu() { | 127 const MenuCreateMaterial* GetStandardAppMenu() { |
117 return standard_app_menu_materials; | 128 return standard_app_menu_materials; |
118 } | 129 } |
OLD | NEW |