OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/views/frame/global_menu_bar_x11.h" | 5 #include "chrome/browser/ui/views/frame/global_menu_bar_x11.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <glib-object.h> | 8 #include <glib-object.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
11 #include "base/debug/leak_annotations.h" | 11 #include "base/debug/leak_annotations.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/prefs/pref_service.h" | |
15 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
16 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
18 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
19 #include "chrome/app/chrome_command_ids.h" | 18 #include "chrome/app/chrome_command_ids.h" |
20 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/history/top_sites_factory.h" | 20 #include "chrome/browser/history/top_sites_factory.h" |
22 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_info_cache.h" | 22 #include "chrome/browser/profiles/profile_info_cache.h" |
24 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
25 #include "chrome/browser/profiles/profile_window.h" | 24 #include "chrome/browser/profiles/profile_window.h" |
26 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 25 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
27 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
28 #include "chrome/browser/ui/browser_commands.h" | 27 #include "chrome/browser/ui/browser_commands.h" |
29 #include "chrome/browser/ui/browser_list.h" | 28 #include "chrome/browser/ui/browser_list.h" |
30 #include "chrome/browser/ui/browser_live_tab_context.h" | 29 #include "chrome/browser/ui/browser_live_tab_context.h" |
31 #include "chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.h" | 30 #include "chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.h" |
32 #include "chrome/browser/ui/views/frame/browser_view.h" | 31 #include "chrome/browser/ui/views/frame/browser_view.h" |
33 #include "chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h" | 32 #include "chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h" |
34 #include "chrome/grit/generated_resources.h" | 33 #include "chrome/grit/generated_resources.h" |
35 #include "components/bookmarks/common/bookmark_pref_names.h" | 34 #include "components/bookmarks/common/bookmark_pref_names.h" |
36 #include "components/history/core/browser/top_sites.h" | 35 #include "components/history/core/browser/top_sites.h" |
| 36 #include "components/prefs/pref_service.h" |
37 #include "components/sessions/core/tab_restore_service.h" | 37 #include "components/sessions/core/tab_restore_service.h" |
38 #include "grit/components_strings.h" | 38 #include "grit/components_strings.h" |
39 #include "ui/base/accelerators/menu_label_accelerator_util_linux.h" | 39 #include "ui/base/accelerators/menu_label_accelerator_util_linux.h" |
40 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
41 #include "ui/events/keycodes/keyboard_code_conversion_x.h" | 41 #include "ui/events/keycodes/keyboard_code_conversion_x.h" |
42 #include "ui/gfx/text_elider.h" | 42 #include "ui/gfx/text_elider.h" |
43 | 43 |
44 // libdbusmenu-glib types | 44 // libdbusmenu-glib types |
45 typedef struct _DbusmenuMenuitem DbusmenuMenuitem; | 45 typedef struct _DbusmenuMenuitem DbusmenuMenuitem; |
46 typedef DbusmenuMenuitem* (*dbusmenu_menuitem_new_func)(); | 46 typedef DbusmenuMenuitem* (*dbusmenu_menuitem_new_func)(); |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(sender), kProfileId)); | 893 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(sender), kProfileId)); |
894 avatar_menu_->EditProfile(id); | 894 avatar_menu_->EditProfile(id); |
895 } | 895 } |
896 | 896 |
897 void GlobalMenuBarX11::OnCreateProfileItemActivated(DbusmenuMenuitem* sender, | 897 void GlobalMenuBarX11::OnCreateProfileItemActivated(DbusmenuMenuitem* sender, |
898 unsigned int timestamp) { | 898 unsigned int timestamp) { |
899 profiles::CreateAndSwitchToNewProfile(chrome::HOST_DESKTOP_TYPE_NATIVE, | 899 profiles::CreateAndSwitchToNewProfile(chrome::HOST_DESKTOP_TYPE_NATIVE, |
900 ProfileManager::CreateCallback(), | 900 ProfileManager::CreateCallback(), |
901 ProfileMetrics::ADD_NEW_USER_MENU); | 901 ProfileMetrics::ADD_NEW_USER_MENU); |
902 } | 902 } |
OLD | NEW |