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

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

Issue 1336823003: Move chrome::HostDesktopType to ui::HostDesktopType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base_session_service_delegate_impl
Patch Set: Fix build on Mac and CrOS Created 5 years, 3 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 <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 // SessionRestoreImpl --------------------------------------------------------- 74 // SessionRestoreImpl ---------------------------------------------------------
75 75
76 // SessionRestoreImpl is responsible for fetching the set of tabs to create 76 // SessionRestoreImpl is responsible for fetching the set of tabs to create
77 // from SessionService. SessionRestoreImpl deletes itself when done. 77 // from SessionService. SessionRestoreImpl deletes itself when done.
78 78
79 class SessionRestoreImpl : public content::NotificationObserver { 79 class SessionRestoreImpl : public content::NotificationObserver {
80 public: 80 public:
81 SessionRestoreImpl(Profile* profile, 81 SessionRestoreImpl(Profile* profile,
82 Browser* browser, 82 Browser* browser,
83 chrome::HostDesktopType host_desktop_type, 83 ui::HostDesktopType host_desktop_type,
84 bool synchronous, 84 bool synchronous,
85 bool clobber_existing_tab, 85 bool clobber_existing_tab,
86 bool always_create_tabbed_browser, 86 bool always_create_tabbed_browser,
87 const std::vector<GURL>& urls_to_open, 87 const std::vector<GURL>& urls_to_open,
88 SessionRestore::CallbackList* callbacks) 88 SessionRestore::CallbackList* callbacks)
89 : profile_(profile), 89 : profile_(profile),
90 browser_(browser), 90 browser_(browser),
91 host_desktop_type_(host_desktop_type), 91 host_desktop_type_(host_desktop_type),
92 synchronous_(synchronous), 92 synchronous_(synchronous),
93 clobber_existing_tab_(clobber_existing_tab), 93 clobber_existing_tab_(clobber_existing_tab),
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 } 688 }
689 689
690 // The profile to create the sessions for. 690 // The profile to create the sessions for.
691 Profile* profile_; 691 Profile* profile_;
692 692
693 // The first browser to restore to, may be null. 693 // The first browser to restore to, may be null.
694 Browser* browser_; 694 Browser* browser_;
695 695
696 // The desktop on which all new browsers should be created (browser_, if it is 696 // The desktop on which all new browsers should be created (browser_, if it is
697 // not NULL, must be of this desktop type as well). 697 // not NULL, must be of this desktop type as well).
698 chrome::HostDesktopType host_desktop_type_; 698 ui::HostDesktopType host_desktop_type_;
699 699
700 // Whether or not restore is synchronous. 700 // Whether or not restore is synchronous.
701 const bool synchronous_; 701 const bool synchronous_;
702 702
703 // The quit-closure to terminate the nested message-loop started for 703 // The quit-closure to terminate the nested message-loop started for
704 // synchronous session-restore. 704 // synchronous session-restore.
705 base::Closure quit_closure_for_sync_restore_; 705 base::Closure quit_closure_for_sync_restore_;
706 706
707 // See description of CLOBBER_CURRENT_TAB. 707 // See description of CLOBBER_CURRENT_TAB.
708 const bool clobber_existing_tab_; 708 const bool clobber_existing_tab_;
(...skipping 28 matching lines...) Expand all
737 SessionRestore::CallbackList* on_session_restored_callbacks_; 737 SessionRestore::CallbackList* on_session_restored_callbacks_;
738 738
739 DISALLOW_COPY_AND_ASSIGN(SessionRestoreImpl); 739 DISALLOW_COPY_AND_ASSIGN(SessionRestoreImpl);
740 }; 740 };
741 741
742 } // namespace 742 } // namespace
743 743
744 // SessionRestore ------------------------------------------------------------- 744 // SessionRestore -------------------------------------------------------------
745 745
746 // static 746 // static
747 Browser* SessionRestore::RestoreSession( 747 Browser* SessionRestore::RestoreSession(Profile* profile,
748 Profile* profile, 748 Browser* browser,
749 Browser* browser, 749 ui::HostDesktopType host_desktop_type,
750 chrome::HostDesktopType host_desktop_type, 750 uint32 behavior,
751 uint32 behavior, 751 const std::vector<GURL>& urls_to_open) {
752 const std::vector<GURL>& urls_to_open) {
753 #if defined(OS_CHROMEOS) 752 #if defined(OS_CHROMEOS)
754 chromeos::BootTimesRecorder::Get()->AddLoginTimeMarker( 753 chromeos::BootTimesRecorder::Get()->AddLoginTimeMarker(
755 "SessionRestore-Start", false); 754 "SessionRestore-Start", false);
756 #endif 755 #endif
757 DCHECK(profile); 756 DCHECK(profile);
758 // Always restore from the original profile (incognito profiles have no 757 // Always restore from the original profile (incognito profiles have no
759 // session service). 758 // session service).
760 profile = profile->GetOriginalProfile(); 759 profile = profile->GetOriginalProfile();
761 if (!SessionServiceFactory::GetForProfile(profile)) { 760 if (!SessionServiceFactory::GetForProfile(profile)) {
762 NOTREACHED(); 761 NOTREACHED();
(...skipping 24 matching lines...) Expand all
787 } 786 }
788 } 787 }
789 SessionRestore::RestoreSession(browser->profile(), browser, 788 SessionRestore::RestoreSession(browser->profile(), browser,
790 browser->host_desktop_type(), behavior, 789 browser->host_desktop_type(), behavior,
791 std::vector<GURL>()); 790 std::vector<GURL>());
792 } 791 }
793 792
794 // static 793 // static
795 std::vector<Browser*> SessionRestore::RestoreForeignSessionWindows( 794 std::vector<Browser*> SessionRestore::RestoreForeignSessionWindows(
796 Profile* profile, 795 Profile* profile,
797 chrome::HostDesktopType host_desktop_type, 796 ui::HostDesktopType host_desktop_type,
798 std::vector<const sessions::SessionWindow*>::const_iterator begin, 797 std::vector<const sessions::SessionWindow*>::const_iterator begin,
799 std::vector<const sessions::SessionWindow*>::const_iterator end) { 798 std::vector<const sessions::SessionWindow*>::const_iterator end) {
800 std::vector<GURL> gurls; 799 std::vector<GURL> gurls;
801 SessionRestoreImpl restorer(profile, static_cast<Browser*>(nullptr), 800 SessionRestoreImpl restorer(profile, static_cast<Browser*>(nullptr),
802 host_desktop_type, true, false, true, gurls, 801 host_desktop_type, true, false, true, gurls,
803 on_session_restored_callbacks()); 802 on_session_restored_callbacks());
804 return restorer.RestoreForeignSession(begin, end); 803 return restorer.RestoreForeignSession(begin, end);
805 } 804 }
806 805
807 // static 806 // static
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 if (prioritize_tabs == "mru") 857 if (prioritize_tabs == "mru")
859 return SMART_RESTORE_MODE_MRU; 858 return SMART_RESTORE_MODE_MRU;
860 if (prioritize_tabs == "simple") 859 if (prioritize_tabs == "simple")
861 return SMART_RESTORE_MODE_SIMPLE; 860 return SMART_RESTORE_MODE_SIMPLE;
862 return SMART_RESTORE_MODE_OFF; 861 return SMART_RESTORE_MODE_OFF;
863 } 862 }
864 863
865 // static 864 // static
866 base::CallbackList<void(int)>* 865 base::CallbackList<void(int)>*
867 SessionRestore::on_session_restored_callbacks_ = nullptr; 866 SessionRestore::on_session_restored_callbacks_ = nullptr;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698