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

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

Issue 1548133002: Switch to standard integer types in chrome/browser/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/sessions/session_restore.h" 5 #include "chrome/browser/sessions/session_restore.h"
6 6
7 #include <stddef.h>
8
7 #include <algorithm> 9 #include <algorithm>
8 #include <list> 10 #include <list>
9 #include <set> 11 #include <set>
10 #include <string> 12 #include <string>
11 13
12 #include "base/bind.h" 14 #include "base/bind.h"
13 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
14 #include "base/callback.h" 16 #include "base/callback.h"
15 #include "base/command_line.h" 17 #include "base/command_line.h"
16 #include "base/debug/alias.h" 18 #include "base/debug/alias.h"
19 #include "base/macros.h"
17 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/scoped_vector.h" 21 #include "base/memory/scoped_vector.h"
19 #include "base/metrics/field_trial.h" 22 #include "base/metrics/field_trial.h"
20 #include "base/metrics/histogram.h" 23 #include "base/metrics/histogram.h"
21 #include "base/run_loop.h" 24 #include "base/run_loop.h"
22 #include "base/stl_util.h" 25 #include "base/stl_util.h"
23 #include "base/task/cancelable_task_tracker.h" 26 #include "base/task/cancelable_task_tracker.h"
27 #include "build/build_config.h"
24 #include "chrome/browser/browser_process.h" 28 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/chrome_notification_types.h" 29 #include "chrome/browser/chrome_notification_types.h"
26 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/search/search.h" 31 #include "chrome/browser/search/search.h"
28 #include "chrome/browser/sessions/session_restore_delegate.h" 32 #include "chrome/browser/sessions/session_restore_delegate.h"
29 #include "chrome/browser/sessions/session_service.h" 33 #include "chrome/browser/sessions/session_service.h"
30 #include "chrome/browser/sessions/session_service_factory.h" 34 #include "chrome/browser/sessions/session_service_factory.h"
31 #include "chrome/browser/sessions/session_service_utils.h" 35 #include "chrome/browser/sessions/session_service_utils.h"
32 #include "chrome/browser/sessions/tab_loader.h" 36 #include "chrome/browser/sessions/tab_loader.h"
33 #include "chrome/browser/ui/browser.h" 37 #include "chrome/browser/ui/browser.h"
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 750
747 } // namespace 751 } // namespace
748 752
749 // SessionRestore ------------------------------------------------------------- 753 // SessionRestore -------------------------------------------------------------
750 754
751 // static 755 // static
752 Browser* SessionRestore::RestoreSession( 756 Browser* SessionRestore::RestoreSession(
753 Profile* profile, 757 Profile* profile,
754 Browser* browser, 758 Browser* browser,
755 chrome::HostDesktopType host_desktop_type, 759 chrome::HostDesktopType host_desktop_type,
756 uint32 behavior, 760 uint32_t behavior,
757 const std::vector<GURL>& urls_to_open) { 761 const std::vector<GURL>& urls_to_open) {
758 #if defined(OS_CHROMEOS) 762 #if defined(OS_CHROMEOS)
759 chromeos::BootTimesRecorder::Get()->AddLoginTimeMarker( 763 chromeos::BootTimesRecorder::Get()->AddLoginTimeMarker(
760 "SessionRestore-Start", false); 764 "SessionRestore-Start", false);
761 #endif 765 #endif
762 DCHECK(profile); 766 DCHECK(profile);
763 // Always restore from the original profile (incognito profiles have no 767 // Always restore from the original profile (incognito profiles have no
764 // session service). 768 // session service).
765 profile = profile->GetOriginalProfile(); 769 profile = profile->GetOriginalProfile();
766 if (!SessionServiceFactory::GetForProfile(profile)) { 770 if (!SessionServiceFactory::GetForProfile(profile)) {
767 NOTREACHED(); 771 NOTREACHED();
768 return nullptr; 772 return nullptr;
769 } 773 }
770 profile->set_restored_last_session(true); 774 profile->set_restored_last_session(true);
771 // SessionRestoreImpl takes care of deleting itself when done. 775 // SessionRestoreImpl takes care of deleting itself when done.
772 SessionRestoreImpl* restorer = new SessionRestoreImpl( 776 SessionRestoreImpl* restorer = new SessionRestoreImpl(
773 profile, browser, host_desktop_type, (behavior & SYNCHRONOUS) != 0, 777 profile, browser, host_desktop_type, (behavior & SYNCHRONOUS) != 0,
774 (behavior & CLOBBER_CURRENT_TAB) != 0, 778 (behavior & CLOBBER_CURRENT_TAB) != 0,
775 (behavior & ALWAYS_CREATE_TABBED_BROWSER) != 0, 779 (behavior & ALWAYS_CREATE_TABBED_BROWSER) != 0,
776 urls_to_open, 780 urls_to_open,
777 SessionRestore::on_session_restored_callbacks()); 781 SessionRestore::on_session_restored_callbacks());
778 return restorer->Restore(); 782 return restorer->Restore();
779 } 783 }
780 784
781 // static 785 // static
782 void SessionRestore::RestoreSessionAfterCrash(Browser* browser) { 786 void SessionRestore::RestoreSessionAfterCrash(Browser* browser) {
783 uint32 behavior = 0; 787 uint32_t behavior = 0;
784 if (browser->tab_strip_model()->count() == 1) { 788 if (browser->tab_strip_model()->count() == 1) {
785 const content::WebContents* active_tab = 789 const content::WebContents* active_tab =
786 browser->tab_strip_model()->GetWebContentsAt(0); 790 browser->tab_strip_model()->GetWebContentsAt(0);
787 if (active_tab->GetURL() == GURL(chrome::kChromeUINewTabURL) || 791 if (active_tab->GetURL() == GURL(chrome::kChromeUINewTabURL) ||
788 search::IsInstantNTP(active_tab)) { 792 search::IsInstantNTP(active_tab)) {
789 // There is only one tab and its the new tab page, make session restore 793 // There is only one tab and its the new tab page, make session restore
790 // clobber it. 794 // clobber it.
791 behavior = SessionRestore::CLOBBER_CURRENT_TAB; 795 behavior = SessionRestore::CLOBBER_CURRENT_TAB;
792 } 796 }
793 } 797 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 if (prioritize_tabs == "mru") 867 if (prioritize_tabs == "mru")
864 return SMART_RESTORE_MODE_MRU; 868 return SMART_RESTORE_MODE_MRU;
865 if (prioritize_tabs == "simple") 869 if (prioritize_tabs == "simple")
866 return SMART_RESTORE_MODE_SIMPLE; 870 return SMART_RESTORE_MODE_SIMPLE;
867 return SMART_RESTORE_MODE_OFF; 871 return SMART_RESTORE_MODE_OFF;
868 } 872 }
869 873
870 // static 874 // static
871 base::CallbackList<void(int)>* 875 base::CallbackList<void(int)>*
872 SessionRestore::on_session_restored_callbacks_ = nullptr; 876 SessionRestore::on_session_restored_callbacks_ = nullptr;
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_restore.h ('k') | chrome/browser/sessions/session_restore_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698