| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/profiles/profile_window.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" |
| 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "content/public/browser/user_metrics.h" |
| 12 |
| 13 #if !defined(OS_IOS) |
| 14 #include "chrome/browser/ui/browser_finder.h" |
| 15 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 17 #endif // !defined (OS_IOS) |
| 18 |
| 19 using content::UserMetricsAction; |
| 20 |
| 21 namespace profiles { |
| 22 |
| 23 void FindOrCreateNewWindowForProfile( |
| 24 Profile* profile, |
| 25 chrome::startup::IsProcessStartup process_startup, |
| 26 chrome::startup::IsFirstRun is_first_run, |
| 27 chrome::HostDesktopType desktop_type, |
| 28 bool always_create) { |
| 29 #if defined(OS_IOS) |
| 30 NOTREACHED(); |
| 31 #else |
| 32 DCHECK(profile); |
| 33 |
| 34 if (!always_create) { |
| 35 Browser* browser = chrome::FindTabbedBrowser(profile, false, desktop_type); |
| 36 if (browser) { |
| 37 browser->window()->Activate(); |
| 38 return; |
| 39 } |
| 40 } |
| 41 |
| 42 content::RecordAction(UserMetricsAction("NewWindow")); |
| 43 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 44 int return_code; |
| 45 StartupBrowserCreator browser_creator; |
| 46 browser_creator.LaunchBrowser(command_line, profile, base::FilePath(), |
| 47 process_startup, is_first_run, &return_code); |
| 48 #endif // defined(OS_IOS) |
| 49 } |
| 50 |
| 51 } // namespace profiles |
| OLD | NEW |