| 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/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "chrome/app/chrome_command_ids.h" | 18 #include "chrome/app/chrome_command_ids.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/history/top_sites_factory.h" | 20 #include "chrome/browser/history/top_sites_factory.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/profiles/profile_info_cache.h" | |
| 23 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
| 24 #include "chrome/browser/profiles/profile_window.h" | 23 #include "chrome/browser/profiles/profile_window.h" |
| 25 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 24 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 26 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
| 27 #include "chrome/browser/ui/browser_commands.h" | 26 #include "chrome/browser/ui/browser_commands.h" |
| 28 #include "chrome/browser/ui/browser_list.h" | 27 #include "chrome/browser/ui/browser_list.h" |
| 29 #include "chrome/browser/ui/browser_live_tab_context.h" | 28 #include "chrome/browser/ui/browser_live_tab_context.h" |
| 30 #include "chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.h" | 29 #include "chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.h" |
| 31 #include "chrome/browser/ui/views/frame/browser_view.h" | 30 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 32 #include "chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h" | 31 #include "chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h" |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 GetTopSitesData(); | 434 GetTopSitesData(); |
| 436 | 435 |
| 437 // Register as TopSitesObserver so that we can update ourselves when the | 436 // Register as TopSitesObserver so that we can update ourselves when the |
| 438 // TopSites changes. | 437 // TopSites changes. |
| 439 scoped_observer_.Add(top_sites_.get()); | 438 scoped_observer_.Add(top_sites_.get()); |
| 440 } | 439 } |
| 441 | 440 |
| 442 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 441 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 443 DCHECK(profile_manager); | 442 DCHECK(profile_manager); |
| 444 avatar_menu_.reset(new AvatarMenu( | 443 avatar_menu_.reset(new AvatarMenu( |
| 445 &profile_manager->GetProfileInfoCache(), this, nullptr)); | 444 &profile_manager->GetProfileAttributesStorage(), this, nullptr)); |
| 446 avatar_menu_->RebuildMenu(); | 445 avatar_menu_->RebuildMenu(); |
| 447 BrowserList::AddObserver(this); | 446 BrowserList::AddObserver(this); |
| 448 | 447 |
| 449 RebuildProfilesMenu(); | 448 RebuildProfilesMenu(); |
| 450 | 449 |
| 451 server_set_root(server_, root_item_); | 450 server_set_root(server_, root_item_); |
| 452 } | 451 } |
| 453 | 452 |
| 454 void GlobalMenuBarX11::Disable() { | 453 void GlobalMenuBarX11::Disable() { |
| 455 for (CommandIDMenuItemMap::const_iterator it = id_to_menu_item_.begin(); | 454 for (CommandIDMenuItemMap::const_iterator it = id_to_menu_item_.begin(); |
| (...skipping 437 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)); | 892 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(sender), kProfileId)); |
| 894 avatar_menu_->EditProfile(id); | 893 avatar_menu_->EditProfile(id); |
| 895 } | 894 } |
| 896 | 895 |
| 897 void GlobalMenuBarX11::OnCreateProfileItemActivated(DbusmenuMenuitem* sender, | 896 void GlobalMenuBarX11::OnCreateProfileItemActivated(DbusmenuMenuitem* sender, |
| 898 unsigned int timestamp) { | 897 unsigned int timestamp) { |
| 899 profiles::CreateAndSwitchToNewProfile(chrome::HOST_DESKTOP_TYPE_NATIVE, | 898 profiles::CreateAndSwitchToNewProfile(chrome::HOST_DESKTOP_TYPE_NATIVE, |
| 900 ProfileManager::CreateCallback(), | 899 ProfileManager::CreateCallback(), |
| 901 ProfileMetrics::ADD_NEW_USER_MENU); | 900 ProfileMetrics::ADD_NEW_USER_MENU); |
| 902 } | 901 } |
| OLD | NEW |