OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gtk/global_history_menu.h" | 5 #include "chrome/browser/ui/gtk/global_history_menu.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 content::Source<history::TopSites>(top_sites_)); | 137 content::Source<history::TopSites>(top_sites_)); |
138 } | 138 } |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 void GlobalHistoryMenu::GetTopSitesData() { | 142 void GlobalHistoryMenu::GetTopSitesData() { |
143 DCHECK(top_sites_); | 143 DCHECK(top_sites_); |
144 | 144 |
145 top_sites_->GetMostVisitedURLs( | 145 top_sites_->GetMostVisitedURLs( |
146 base::Bind(&GlobalHistoryMenu::OnTopSitesReceived, | 146 base::Bind(&GlobalHistoryMenu::OnTopSitesReceived, |
147 weak_ptr_factory_.GetWeakPtr())); | 147 weak_ptr_factory_.GetWeakPtr()), false); |
148 } | 148 } |
149 | 149 |
150 void GlobalHistoryMenu::OnTopSitesReceived( | 150 void GlobalHistoryMenu::OnTopSitesReceived( |
151 const history::MostVisitedURLList& visited_list) { | 151 const history::MostVisitedURLList& visited_list) { |
152 ClearMenuSection(history_menu_, GlobalMenuBar::TAG_MOST_VISITED); | 152 ClearMenuSection(history_menu_, GlobalMenuBar::TAG_MOST_VISITED); |
153 | 153 |
154 int index = GetIndexOfMenuItemWithTag( | 154 int index = GetIndexOfMenuItemWithTag( |
155 history_menu_, | 155 history_menu_, |
156 GlobalMenuBar::TAG_MOST_VISITED_HEADER) + 1; | 156 GlobalMenuBar::TAG_MOST_VISITED_HEADER) + 1; |
157 | 157 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 tab_restore_service_->LoadTabsFromLastSession(); | 409 tab_restore_service_->LoadTabsFromLastSession(); |
410 tab_restore_service_->AddObserver(this); | 410 tab_restore_service_->AddObserver(this); |
411 | 411 |
412 // If LoadTabsFromLastSession doesn't load tabs, it won't call | 412 // If LoadTabsFromLastSession doesn't load tabs, it won't call |
413 // TabRestoreServiceChanged(). This ensures that all new windows after | 413 // TabRestoreServiceChanged(). This ensures that all new windows after |
414 // the first one will have their menus populated correctly. | 414 // the first one will have their menus populated correctly. |
415 TabRestoreServiceChanged(tab_restore_service_); | 415 TabRestoreServiceChanged(tab_restore_service_); |
416 } | 416 } |
417 } | 417 } |
418 } | 418 } |
OLD | NEW |