| 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 | 9 |
| 10 #include "base/debug/leak_annotations.h" | 10 #include "base/debug/leak_annotations.h" |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 DeleteHistoryItem); | 540 DeleteHistoryItem); |
| 541 menuitem_child_add_position(menu, menu_item, index); | 541 menuitem_child_add_position(menu, menu_item, index); |
| 542 g_object_unref(menu_item); | 542 g_object_unref(menu_item); |
| 543 } | 543 } |
| 544 | 544 |
| 545 void GlobalMenuBarX11::GetTopSitesData() { | 545 void GlobalMenuBarX11::GetTopSitesData() { |
| 546 DCHECK(top_sites_); | 546 DCHECK(top_sites_); |
| 547 | 547 |
| 548 top_sites_->GetMostVisitedURLs( | 548 top_sites_->GetMostVisitedURLs( |
| 549 base::Bind(&GlobalMenuBarX11::OnTopSitesReceived, | 549 base::Bind(&GlobalMenuBarX11::OnTopSitesReceived, |
| 550 weak_ptr_factory_.GetWeakPtr())); | 550 weak_ptr_factory_.GetWeakPtr()), false); |
| 551 } | 551 } |
| 552 | 552 |
| 553 void GlobalMenuBarX11::OnTopSitesReceived( | 553 void GlobalMenuBarX11::OnTopSitesReceived( |
| 554 const history::MostVisitedURLList& visited_list) { | 554 const history::MostVisitedURLList& visited_list) { |
| 555 ClearMenuSection(history_menu_, TAG_MOST_VISITED); | 555 ClearMenuSection(history_menu_, TAG_MOST_VISITED); |
| 556 | 556 |
| 557 int index = GetIndexOfMenuItemWithTag(history_menu_, | 557 int index = GetIndexOfMenuItemWithTag(history_menu_, |
| 558 TAG_MOST_VISITED_HEADER) + 1; | 558 TAG_MOST_VISITED_HEADER) + 1; |
| 559 | 559 |
| 560 for (size_t i = 0; i < visited_list.size() && i < kMostVisitedCount; ++i) { | 560 for (size_t i = 0; i < visited_list.size() && i < kMostVisitedCount; ++i) { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 tab_restore_service_->LoadTabsFromLastSession(); | 781 tab_restore_service_->LoadTabsFromLastSession(); |
| 782 tab_restore_service_->AddObserver(this); | 782 tab_restore_service_->AddObserver(this); |
| 783 | 783 |
| 784 // If LoadTabsFromLastSession doesn't load tabs, it won't call | 784 // If LoadTabsFromLastSession doesn't load tabs, it won't call |
| 785 // TabRestoreServiceChanged(). This ensures that all new windows after | 785 // TabRestoreServiceChanged(). This ensures that all new windows after |
| 786 // the first one will have their menus populated correctly. | 786 // the first one will have their menus populated correctly. |
| 787 TabRestoreServiceChanged(tab_restore_service_); | 787 TabRestoreServiceChanged(tab_restore_service_); |
| 788 } | 788 } |
| 789 } | 789 } |
| 790 } | 790 } |
| OLD | NEW |