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

Side by Side Diff: chrome/browser/app_controller_mac.mm

Issue 1659203002: Remove HostDesktopType from FindLastActive[WithProfile] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nullptr Created 4 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/background/background_contents_service.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #import "chrome/browser/app_controller_mac.h" 5 #import "chrome/browser/app_controller_mac.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // because otherwise the SessionService will try to restore sessions when we 121 // because otherwise the SessionService will try to restore sessions when we
122 // make a new window while there are no other active windows. 122 // make a new window while there are no other active windows.
123 bool g_is_opening_new_window = false; 123 bool g_is_opening_new_window = false;
124 124
125 // Activates a browser window having the given profile (the last one active) if 125 // Activates a browser window having the given profile (the last one active) if
126 // possible and returns a pointer to the activate |Browser| or NULL if this was 126 // possible and returns a pointer to the activate |Browser| or NULL if this was
127 // not possible. If the last active browser is minimized (in particular, if 127 // not possible. If the last active browser is minimized (in particular, if
128 // there are only minimized windows), it will unminimize it. 128 // there are only minimized windows), it will unminimize it.
129 Browser* ActivateBrowser(Profile* profile) { 129 Browser* ActivateBrowser(Profile* profile) {
130 Browser* browser = chrome::FindLastActiveWithProfile( 130 Browser* browser = chrome::FindLastActiveWithProfile(
131 profile->IsGuestSession() ? profile->GetOffTheRecordProfile() : profile, 131 profile->IsGuestSession() ? profile->GetOffTheRecordProfile() : profile);
132 chrome::HOST_DESKTOP_TYPE_NATIVE);
133 if (browser) 132 if (browser)
134 browser->window()->Activate(); 133 browser->window()->Activate();
135 return browser; 134 return browser;
136 } 135 }
137 136
138 // Creates an empty browser window with the given profile and returns a pointer 137 // Creates an empty browser window with the given profile and returns a pointer
139 // to the new |Browser|. 138 // to the new |Browser|.
140 Browser* CreateBrowser(Profile* profile) { 139 Browser* CreateBrowser(Profile* profile) {
141 { 140 {
142 base::AutoReset<bool> auto_reset_in_run(&g_is_opening_new_window, true); 141 base::AutoReset<bool> auto_reset_in_run(&g_is_opening_new_window, true);
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 // I/O. 769 // I/O.
771 BrowserThread::PostTask( 770 BrowserThread::PostTask(
772 BrowserThread::FILE, FROM_HERE, 771 BrowserThread::FILE, FROM_HERE,
773 base::Bind(&RecordLastRunAppBundlePath)); 772 base::Bind(&RecordLastRunAppBundlePath));
774 773
775 // Makes "Services" menu items available. 774 // Makes "Services" menu items available.
776 [self registerServicesMenuTypesTo:[notify object]]; 775 [self registerServicesMenuTypesTo:[notify object]];
777 776
778 startupComplete_ = YES; 777 startupComplete_ = YES;
779 778
780 Browser* browser = 779 Browser* browser = chrome::FindLastActive();
781 FindLastActiveWithHostDesktopType(chrome::HOST_DESKTOP_TYPE_NATIVE);
782 content::WebContents* activeWebContents = nullptr; 780 content::WebContents* activeWebContents = nullptr;
783 if (browser) 781 if (browser)
784 activeWebContents = browser->tab_strip_model()->GetActiveWebContents(); 782 activeWebContents = browser->tab_strip_model()->GetActiveWebContents();
785 [self updateHandoffManager:activeWebContents]; 783 [self updateHandoffManager:activeWebContents];
786 [self openStartupUrls]; 784 [self openStartupUrls];
787 785
788 PrefService* localState = g_browser_process->local_state(); 786 PrefService* localState = g_browser_process->local_state();
789 if (localState) { 787 if (localState) {
790 localPrefRegistrar_.Init(localState); 788 localPrefRegistrar_.Init(localState);
791 localPrefRegistrar_.Add( 789 localPrefRegistrar_.Add(
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 1700
1703 //--------------------------------------------------------------------------- 1701 //---------------------------------------------------------------------------
1704 1702
1705 namespace app_controller_mac { 1703 namespace app_controller_mac {
1706 1704
1707 bool IsOpeningNewWindow() { 1705 bool IsOpeningNewWindow() {
1708 return g_is_opening_new_window; 1706 return g_is_opening_new_window;
1709 } 1707 }
1710 1708
1711 } // namespace app_controller_mac 1709 } // namespace app_controller_mac
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/background/background_contents_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698