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

Side by Side Diff: chrome/browser/profiles/profile_window.cc

Issue 16104008: First try at a user management screen for the desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix linux CrOS browser test Created 7 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/profiles/profile_window.h" 5 #include "chrome/browser/profiles/profile_window.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "content/public/browser/browser_thread.h"
11 #include "content/public/browser/user_metrics.h" 14 #include "content/public/browser/user_metrics.h"
12 15
13 #if !defined(OS_IOS) 16 #if !defined(OS_IOS)
14 #include "chrome/browser/ui/browser_finder.h" 17 #include "chrome/browser/ui/browser_finder.h"
15 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
16 #include "chrome/browser/ui/startup/startup_browser_creator.h" 19 #include "chrome/browser/ui/startup/startup_browser_creator.h"
17 #endif // !defined (OS_IOS) 20 #endif // !defined (OS_IOS)
18 21
22 using content::BrowserThread;
19 using content::UserMetricsAction; 23 using content::UserMetricsAction;
20 24
25 namespace {
26
27 void OpenBrowserWindowForProfile(bool always_create,
28 chrome::HostDesktopType desktop_type,
29 Profile* profile,
30 Profile::CreateStatus status) {
31 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
32
33 if (status == Profile::CREATE_STATUS_INITIALIZED) {
34 profiles::FindOrCreateNewWindowForProfile(
35 profile,
36 chrome::startup::IS_NOT_PROCESS_STARTUP,
37 chrome::startup::IS_NOT_FIRST_RUN,
38 desktop_type,
39 always_create);
40 }
41 }
42
43 } // namespace
44
21 namespace profiles { 45 namespace profiles {
22 46
23 void FindOrCreateNewWindowForProfile( 47 void FindOrCreateNewWindowForProfile(
24 Profile* profile, 48 Profile* profile,
25 chrome::startup::IsProcessStartup process_startup, 49 chrome::startup::IsProcessStartup process_startup,
26 chrome::startup::IsFirstRun is_first_run, 50 chrome::startup::IsFirstRun is_first_run,
27 chrome::HostDesktopType desktop_type, 51 chrome::HostDesktopType desktop_type,
28 bool always_create) { 52 bool always_create) {
29 #if defined(OS_IOS) 53 #if defined(OS_IOS)
30 NOTREACHED(); 54 NOTREACHED();
(...skipping 10 matching lines...) Expand all
41 65
42 content::RecordAction(UserMetricsAction("NewWindow")); 66 content::RecordAction(UserMetricsAction("NewWindow"));
43 CommandLine command_line(CommandLine::NO_PROGRAM); 67 CommandLine command_line(CommandLine::NO_PROGRAM);
44 int return_code; 68 int return_code;
45 StartupBrowserCreator browser_creator; 69 StartupBrowserCreator browser_creator;
46 browser_creator.LaunchBrowser(command_line, profile, base::FilePath(), 70 browser_creator.LaunchBrowser(command_line, profile, base::FilePath(),
47 process_startup, is_first_run, &return_code); 71 process_startup, is_first_run, &return_code);
48 #endif // defined(OS_IOS) 72 #endif // defined(OS_IOS)
49 } 73 }
50 74
75 void SwitchToProfile(
76 const base::FilePath& path,
77 chrome::HostDesktopType desktop_type,
78 bool always_create) {
79 g_browser_process->profile_manager()->CreateProfileAsync(
80 path,
81 base::Bind(&OpenBrowserWindowForProfile,
82 always_create,
83 desktop_type),
84 string16(),
85 string16(),
86 false);
87 }
88
51 } // namespace profiles 89 } // namespace profiles
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_window.h ('k') | chrome/browser/resources/chromeos/login/display_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698