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 |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 // item since that happens in a different process. | 843 // item since that happens in a different process. |
844 HistoryItem* item = reinterpret_cast<HistoryItem*>( | 844 HistoryItem* item = reinterpret_cast<HistoryItem*>( |
845 g_object_get_data(G_OBJECT(sender), kHistoryItem)); | 845 g_object_get_data(G_OBJECT(sender), kHistoryItem)); |
846 | 846 |
847 // If this item can be restored using TabRestoreService, do so. Otherwise, | 847 // If this item can be restored using TabRestoreService, do so. Otherwise, |
848 // just load the URL. | 848 // just load the URL. |
849 sessions::TabRestoreService* service = | 849 sessions::TabRestoreService* service = |
850 TabRestoreServiceFactory::GetForProfile(profile_); | 850 TabRestoreServiceFactory::GetForProfile(profile_); |
851 if (item->session_id && service) { | 851 if (item->session_id && service) { |
852 service->RestoreEntryById(browser_->live_tab_context(), item->session_id, | 852 service->RestoreEntryById(browser_->live_tab_context(), item->session_id, |
853 UNKNOWN); | 853 WindowOpenDisposition::UNKNOWN); |
854 } else { | 854 } else { |
855 DCHECK(item->url.is_valid()); | 855 DCHECK(item->url.is_valid()); |
856 browser_->OpenURL(content::OpenURLParams( | 856 browser_->OpenURL( |
857 item->url, | 857 content::OpenURLParams(item->url, content::Referrer(), |
858 content::Referrer(), | 858 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
859 NEW_FOREGROUND_TAB, | 859 ui::PAGE_TRANSITION_AUTO_BOOKMARK, false)); |
860 ui::PAGE_TRANSITION_AUTO_BOOKMARK, | |
861 false)); | |
862 } | 860 } |
863 } | 861 } |
864 | 862 |
865 void GlobalMenuBarX11::OnHistoryMenuAboutToShow(DbusmenuMenuitem* item) { | 863 void GlobalMenuBarX11::OnHistoryMenuAboutToShow(DbusmenuMenuitem* item) { |
866 if (!tab_restore_service_) { | 864 if (!tab_restore_service_) { |
867 tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile_); | 865 tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile_); |
868 if (tab_restore_service_) { | 866 if (tab_restore_service_) { |
869 tab_restore_service_->LoadTabsFromLastSession(); | 867 tab_restore_service_->LoadTabsFromLastSession(); |
870 tab_restore_service_->AddObserver(this); | 868 tab_restore_service_->AddObserver(this); |
871 | 869 |
(...skipping 15 matching lines...) Expand all Loading... |
887 unsigned int timestamp) { | 885 unsigned int timestamp) { |
888 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(sender), kProfileId)); | 886 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(sender), kProfileId)); |
889 avatar_menu_->EditProfile(id); | 887 avatar_menu_->EditProfile(id); |
890 } | 888 } |
891 | 889 |
892 void GlobalMenuBarX11::OnCreateProfileItemActivated(DbusmenuMenuitem* sender, | 890 void GlobalMenuBarX11::OnCreateProfileItemActivated(DbusmenuMenuitem* sender, |
893 unsigned int timestamp) { | 891 unsigned int timestamp) { |
894 profiles::CreateAndSwitchToNewProfile(ProfileManager::CreateCallback(), | 892 profiles::CreateAndSwitchToNewProfile(ProfileManager::CreateCallback(), |
895 ProfileMetrics::ADD_NEW_USER_MENU); | 893 ProfileMetrics::ADD_NEW_USER_MENU); |
896 } | 894 } |
OLD | NEW |