| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 // If this item can be restored using TabRestoreService, do so. Otherwise, | 419 // If this item can be restored using TabRestoreService, do so. Otherwise, |
| 420 // just load the URL. | 420 // just load the URL. |
| 421 TabRestoreService* service = | 421 TabRestoreService* service = |
| 422 TabRestoreServiceFactory::GetForProfile(browser_->profile()); | 422 TabRestoreServiceFactory::GetForProfile(browser_->profile()); |
| 423 if (item->session_id && service) { | 423 if (item->session_id && service) { |
| 424 service->RestoreEntryById(browser_->tab_restore_service_delegate(), | 424 service->RestoreEntryById(browser_->tab_restore_service_delegate(), |
| 425 item->session_id, false); | 425 item->session_id, false); |
| 426 } else { | 426 } else { |
| 427 DCHECK(item->url.is_valid()); | 427 DCHECK(item->url.is_valid()); |
| 428 browser_->OpenURL(OpenURLParams(item->url, GURL(), disposition, | 428 browser_->OpenURL(OpenURLParams(item->url, GURL(), disposition, |
| 429 content::PAGE_TRANSITION_AUTO_BOOKMARK)); | 429 content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); |
| 430 } | 430 } |
| 431 } | 431 } |
| 432 | 432 |
| 433 void GlobalHistoryMenu::OnMenuActivate(GtkWidget* sender) { | 433 void GlobalHistoryMenu::OnMenuActivate(GtkWidget* sender) { |
| 434 if (!tab_restore_service_) { | 434 if (!tab_restore_service_) { |
| 435 tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile_); | 435 tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile_); |
| 436 if (tab_restore_service_) { | 436 if (tab_restore_service_) { |
| 437 tab_restore_service_->LoadTabsFromLastSession(); | 437 tab_restore_service_->LoadTabsFromLastSession(); |
| 438 tab_restore_service_->AddObserver(this); | 438 tab_restore_service_->AddObserver(this); |
| 439 | 439 |
| 440 // If LoadTabsFromLastSession doesn't load tabs, it won't call | 440 // If LoadTabsFromLastSession doesn't load tabs, it won't call |
| 441 // TabRestoreServiceChanged(). This ensures that all new windows after | 441 // TabRestoreServiceChanged(). This ensures that all new windows after |
| 442 // the first one will have their menus populated correctly. | 442 // the first one will have their menus populated correctly. |
| 443 TabRestoreServiceChanged(tab_restore_service_); | 443 TabRestoreServiceChanged(tab_restore_service_); |
| 444 } | 444 } |
| 445 } | 445 } |
| 446 } | 446 } |
| OLD | NEW |