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

Side by Side Diff: chrome/browser/ui/browser_init.h

Issue 8854001: Honor profile directory when creating new window in existing browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/process_singleton_win.cc ('k') | chrome/browser/ui/browser_init.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_BROWSER_INIT_H_ 5 #ifndef CHROME_BROWSER_UI_BROWSER_INIT_H_
6 #define CHROME_BROWSER_UI_BROWSER_INIT_H_ 6 #define CHROME_BROWSER_UI_BROWSER_INIT_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "chrome/browser/profiles/profile.h"
15 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
16 17
17 class Browser; 18 class Browser;
18 class CommandLine; 19 class CommandLine;
19 class GURL; 20 class GURL;
20 class Profile;
21 class TabContentsWrapper; 21 class TabContentsWrapper;
22 22
23 // class containing helpers for BrowserMain to spin up a new instance and 23 // class containing helpers for BrowserMain to spin up a new instance and
24 // initialize the profile. 24 // initialize the profile.
25 class BrowserInit { 25 class BrowserInit {
26 public: 26 public:
27 enum IsProcessStartup { 27 enum IsProcessStartup {
28 IS_NOT_PROCESS_STARTUP, 28 IS_NOT_PROCESS_STARTUP,
29 IS_PROCESS_STARTUP 29 IS_PROCESS_STARTUP
30 }; 30 };
(...skipping 10 matching lines...) Expand all
41 void AddFirstRunTab(const GURL& url); 41 void AddFirstRunTab(const GURL& url);
42 42
43 // This function is equivalent to ProcessCommandLine but should only be 43 // This function is equivalent to ProcessCommandLine but should only be
44 // called during actual process startup. 44 // called during actual process startup.
45 bool Start(const CommandLine& cmd_line, const FilePath& cur_dir, 45 bool Start(const CommandLine& cmd_line, const FilePath& cur_dir,
46 Profile* profile, int* return_code) { 46 Profile* profile, int* return_code) {
47 return ProcessCmdLineImpl(cmd_line, cur_dir, true, profile, return_code, 47 return ProcessCmdLineImpl(cmd_line, cur_dir, true, profile, return_code,
48 this); 48 this);
49 } 49 }
50 50
51 // This function performs command-line handling and is invoked when process 51 // This function performs command-line handling and is invoked only after
52 // starts as well as when we get a start request from another process (via the 52 // start up (for example when we get a start request for another process).
53 // WM_COPYDATA message). |command_line| holds the command line we need to 53 // |command_line| holds the command line we need to process
54 // process - either from this process or from some other one (if 54 static void ProcessCommandLineAlreadyRunning(const CommandLine& cmd_line,
55 // |process_startup| is true and we are being called from 55 const FilePath& cur_dir);
56 // ProcessSingleton::OnCopyData).
57 static bool ProcessCommandLine(const CommandLine& cmd_line,
58 const FilePath& cur_dir, bool process_startup,
59 Profile* profile, int* return_code) {
60 return ProcessCmdLineImpl(cmd_line, cur_dir, process_startup, profile,
61 return_code, NULL);
62 }
63 56
64 template <class AutomationProviderClass> 57 template <class AutomationProviderClass>
65 static bool CreateAutomationProvider(const std::string& channel_id, 58 static bool CreateAutomationProvider(const std::string& channel_id,
66 Profile* profile, 59 Profile* profile,
67 size_t expected_tabs); 60 size_t expected_tabs);
68 61
69 // Returns true if the browser is coming up. 62 // Returns true if the browser is coming up.
70 static bool InProcessStartup(); 63 static bool InProcessStartup();
71 64
72 // Launches a browser window associated with |profile|. |command_line| should 65 // Launches a browser window associated with |profile|. |command_line| should
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 static std::vector<GURL> GetURLsFromCommandLine( 233 static std::vector<GURL> GetURLsFromCommandLine(
241 const CommandLine& command_line, 234 const CommandLine& command_line,
242 const FilePath& cur_dir, 235 const FilePath& cur_dir,
243 Profile* profile); 236 Profile* profile);
244 237
245 static bool ProcessCmdLineImpl(const CommandLine& command_line, 238 static bool ProcessCmdLineImpl(const CommandLine& command_line,
246 const FilePath& cur_dir, bool process_startup, 239 const FilePath& cur_dir, bool process_startup,
247 Profile* profile, int* return_code, 240 Profile* profile, int* return_code,
248 BrowserInit* browser_init); 241 BrowserInit* browser_init);
249 242
243 // Callback after a profile has been created.
244 static void ProcessCommandLineOnProfileCreated(
245 const CommandLine& cmd_line,
246 const FilePath& cur_dir,
247 Profile* profile,
248 Profile::CreateStatus status);
249
250 // Additional tabs to open during first run. 250 // Additional tabs to open during first run.
251 std::vector<GURL> first_run_tabs_; 251 std::vector<GURL> first_run_tabs_;
252 252
253 DISALLOW_COPY_AND_ASSIGN(BrowserInit); 253 DISALLOW_COPY_AND_ASSIGN(BrowserInit);
254 }; 254 };
255 255
256 #endif // CHROME_BROWSER_UI_BROWSER_INIT_H_ 256 #endif // CHROME_BROWSER_UI_BROWSER_INIT_H_
OLDNEW
« no previous file with comments | « chrome/browser/process_singleton_win.cc ('k') | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698