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

Unified Diff: chrome/browser/profiles/profile_window.cc

Issue 18615010: Refactor utility methods out of the ProfileManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unbreak rebase and added new static fn from trunk 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_window.h ('k') | chrome/browser/profiles/profiles_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_window.cc
diff --git a/chrome/browser/profiles/profile_window.cc b/chrome/browser/profiles/profile_window.cc
new file mode 100644
index 0000000000000000000000000000000000000000..dde130426e2c006e0fca5798d4b6b84e2eae1278
--- /dev/null
+++ b/chrome/browser/profiles/profile_window.cc
@@ -0,0 +1,51 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/profiles/profile_window.h"
+
+#include "base/command_line.h"
+#include "base/files/file_path.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "content/public/browser/user_metrics.h"
+
+#if !defined(OS_IOS)
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
+#endif // !defined (OS_IOS)
+
+using content::UserMetricsAction;
+
+namespace profiles {
+
+void FindOrCreateNewWindowForProfile(
+ Profile* profile,
+ chrome::startup::IsProcessStartup process_startup,
+ chrome::startup::IsFirstRun is_first_run,
+ chrome::HostDesktopType desktop_type,
+ bool always_create) {
+#if defined(OS_IOS)
+ NOTREACHED();
+#else
+ DCHECK(profile);
+
+ if (!always_create) {
+ Browser* browser = chrome::FindTabbedBrowser(profile, false, desktop_type);
+ if (browser) {
+ browser->window()->Activate();
+ return;
+ }
+ }
+
+ content::RecordAction(UserMetricsAction("NewWindow"));
+ CommandLine command_line(CommandLine::NO_PROGRAM);
+ int return_code;
+ StartupBrowserCreator browser_creator;
+ browser_creator.LaunchBrowser(command_line, profile, base::FilePath(),
+ process_startup, is_first_run, &return_code);
+#endif // defined(OS_IOS)
+}
+
+} // namespace profiles
« no previous file with comments | « chrome/browser/profiles/profile_window.h ('k') | chrome/browser/profiles/profiles_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698