| 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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 bool schedule_load) { | 636 bool schedule_load) { |
| 637 DCHECK(!tab.navigations.empty()); | 637 DCHECK(!tab.navigations.empty()); |
| 638 int selected_index = tab.current_navigation_index; | 638 int selected_index = tab.current_navigation_index; |
| 639 selected_index = std::max( | 639 selected_index = std::max( |
| 640 0, | 640 0, |
| 641 std::min(selected_index, | 641 std::min(selected_index, |
| 642 static_cast<int>(tab.navigations.size() - 1))); | 642 static_cast<int>(tab.navigations.size() - 1))); |
| 643 | 643 |
| 644 // Record an app launch, if applicable. | 644 // Record an app launch, if applicable. |
| 645 GURL url = tab.navigations.at(tab.current_navigation_index).virtual_url(); | 645 GURL url = tab.navigations.at(tab.current_navigation_index).virtual_url(); |
| 646 if (browser->profile()->GetExtensionService()->IsInstalledApp(url)) { | 646 // TODO: the ExtensionService should never be NULL, but in some cases it is, |
| 647 // see bug 73768. After it is resolved, the explicit test can go away. |
| 648 ExtensionService* service = browser->profile()->GetExtensionService(); |
| 649 if (service && service->IsInstalledApp(url)) { |
| 647 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, | 650 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, |
| 648 extension_misc::APP_LAUNCH_SESSION_RESTORE, | 651 extension_misc::APP_LAUNCH_SESSION_RESTORE, |
| 649 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); | 652 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); |
| 650 } | 653 } |
| 651 | 654 |
| 652 TabContents* tab_contents = | 655 TabContents* tab_contents = |
| 653 browser->AddRestoredTab(tab.navigations, | 656 browser->AddRestoredTab(tab.navigations, |
| 654 tab_index, | 657 tab_index, |
| 655 selected_index, | 658 selected_index, |
| 656 tab.extension_app_id, | 659 tab.extension_app_id, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 void SessionRestore::RestoreSessionSynchronously( | 828 void SessionRestore::RestoreSessionSynchronously( |
| 826 Profile* profile, | 829 Profile* profile, |
| 827 const std::vector<GURL>& urls_to_open) { | 830 const std::vector<GURL>& urls_to_open) { |
| 828 Restore(profile, NULL, true, false, true, urls_to_open); | 831 Restore(profile, NULL, true, false, true, urls_to_open); |
| 829 } | 832 } |
| 830 | 833 |
| 831 // static | 834 // static |
| 832 bool SessionRestore::IsRestoring() { | 835 bool SessionRestore::IsRestoring() { |
| 833 return restoring; | 836 return restoring; |
| 834 } | 837 } |
| OLD | NEW |