| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/sessions/session_restore.h" | 5 #include "chrome/browser/sessions/session_restore.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <list> | 8 #include <list> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 bool schedule_load) { | 645 bool schedule_load) { |
| 646 DCHECK(!tab.navigations.empty()); | 646 DCHECK(!tab.navigations.empty()); |
| 647 int selected_index = tab.current_navigation_index; | 647 int selected_index = tab.current_navigation_index; |
| 648 selected_index = std::max( | 648 selected_index = std::max( |
| 649 0, | 649 0, |
| 650 std::min(selected_index, | 650 std::min(selected_index, |
| 651 static_cast<int>(tab.navigations.size() - 1))); | 651 static_cast<int>(tab.navigations.size() - 1))); |
| 652 | 652 |
| 653 // Record an app launch, if applicable. | 653 // Record an app launch, if applicable. |
| 654 GURL url = tab.navigations.at(tab.current_navigation_index).virtual_url(); | 654 GURL url = tab.navigations.at(tab.current_navigation_index).virtual_url(); |
| 655 // TODO: the ExtensionService should never be NULL, but in some cases it is, | 655 DCHECK(browser->profile()->GetExtensionService()); |
| 656 // see bug 73768. After it is resolved, the explicit test can go away. | 656 if (browser->profile()->GetExtensionService()->IsInstalledApp(url)) { |
| 657 ExtensionService* service = browser->profile()->GetExtensionService(); | |
| 658 if (service && service->IsInstalledApp(url)) { | |
| 659 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, | 657 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, |
| 660 extension_misc::APP_LAUNCH_SESSION_RESTORE, | 658 extension_misc::APP_LAUNCH_SESSION_RESTORE, |
| 661 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); | 659 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); |
| 662 } | 660 } |
| 663 | 661 |
| 664 TabContents* tab_contents = | 662 TabContents* tab_contents = |
| 665 browser->AddRestoredTab(tab.navigations, | 663 browser->AddRestoredTab(tab.navigations, |
| 666 tab_index, | 664 tab_index, |
| 667 selected_index, | 665 selected_index, |
| 668 tab.extension_app_id, | 666 tab.extension_app_id, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 Browser* SessionRestore::RestoreSessionSynchronously( | 835 Browser* SessionRestore::RestoreSessionSynchronously( |
| 838 Profile* profile, | 836 Profile* profile, |
| 839 const std::vector<GURL>& urls_to_open) { | 837 const std::vector<GURL>& urls_to_open) { |
| 840 return Restore(profile, NULL, true, false, true, urls_to_open); | 838 return Restore(profile, NULL, true, false, true, urls_to_open); |
| 841 } | 839 } |
| 842 | 840 |
| 843 // static | 841 // static |
| 844 bool SessionRestore::IsRestoring() { | 842 bool SessionRestore::IsRestoring() { |
| 845 return restoring; | 843 return restoring; |
| 846 } | 844 } |
| OLD | NEW |