Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: chrome/browser/sessions/session_restore.cc

Issue 7551012: Use computed index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 Browser* browser, 677 Browser* browser,
678 bool schedule_load) { 678 bool schedule_load) {
679 DCHECK(!tab.navigations.empty()); 679 DCHECK(!tab.navigations.empty());
680 int selected_index = tab.current_navigation_index; 680 int selected_index = tab.current_navigation_index;
681 selected_index = std::max( 681 selected_index = std::max(
682 0, 682 0,
683 std::min(selected_index, 683 std::min(selected_index,
684 static_cast<int>(tab.navigations.size() - 1))); 684 static_cast<int>(tab.navigations.size() - 1)));
685 685
686 // Record an app launch, if applicable. 686 // Record an app launch, if applicable.
687 GURL url = tab.navigations.at(tab.current_navigation_index).virtual_url(); 687 GURL url = tab.navigations.at(selected_index).virtual_url();
688 if ( 688 if (
689 #if defined(OS_CHROMEOS) 689 #if defined(OS_CHROMEOS)
690 browser->profile()->GetExtensionService() && 690 browser->profile()->GetExtensionService() &&
691 #endif 691 #endif
692 browser->profile()->GetExtensionService()->IsInstalledApp(url)) { 692 browser->profile()->GetExtensionService()->IsInstalledApp(url)) {
693 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, 693 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram,
694 extension_misc::APP_LAUNCH_SESSION_RESTORE, 694 extension_misc::APP_LAUNCH_SESSION_RESTORE,
695 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); 695 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
696 } 696 }
697 697
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 std::vector<GURL> gurls; 854 std::vector<GURL> gurls;
855 SessionRestoreImpl restorer(profile, 855 SessionRestoreImpl restorer(profile,
856 static_cast<Browser*>(NULL), true, false, true, gurls); 856 static_cast<Browser*>(NULL), true, false, true, gurls);
857 restorer.RestoreForeignTab(tab); 857 restorer.RestoreForeignTab(tab);
858 } 858 }
859 859
860 // static 860 // static
861 bool SessionRestore::IsRestoring() { 861 bool SessionRestore::IsRestoring() {
862 return restoring; 862 return restoring;
863 } 863 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698