summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-16 17:47:57 +0000
committerpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-16 17:47:57 +0000
commit1bcdb53dbddb785f5538cb7081b073db90c822d1 (patch)
tree9b67e0a51f98ff2d0f0bb3462f530a08a8b7e6c4
parent091db5d0615084d28dfbb78d8dd6c0e169b510a4 (diff)
downloadchromium_src-1bcdb53dbddb785f5538cb7081b073db90c822d1.zip
chromium_src-1bcdb53dbddb785f5538cb7081b073db90c822d1.tar.gz
chromium_src-1bcdb53dbddb785f5538cb7081b073db90c822d1.tar.bz2
mac bootstrapping of browser main and app startup bits
Review URL: http://codereview.chromium.org/18112 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8185 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/chrome_dll_main.cc15
-rw-r--r--chrome/app/nibs/English.lproj/MainMenu.xib63
-rw-r--r--chrome/browser/app_controller_mac.h21
-rw-r--r--chrome/browser/app_controller_mac.mm27
-rw-r--r--chrome/browser/browser_main.cc132
-rw-r--r--chrome/browser/browser_main_mac.mm61
-rw-r--r--chrome/browser/browser_main_win.h2
-rw-r--r--chrome/browser/plugin_service.cc2
-rw-r--r--chrome/browser/plugin_service.h1
-rw-r--r--chrome/chrome.xcodeproj/project.pbxproj16
-rw-r--r--chrome/common/chrome_paths.cc8
-rw-r--r--chrome/common/temp_scaffolding_stubs.cpp204
-rw-r--r--chrome/common/temp_scaffolding_stubs.h195
13 files changed, 673 insertions, 74 deletions
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index 3fd4fc7..05fd8b7 100644
--- a/chrome/app/chrome_dll_main.cc
+++ b/chrome/app/chrome_dll_main.cc
@@ -22,6 +22,7 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/process_util.h"
+#include "base/scoped_nsautorelease_pool.h"
#include "base/stats_table.h"
#include "base/string_util.h"
#if defined(OS_WIN)
@@ -195,6 +196,13 @@ int ChromeMain(int argc, const char** argv) {
// The exit manager is in charge of calling the dtors of singleton objects.
base::AtExitManager exit_manager;
+ // TODO(pinkerton): We need this pool here for all the objects created
+ // before we get to the UI event loop, but we don't want to leave them
+ // hanging around until the app quits. We should add a "flush" to the class
+ // which just cycles the pool under the covers and then call that just
+ // before we invoke the main UI loop near the bottom of this function.
+ base::ScopedNSAutoreleasePool autorelease_pool;
+
// Initialize the command line.
#if defined(OS_POSIX)
CommandLine::SetArgcArgv(argc, argv);
@@ -304,13 +312,6 @@ int ChromeMain(int argc, const char** argv) {
NOTREACHED() << "Unknown process type";
}
- // TODO(pinkerton): nothing after this point will be hit on Mac if this is the
- // browser process, as NSApplicationMain doesn't return. There are a couple of
- // possible solutions, including breaking this up into pre/post code (won't
- // work for stack-based objects) or making sure we fall out of the runloop
- // ourselves, then manually call |-NSApp terminate:|. We'll most likely
- // need to do the latter.
-
if (!process_type.empty()) {
#if defined(OS_WIN)
// TODO(port): enable when we figure out resource bundle issues
diff --git a/chrome/app/nibs/English.lproj/MainMenu.xib b/chrome/app/nibs/English.lproj/MainMenu.xib
index 3c5ef2d..8a8d5be 100644
--- a/chrome/app/nibs/English.lproj/MainMenu.xib
+++ b/chrome/app/nibs/English.lproj/MainMenu.xib
@@ -1,19 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
+<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">9F33</string>
- <string key="IBDocument.InterfaceBuilderVersion">670</string>
+ <string key="IBDocument.InterfaceBuilderVersion">677</string>
<string key="IBDocument.AppKitVersion">949.34</string>
<string key="IBDocument.HIToolboxVersion">352.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="29"/>
+ <integer value="136"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1021">
@@ -945,6 +954,9 @@
</object>
<string key="NSName">_NSMainMenu</string>
</object>
+ <object class="NSCustomObject" id="168151378">
+ <string key="NSClassName">AppController</string>
+ </object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
@@ -1214,12 +1226,20 @@
<int key="connectionID">372</int>
</object>
<object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="1050"/>
+ <reference key="destination" ref="168151378"/>
+ </object>
+ <int key="connectionID">485</int>
+ </object>
+ <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">terminate:</string>
- <reference key="source" ref="1021"/>
+ <string key="label">quit:</string>
+ <reference key="source" ref="168151378"/>
<reference key="destination" ref="632727374"/>
</object>
- <int key="connectionID">448</int>
+ <int key="connectionID">489</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -1988,6 +2008,11 @@
<reference key="object" ref="720866399"/>
<reference key="parent" ref="839200213"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">483</int>
+ <reference key="object" ref="168151378"/>
+ <reference key="parent" ref="1049"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -2134,6 +2159,7 @@
<string>351.ImportedFromIB2</string>
<string>354.IBPluginDependency</string>
<string>354.ImportedFromIB2</string>
+ <string>373.IBPluginDependency</string>
<string>449.IBPluginDependency</string>
<string>450.IBPluginDependency</string>
<string>451.IBPluginDependency</string>
@@ -2170,6 +2196,7 @@
<string>479.IBPluginDependency</string>
<string>480.IBPluginDependency</string>
<string>481.IBPluginDependency</string>
+ <string>483.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
<string>5.ImportedFromIB2</string>
<string>56.IBPluginDependency</string>
@@ -2363,6 +2390,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{568, 573}, {178, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2384,6 +2412,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
@@ -2407,7 +2436,7 @@
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{245, 513}, {229, 233}}</string>
+ <string>{{207, 513}, {229, 233}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{323, 672}, {199, 203}}</string>
@@ -2439,9 +2468,25 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">481</int>
+ <int key="maxID">489</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">AppController</string>
+ <string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">quit:</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/app_controller_mac.h</string>
+ </object>
+ </object>
+ </object>
</object>
- <object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.LastKnownRelativeProjectPath">../../../chrome.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
diff --git a/chrome/browser/app_controller_mac.h b/chrome/browser/app_controller_mac.h
new file mode 100644
index 0000000..09fa014
--- /dev/null
+++ b/chrome/browser/app_controller_mac.h
@@ -0,0 +1,21 @@
+// Copyright (c) 2009 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.
+
+#ifndef CHROME_BROWSER_APP_CONTROLLER_MAC_H_
+#define CHROME_BROWSER_APP_CONTROLLER_MAC_H_
+
+#import <Cocoa/Cocoa.h>
+
+// The application controller object, created by loading the MainMenu nib.
+// This handles things like responding to menus when there are no windows
+// open, etc and acts as the NSApplication delegate.
+@interface AppController : NSObject {
+ @public
+}
+
+- (IBAction)quit:(id)sender;
+
+@end
+
+#endif
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
new file mode 100644
index 0000000..cf0c49f
--- /dev/null
+++ b/chrome/browser/app_controller_mac.mm
@@ -0,0 +1,27 @@
+// Copyright (c) 2009 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.
+
+#import "app_controller_mac.h"
+
+#import "base/message_loop.h"
+
+@implementation AppController
+
+// We can't use the standard terminate: method because it will abrubptly exit
+// the app and leave things on the stack in an unfinalized state. We need to
+// post a quit message to our run loop so the stack can gracefully unwind.
+- (IBAction)quit:(id)sender {
+ // TODO(pinkerton):
+ // since we have to roll it ourselves, ask the delegate (ourselves, really)
+ // if we should terminate. For example, we might not want to if the user
+ // has ongoing downloads or multiple windows/tabs open. However, this would
+ // require posting UI and may require spinning up another run loop to
+ // handle it. If it says to continue, post the quit message, otherwise
+ // go back to normal.
+
+ MessageLoopForUI::current()->Quit();
+}
+
+
+@end
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 5c4e21d..c95acae 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -4,11 +4,41 @@
#include "build/build_config.h"
+#include <algorithm>
+
#include "base/command_line.h"
+#include "base/field_trial.h"
+#include "base/file_util.h"
+#include "base/histogram.h"
+#include "base/lazy_instance.h"
+#include "base/path_service.h"
+#include "base/process_util.h"
+#include "base/string_piece.h"
+#include "base/string_util.h"
+#include "base/system_monitor.h"
+#include "base/tracked_objects.h"
+#include "base/values.h"
+#include "chrome/app/result_codes.h"
+#include "chrome/browser/browser_main_win.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/plugin_service.h"
+#include "chrome/browser/shell_integration.h"
+#include "chrome/common/chrome_constants.h"
+#include "chrome/common/chrome_paths.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/jstemplate_builder.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/common/main_function_params.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/common/pref_service.h"
-#if defined(OS_WIN)
-#include "sandbox/src/sandbox.h"
+#include "chromium_strings.h"
+#include "generated_resources.h"
+
+#if defined(OS_POSIX)
+// TODO(port): get rid of this include. It's used just to provide declarations
+// and stub definitions for classes we encouter during the porting effort.
+#include "chrome/common/temp_scaffolding_stubs.h"
#endif
// TODO(port): several win-only methods have been pulled out of this, but
@@ -21,25 +51,12 @@
#include <windows.h>
#include <shellapi.h>
-#include <algorithm>
-
-#include "base/file_util.h"
-#include "base/histogram.h"
-#include "base/lazy_instance.h"
-#include "base/path_service.h"
-#include "base/process_util.h"
#include "base/registry.h"
-#include "base/string_piece.h"
-#include "base/string_util.h"
-#include "base/system_monitor.h"
-#include "base/tracked_objects.h"
#include "base/win_util.h"
-#include "chrome/app/result_codes.h"
#include "chrome/browser/automation/automation_provider.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_init.h"
#include "chrome/browser/browser_list.h"
-#include "chrome/browser/browser_main_win.h"
#include "chrome/browser/browser_prefs.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/browser_shutdown.h"
@@ -53,22 +70,13 @@
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/net/dns_global.h"
#include "chrome/browser/net/sdch_dictionary_fetcher.h"
-#include "chrome/browser/plugin_service.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/rlz/rlz.h"
-#include "chrome/browser/shell_integration.h"
#include "chrome/browser/url_fixer_upper.h"
#include "chrome/browser/user_data_manager.h"
#include "chrome/browser/views/user_data_dir_dialog.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/chrome_switches.h"
#include "chrome/common/env_vars.h"
-#include "chrome/common/jstemplate_builder.h"
-#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
-#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/win_util.h"
#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/helper.h"
@@ -81,11 +89,31 @@
#include "net/base/sdch_manager.h"
#include "net/base/winsock_init.h"
#include "net/http/http_network_layer.h"
+#include "sandbox/src/sandbox.h"
-#include "chromium_strings.h"
-#include "generated_resources.h"
#include "net_resources.h"
+#endif
+
+namespace Platform {
+
+void WillInitializeMainMessageLoop(const CommandLine & command_line);
+void WillTerminate();
+
+#if defined(OS_WIN) || defined(OS_LINUX)
+// Perform any platform-specific work that needs to be done before the main
+// message loop is created and initialized.
+void WillInitializeMainMessageLoop(const CommandLine & command_line) {
+}
+
+// Perform platform-specific work that needs to be done after the main event
+// loop has ended.
+void WillTerminate() {
+}
+#endif
+
+} // namespace Platform
+
namespace {
// This function provides some ways to test crash and assertion handling
@@ -103,6 +131,7 @@ void HandleErrorTestParameters(const CommandLine& command_line) {
}
}
+#if defined(OS_WIN)
// The net module doesn't have access to this HTML or the strings that need to
// be localized. The Chrome locale will never change while we're running, so
// it's safe to have a static string that we always return a pointer into.
@@ -141,14 +170,13 @@ StringPiece NetResourceProvider(int key) {
return ResourceBundle::GetSharedInstance().GetRawDataResource(key);
}
+#endif
} // namespace
// Main routine for running as the Browser process.
int BrowserMain(const MainFunctionParams& parameters) {
CommandLine& parsed_command_line = parameters.command_line_;
- sandbox::BrokerServices* broker_services =
- parameters.sandbox_info_.BrokerServices();
// WARNING: If we get a WM_ENDSESSION objects created on the stack here
// are NOT deleted. If you need something to run during WM_ENDSESSION add it
@@ -164,6 +192,11 @@ int BrowserMain(const MainFunctionParams& parameters) {
tracked_objects::AutoTracking tracking_objects;
#endif
+ // Do platform-specific things (such as finishing initiailizing Cocoa)
+ // prior to instantiating the message loop. This could be turned into a
+ // broadcast notification.
+ Platform::WillInitializeMainMessageLoop(parsed_command_line);
+
MessageLoop main_message_loop(MessageLoop::TYPE_UI);
// Initialize the SystemMonitor
@@ -258,13 +291,17 @@ int BrowserMain(const MainFunctionParams& parameters) {
parent_local_state.GetString(prefs::kApplicationLocale));
}
+#if defined(OS_WIN)
ResourceBundle::InitSharedInstance(
local_state->GetString(prefs::kApplicationLocale));
// We only load the theme dll in the browser process.
ResourceBundle::GetSharedInstance().LoadThemeResources();
+#endif
if (!parsed_command_line.HasSwitch(switches::kNoErrorDialogs)) {
// Display a warning if the user is running windows 2000.
+ // TODO(port). We should probably change this to a "check for minimum
+ // requirements" function, implemented by each platform.
CheckForWin2000();
}
@@ -278,6 +315,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
ProfileManager* profile_manager = browser_process->profile_manager();
Profile* profile = profile_manager->GetDefaultProfile(user_data_dir);
if (!profile) {
+#if defined(OS_WIN)
user_data_dir = UserDataDirDialog::RunUserDataDirDialog(user_data_dir);
// Flush the message loop which lets the UserDataDirDialog close.
MessageLoop::current()->Run();
@@ -297,6 +335,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
}
return ResultCodes::NORMAL_EXIT;
+#endif
}
PrefService* user_prefs = profile->GetPrefs();
@@ -313,10 +352,12 @@ int BrowserMain(const MainFunctionParams& parameters) {
// unless we detect another chrome browser running.
if (parsed_command_line.HasSwitch(switches::kUninstall)) {
if (already_running) {
+#if defined(OS_WIN)
const std::wstring text = l10n_util::GetString(IDS_UNINSTALL_CLOSE_APP);
const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME);
win_util::MessageBox(NULL, text, caption,
MB_OK | MB_ICONWARNING | MB_TOPMOST);
+#endif
return ResultCodes::UNINSTALL_CHROME_ALIVE;
} else {
return DoUninstallTasks();
@@ -380,6 +421,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
// testing against a bunch of special cases that are taken care early on.
PrepareRestartOnCrashEnviroment(parsed_command_line);
+#if defined(OS_WIN)
// Initialize Winsock.
net::EnsureWinsockInit();
@@ -408,7 +450,10 @@ int BrowserMain(const MainFunctionParams& parameters) {
RegisterURLRequestChromeJob();
RegisterExtensionProtocols();
+ sandbox::BrokerServices* broker_services =
+ parameters.sandbox_info_.BrokerServices();
browser_process->InitBrokerServices(broker_services);
+#endif
// In unittest mode, this will do nothing. In normal mode, this will create
// the global GoogleURLTracker instance, which will promptly go to sleep for
@@ -428,6 +473,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
// Have Chrome plugins write their data to the profile directory.
PluginService::GetInstance()->SetChromePluginDataDir(profile->GetPath());
+#if defined(OS_WIN)
// Initialize the CertStore.
CertStore::Initialize();
@@ -441,6 +487,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
WideToASCII(parsed_command_line.GetSwitchValue(switches::kSdchFilter));
}
sdch_manager.EnableSdchSupport(switch_domain);
+#endif
MetricsService* metrics = NULL;
if (!parsed_command_line.HasSwitch(switches::kDisableMetrics)) {
@@ -467,10 +514,12 @@ int BrowserMain(const MainFunctionParams& parameters) {
}
InstallJankometer(parsed_command_line);
+#if defined(OS_WIN)
if (parsed_command_line.HasSwitch(switches::kDebugPrint)) {
browser_process->print_job_manager()->set_debug_dump_path(
parsed_command_line.GetSwitchValue(switches::kDebugPrint));
}
+#endif
HandleErrorTestParameters(parsed_command_line);
@@ -479,9 +528,15 @@ int BrowserMain(const MainFunctionParams& parameters) {
int result_code = ResultCodes::NORMAL_EXIT;
if (BrowserInit::ProcessCommandLine(parsed_command_line, L"", local_state,
true, profile, &result_code)) {
+#if defined(OS_WIN)
MessageLoopForUI::current()->Run(browser_process->accelerator_handler());
+#elif defined(OS_POSIX)
+ MessageLoopForUI::current()->Run();
+#endif
}
+ Platform::WillTerminate();
+
if (metrics)
metrics->Stop();
@@ -493,24 +548,3 @@ int BrowserMain(const MainFunctionParams& parameters) {
return result_code;
}
-#elif defined(OS_POSIX)
-
-// Call to kick off the main message loop. The implementation for this on Mac
-// must reside in another file because it has to call Cocoa functions and thus
-// cannot live in a .cc file.
-int StartPlatformMessageLoop();
-
-// TODO(port): merge this with above. Just a stub for now, not meant as a place
-// to duplicate code.
-// Main routine for running as the Browser process.
-int BrowserMain(const MainFunctionParams& parameters) {
- return StartPlatformMessageLoop();
-}
-
-#if defined(OS_LINUX)
-void StartPlatformMessageLoop() {
- return 0;
-}
-#endif
-
-#endif
diff --git a/chrome/browser/browser_main_mac.mm b/chrome/browser/browser_main_mac.mm
index c6c4381..8f493f3 100644
--- a/chrome/browser/browser_main_mac.mm
+++ b/chrome/browser/browser_main_mac.mm
@@ -1,11 +1,66 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2008 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 <Cocoa/Cocoa.h>
#include "base/command_line.h"
+#include "chrome/app/result_codes.h"
+#include "chrome/browser/app_controller_mac.h"
+#include "chrome/browser/browser_main_win.h"
#include <crt_externs.h>
-int StartPlatformMessageLoop() {
- return NSApplicationMain(*_NSGetArgc(), (const char**)*_NSGetArgv());
+namespace Platform {
+
+// Perform and platform-specific work that needs to be done before the main
+// message loop is created and initialized.
+//
+// For Mac, this involves telling Cooca to finish its initalization, which we
+// want to do manually instead of calling NSApplicationMain(). The primary
+// reason is that NSAM() never returns, which would leave all the objects
+// currently on the stack in scoped_ptrs hanging and never cleaned up. We then
+// load the main nib directly. The main event loop is run from common code using
+// the MessageLoop API, which works out ok for us because it's a wrapper around
+// CFRunLoop.
+void WillInitializeMainMessageLoop(const CommandLine & command_line) {
+ [NSApplication sharedApplication];
+ [NSBundle loadNibNamed:@"MainMenu" owner:NSApp];
+}
+
+// Perform platform-specific work that needs to be done after the main event
+// loop has ended. We need to send the notifications that Cooca normally would
+// telling everyone the app is about to end.
+void WillTerminate() {
+ [[NSNotificationCenter defaultCenter]
+ postNotificationName:NSApplicationWillTerminateNotification
+ object:NSApp];
+}
+
+}
+
+// From browser_main_win.h, stubs until we figure out the right thing...
+
+int DoUninstallTasks() {
+ return ResultCodes::NORMAL_EXIT;
+}
+
+bool DoUpgradeTasks(const CommandLine& command_line) {
+ return ResultCodes::NORMAL_EXIT;
+}
+
+bool CheckForWin2000() {
+ return false;
+}
+
+int HandleIconsCommands(const CommandLine &parsed_command_line) {
+ return 0;
+}
+
+bool CheckMachineLevelInstall() {
+ return false;
+}
+
+void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) {
+}
+
+void RecordBreakpadStatusUMA(MetricsService* metrics) {
}
diff --git a/chrome/browser/browser_main_win.h b/chrome/browser/browser_main_win.h
index d44958f..9069058 100644
--- a/chrome/browser/browser_main_win.h
+++ b/chrome/browser/browser_main_win.h
@@ -43,4 +43,4 @@ bool DoUpgradeTasks(const CommandLine& command_line);
// failed and that the process is being debugged.
void RecordBreakpadStatusUMA(MetricsService* metrics);
-#endif // CHROME_BROWSER_BROWSER_MAIN_WIN_H_ \ No newline at end of file
+#endif // CHROME_BROWSER_BROWSER_MAIN_WIN_H_
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc
index fc95294..235ccf4 100644
--- a/chrome/browser/plugin_service.cc
+++ b/chrome/browser/plugin_service.cc
@@ -23,8 +23,8 @@ PluginService* PluginService::GetInstance() {
PluginService::PluginService()
: main_message_loop_(MessageLoop::current()),
- ui_locale_(g_browser_process->GetApplicationLocale()),
resource_dispatcher_host_(NULL),
+ ui_locale_(g_browser_process->GetApplicationLocale()),
plugin_shutdown_handler_(new ShutdownHandler) {
// Have the NPAPI plugin list search for Chrome plugins as well.
ChromePluginLib::RegisterPluginsWithNPAPI();
diff --git a/chrome/browser/plugin_service.h b/chrome/browser/plugin_service.h
index 1355b64..c37b362 100644
--- a/chrome/browser/plugin_service.h
+++ b/chrome/browser/plugin_service.h
@@ -176,6 +176,7 @@ class PluginProcessHostIterator {
PluginProcessHostIterator& operator=(
const PluginProcessHostIterator& instance) {
iterator_ = instance.iterator_;
+ return *this;
}
const PluginProcessHost* operator->() const {
diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj
index 289f701..99879cc 100644
--- a/chrome/chrome.xcodeproj/project.pbxproj
+++ b/chrome/chrome.xcodeproj/project.pbxproj
@@ -298,6 +298,8 @@
E450775F0F154036003BE099 /* mru_cache_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFBD40E9D4C9F009A6919 /* mru_cache_unittest.cc */; };
E45077620F15405C003BE099 /* notification_service_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFBDB0E9D4C9F009A6919 /* notification_service_unittest.cc */; };
E46C42130F1D3DD200B393B8 /* user_script_master.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0082A7510F16987A000AA0EF /* user_script_master.cc */; };
+ E46C46C50F1F9AE200B393B8 /* temp_scaffolding_stubs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E46C46C40F1F9AE200B393B8 /* temp_scaffolding_stubs.cpp */; };
+ E46C4A740F1FE04F00B393B8 /* app_controller_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E46C45990F1F88D100B393B8 /* app_controller_mac.mm */; };
E48FB9590EC4E9C10052B72B /* safe_browsing_database_bloom.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFADF0E9D49DE009A6919 /* safe_browsing_database_bloom.cc */; };
E48FB95C0EC4E9DD0052B72B /* safe_browsing_database_impl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFAE10E9D49DE009A6919 /* safe_browsing_database_impl.cc */; };
E48FB9760EC4EA320052B72B /* url_request_failed_dns_job.cc in Sources */ = {isa = PBXBuildFile; fileRef = E48FB96E0EC4EA270052B72B /* url_request_failed_dns_job.cc */; };
@@ -920,6 +922,7 @@
09E89F13F9048F95F68B4887 /* metrics_service.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = metrics_service.cc; path = browser/metrics/metrics_service.cc; sourceTree = SOURCE_ROOT; };
11525634D3FBF3508C475B46 /* metrics_response.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = metrics_response.cc; path = browser/metrics/metrics_response.cc; sourceTree = SOURCE_ROOT; };
187598100CC57B863A3BDD57 /* metrics_log_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = metrics_log_unittest.cc; path = browser/metrics/metrics_log_unittest.cc; sourceTree = SOURCE_ROOT; };
+ 26D97CE692D919FEB1521E43 /* ssl_error_info.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ssl_error_info.cc; path = browser/ssl/ssl_error_info.cc; sourceTree = SOURCE_ROOT; };
28AA584AB2ECFB33C7C7FD8A /* template_url_parser.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = template_url_parser.cc; path = browser/search_engines/template_url_parser.cc; sourceTree = SOURCE_ROOT; };
3CCF8AA8A56FF8FE59F0C299 /* template_url.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = template_url.cc; path = browser/search_engines/template_url.cc; sourceTree = SOURCE_ROOT; };
4D640CBD0EAE868600EBCFC0 /* about_handler.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = about_handler.cc; sourceTree = "<group>"; };
@@ -1702,6 +1705,10 @@
E45076E30F153AB6003BE099 /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unzip.h; sourceTree = "<group>"; };
E45076E40F153AB6003BE099 /* unzip.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = unzip.cc; sourceTree = "<group>"; };
E45076E80F153B06003BE099 /* unzip_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = unzip_unittest.cc; sourceTree = "<group>"; };
+ E46C45980F1F88D100B393B8 /* app_controller_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = app_controller_mac.h; sourceTree = "<group>"; };
+ E46C45990F1F88D100B393B8 /* app_controller_mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = app_controller_mac.mm; sourceTree = "<group>"; };
+ E46C46C30F1F9AE200B393B8 /* temp_scaffolding_stubs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = temp_scaffolding_stubs.h; sourceTree = "<group>"; };
+ E46C46C40F1F9AE200B393B8 /* temp_scaffolding_stubs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = temp_scaffolding_stubs.cpp; sourceTree = "<group>"; };
E48FB9610EC4EA270052B72B /* automation_autocomplete_edit_tracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = automation_autocomplete_edit_tracker.h; sourceTree = "<group>"; };
E48FB9620EC4EA270052B72B /* automation_browser_tracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = automation_browser_tracker.h; sourceTree = "<group>"; };
E48FB9630EC4EA270052B72B /* automation_constrained_window_tracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = automation_constrained_window_tracker.h; sourceTree = "<group>"; };
@@ -1731,7 +1738,6 @@
EA72C084DB3FC0FC595E525E /* template_url_model.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = template_url_model.cc; path = browser/search_engines/template_url_model.cc; sourceTree = SOURCE_ROOT; };
EFB2D9BDD612A100477ECCBD /* user_metrics.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = user_metrics.cc; path = browser/metrics/user_metrics.cc; sourceTree = SOURCE_ROOT; };
F145A671557D09F55DCD580A /* metrics_response_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = metrics_response_unittest.cc; path = browser/metrics/metrics_response_unittest.cc; sourceTree = SOURCE_ROOT; };
- 26D97CE692D919FEB1521E43 /* ssl_error_info.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ssl_error_info.cc; path = browser/ssl/ssl_error_info.cc; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -2015,6 +2021,8 @@
E450761C0F150DF9003BE099 /* webdata */,
4D7BF8240E9D4839009A6919 /* alternate_nav_url_fetcher.cc */,
4D7BF8250E9D4839009A6919 /* alternate_nav_url_fetcher.h */,
+ E46C45980F1F88D100B393B8 /* app_controller_mac.h */,
+ E46C45990F1F88D100B393B8 /* app_controller_mac.mm */,
4D7BF8260E9D4839009A6919 /* app_modal_dialog_queue.cc */,
4D7BF8270E9D4839009A6919 /* app_modal_dialog_queue.h */,
4D7BF8280E9D4839009A6919 /* back_forward_menu_model.cc */,
@@ -2629,6 +2637,8 @@
4D7BFC020E9D4C9F009A6919 /* stl_util-inl.h */,
4D7BFC030E9D4C9F009A6919 /* task_queue.cc */,
4D7BFC040E9D4C9F009A6919 /* task_queue.h */,
+ E46C46C30F1F9AE200B393B8 /* temp_scaffolding_stubs.h */,
+ E46C46C40F1F9AE200B393B8 /* temp_scaffolding_stubs.cpp */,
4D7BFC060E9D4C9F009A6919 /* throb_animation.cc */,
4D7BFC070E9D4C9F009A6919 /* throb_animation.h */,
4D7BFC080E9D4C9F009A6919 /* thumbnail_score.cc */,
@@ -3703,6 +3713,7 @@
4D7BF9AC0E9D4880009A6919 /* page_state.cc in Sources */,
4D7BFA280E9D490C009A6919 /* page_usage_data.cc in Sources */,
4D7BFAF10E9D49EB009A6919 /* protocol_parser.cc in Sources */,
+ B6CCB9FA0F1EC33100106F0D /* provisional_load_details.cc in Sources */,
E4F324500EE5CF7C002533CE /* query_parser.cc in Sources */,
E4F3247A0EE5D17E002533CE /* referrer.cc in Sources */,
4D7BF9B10E9D4888009A6919 /* renderer_security_policy.cc in Sources */,
@@ -3741,7 +3752,6 @@
4D7BFA430E9D491E009A6919 /* visit_tracker.cc in Sources */,
4D7BFA480E9D4922009A6919 /* visitsegment_database.cc in Sources */,
E45076200F150E0C003BE099 /* web_database.cc in Sources */,
- B6CCB9FA0F1EC33100106F0D /* provisional_load_details.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3821,6 +3831,7 @@
4D7BFC840E9D4D32009A6919 /* sqlite_compiled_statement.cc in Sources */,
4D7BFC8B0E9D4D35009A6919 /* sqlite_utils.cc in Sources */,
4D7BFC920E9D4D3A009A6919 /* task_queue.cc in Sources */,
+ E46C46C50F1F9AE200B393B8 /* temp_scaffolding_stubs.cpp in Sources */,
4D7BFC970E9D4D3E009A6919 /* throb_animation.cc in Sources */,
4D7BFC9C0E9D4D46009A6919 /* thumbnail_score.cc in Sources */,
E45076AB0F153629003BE099 /* time_format.cc in Sources */,
@@ -3851,6 +3862,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ E46C4A740F1FE04F00B393B8 /* app_controller_mac.mm in Sources */,
E45062EB0EE9877F003BE099 /* chrome_dll_main.cc in Sources */,
E45060F20EE87D41003BE099 /* chrome_exe_main.mm in Sources */,
);
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index 7b2abc5..297b963 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -35,8 +35,12 @@ bool GetDefaultUserDataDirectory(std::wstring* result) {
file_util::AppendToPath(result, chrome::kBrowserAppName);
file_util::AppendToPath(result, chrome::kUserDataDirname);
return true;
-#else // defined(OS_WIN)
- // TODO(port): Decide what to do on other platforms.
+#elif defined(OS_MACOSX)
+ if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result))
+ return false;
+ return true;
+#elif defined(OS_LINUX)
+ // TODO(port): Decide what to do on linux.
NOTIMPLEMENTED();
return false;
#endif // defined(OS_WIN)
diff --git a/chrome/common/temp_scaffolding_stubs.cpp b/chrome/common/temp_scaffolding_stubs.cpp
new file mode 100644
index 0000000..756c8c2
--- /dev/null
+++ b/chrome/common/temp_scaffolding_stubs.cpp
@@ -0,0 +1,204 @@
+// Copyright (c) 2009 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 "temp_scaffolding_stubs.h"
+
+#include "base/file_util.h"
+#include "base/thread.h"
+#include "base/path_service.h"
+#include "base/singleton.h"
+#include "chrome/browser/plugin_service.h"
+#include "chrome/browser/shell_integration.h"
+#include "chrome/common/chrome_constants.h"
+#include "chrome/common/chrome_paths.h"
+#include "chrome/common/pref_service.h"
+
+BrowserProcessImpl::BrowserProcessImpl(CommandLine& command_line)
+ : created_local_state_(), created_metrics_service_(),
+ created_profile_manager_() {
+ g_browser_process = this;
+}
+
+BrowserProcessImpl::~BrowserProcessImpl() {
+ g_browser_process = NULL;
+}
+
+void BrowserProcessImpl::CreateLocalState() {
+ DCHECK(!created_local_state_ && local_state_.get() == NULL);
+ created_local_state_ = true;
+
+ std::wstring local_state_path;
+ PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
+ local_state_.reset(new PrefService(local_state_path));
+}
+
+void BrowserProcessImpl::CreateMetricsService() {
+ DCHECK(!created_metrics_service_ && metrics_service_.get() == NULL);
+ created_metrics_service_ = true;
+
+ metrics_service_.reset(new MetricsService);
+}
+
+void BrowserProcessImpl::CreateProfileManager() {
+ DCHECK(!created_profile_manager_ && profile_manager_.get() == NULL);
+ created_profile_manager_ = true;
+
+ profile_manager_.reset(new ProfileManager());
+}
+
+MetricsService* BrowserProcessImpl::metrics_service() {
+ if (!created_metrics_service_)
+ CreateMetricsService();
+ return metrics_service_.get();
+}
+
+ProfileManager* BrowserProcessImpl::profile_manager() {
+ if (!created_profile_manager_)
+ CreateProfileManager();
+ return profile_manager_.get();
+}
+
+PrefService* BrowserProcessImpl::local_state() {
+ if (!created_local_state_)
+ CreateLocalState();
+ return local_state_.get();
+}
+
+//--------------------------------------------------------------------------
+
+static bool s_in_startup = false;
+
+bool BrowserInit::ProcessCommandLine(const CommandLine& parsed_command_line,
+ const std::wstring& cur_dir,
+ PrefService* prefs, bool process_startup,
+ Profile* profile, int* return_code) {
+ return LaunchBrowser(parsed_command_line, profile, cur_dir,
+ process_startup, return_code);
+}
+
+bool BrowserInit::LaunchBrowser(const CommandLine& parsed_command_line,
+ Profile* profile, const std::wstring& cur_dir,
+ bool process_startup, int* return_code) {
+ s_in_startup = process_startup;
+ bool result = LaunchBrowserImpl(parsed_command_line, profile, cur_dir,
+ process_startup, return_code);
+ s_in_startup = false;
+ return result;
+}
+
+bool BrowserInit::LaunchBrowserImpl(const CommandLine& parsed_command_line,
+ Profile* profile,
+ const std::wstring& cur_dir,
+ bool process_startup,
+ int* return_code) {
+ DCHECK(profile);
+
+ // LAUNCH BROWSER WITH PROFILE HERE!
+
+ return true;
+}
+
+//--------------------------------------------------------------------------
+
+UserDataManager* UserDataManager::instance_ = NULL;
+
+void UserDataManager::Create() {
+ DCHECK(!instance_);
+ std::wstring user_data;
+ PathService::Get(chrome::DIR_USER_DATA, &user_data);
+ instance_ = new UserDataManager(user_data);
+}
+
+UserDataManager* UserDataManager::Get() {
+ DCHECK(instance_);
+ return instance_;
+}
+
+//--------------------------------------------------------------------------
+
+std::wstring ProfileManager::GetDefaultProfileDir(
+ const std::wstring& user_data_dir) {
+ std::wstring default_profile_dir(user_data_dir);
+ file_util::AppendToPath(&default_profile_dir, chrome::kNotSignedInProfile);
+ return default_profile_dir;
+}
+
+std::wstring ProfileManager::GetDefaultProfilePath(
+ const std::wstring &profile_dir) {
+ std::wstring default_prefs_path(profile_dir);
+ file_util::AppendToPath(&default_prefs_path, chrome::kPreferencesFilename);
+ return default_prefs_path;
+}
+
+Profile* ProfileManager::GetDefaultProfile(const std::wstring& user_data_dir) {
+ std::wstring default_profile_dir = GetDefaultProfileDir(user_data_dir);
+ return new Profile(default_profile_dir);
+}
+
+//--------------------------------------------------------------------------
+
+Profile::Profile(const std::wstring& path)
+ : path_(path) {
+}
+
+std::wstring Profile::GetPrefFilePath() {
+ std::wstring pref_file_path = path_;
+ file_util::AppendToPath(&pref_file_path, chrome::kPreferencesFilename);
+ return pref_file_path;
+}
+
+PrefService* Profile::GetPrefs() {
+ if (!prefs_.get())
+ prefs_.reset(new PrefService(GetPrefFilePath()));
+ return prefs_.get();
+}
+
+//--------------------------------------------------------------------------
+
+bool ShellIntegration::SetAsDefaultBrowser() {
+ return true;
+}
+
+bool ShellIntegration::IsDefaultBrowser() {
+ return true;
+}
+
+//--------------------------------------------------------------------------
+
+namespace browser {
+void RegisterAllPrefs(PrefService*, PrefService*) { }
+} // namespace browser
+
+namespace browser_shutdown {
+void ReadLastShutdownInfo() { }
+void Shutdown() { }
+}
+
+void OpenFirstRunDialog(Profile* profile) { }
+
+//--------------------------------------------------------------------------
+
+PluginService* PluginService::GetInstance() {
+ return Singleton<PluginService>::get();
+}
+
+PluginService::PluginService()
+ : main_message_loop_(MessageLoop::current()),
+ resource_dispatcher_host_(NULL),
+ ui_locale_(g_browser_process->GetApplicationLocale()),
+ plugin_shutdown_handler_(NULL) {
+}
+
+PluginService::~PluginService() {
+}
+
+void PluginService::SetChromePluginDataDir(const std::wstring& data_dir) {
+ AutoLock lock(lock_);
+ chrome_plugin_data_dir_ = data_dir;
+}
+
+//--------------------------------------------------------------------------
+
+void InstallJankometer(const CommandLine&) {
+}
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
new file mode 100644
index 0000000..f7f2bbb
--- /dev/null
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -0,0 +1,195 @@
+// Copyright (c) 2009 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.
+
+#ifndef CHROME_COMMON_TEMP_SCAFFOLDING_STUBS_H_
+#define CHROME_COMMON_TEMP_SCAFFOLDING_STUBS_H_
+
+// This file provides declarations and stub definitions for classes we encouter
+// during the porting effort. It is not meant to be perminent, and classes will
+// be removed from here as they are fleshed out more completely.
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "chrome/browser/browser_process.h"
+
+class CommandLine;
+class ProfileManager;
+class Profile;
+class MetricsService;
+
+class Upgrade {
+ public:
+ static bool IsBrowserAlreadyRunning() { return false; }
+ static bool RelaunchChromeBrowser(const CommandLine& command_line) {
+ return true;
+ }
+ static bool SwapNewChromeExeIfPresent() { return true; }
+};
+
+class BrowserInit {
+ public:
+ // TODO(port): MessageWindow is very windows specific and shouldn't be part of
+ // BrowserInit at all.
+ class MessageWindow {
+ public:
+ explicit MessageWindow(const std::wstring& user_data_dir) { }
+ ~MessageWindow() { }
+ bool NotifyOtherProcess() { return false; }
+ void HuntForZombieChromeProcesses() { }
+ void Create() { }
+ void Lock() { }
+ void Unlock() { }
+ };
+ static bool ProcessCommandLine(const CommandLine& parsed_command_line,
+ const std::wstring& cur_dir,
+ PrefService* prefs, bool process_startup,
+ Profile* profile, int* return_code);
+ static bool LaunchBrowser(const CommandLine& parsed_command_line,
+ Profile* profile, const std::wstring& cur_dir,
+ bool process_startup, int* return_code);
+ private:
+ static bool LaunchBrowserImpl(const CommandLine& parsed_command_line,
+ Profile* profile, const std::wstring& cur_dir,
+ bool process_startup, int* return_code);
+};
+
+class FirstRun {
+ public:
+ static bool IsChromeFirstRun() { return false; }
+ static bool ProcessMasterPreferences(const std::wstring& user_data_dir,
+ const std::wstring& master_prefs_path,
+ int* preference_details) {
+ return false;
+ }
+ static int ImportNow(Profile* profile, const CommandLine& cmdline) {
+ return 0;
+ }
+};
+
+class GoogleUpdateSettings {
+ public:
+ static bool GetCollectStatsConsent() { return false; }
+ static bool SetCollectStatsConsent(bool consented) { return false; }
+ static bool GetBrowser(std::wstring* browser) { return false; }
+ static bool GetLanguage(std::wstring* language) { return false; }
+ static bool GetBrand(std::wstring* brand) { return false; }
+ static bool GetReferral(std::wstring* referral) { return false; }
+ static bool ClearReferral() { return false; }
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(GoogleUpdateSettings);
+};
+
+class BrowserProcessImpl : public BrowserProcess {
+ public:
+ BrowserProcessImpl(CommandLine& command_line);
+ virtual ~BrowserProcessImpl();
+
+ virtual void EndSession() { }
+ virtual ResourceDispatcherHost* resource_dispatcher_host() { return NULL; }
+ virtual MetricsService* metrics_service();
+ virtual ProfileManager* profile_manager();
+ virtual PrefService* local_state();
+ virtual DebuggerWrapper* debugger_wrapper() { return NULL; }
+ virtual ClipboardService* clipboard_service() { return NULL; }
+ virtual base::Thread* io_thread() { return NULL; }
+ virtual base::Thread* file_thread() { return NULL; }
+ virtual base::Thread* db_thread() { return NULL; }
+ virtual sandbox::BrokerServices* broker_services() { return NULL; }
+ virtual IconManager* icon_manager() { return NULL; }
+ virtual void InitBrokerServices(sandbox::BrokerServices*) { }
+ virtual AutomationProviderList* InitAutomationProviderList() { return NULL; }
+ virtual void InitDebuggerWrapper(int port) { }
+ virtual unsigned int AddRefModule() { return NULL; }
+ virtual unsigned int ReleaseModule() { return NULL; }
+ virtual bool IsShuttingDown() { return NULL; }
+ virtual views::AcceleratorHandler* accelerator_handler() { return NULL; }
+ virtual printing::PrintJobManager* print_job_manager() { return NULL; }
+ virtual GoogleURLTracker* google_url_tracker() { return NULL; }
+ virtual const std::wstring& GetApplicationLocale() { return locale_; }
+ virtual MemoryModel memory_model() { return MEDIUM_MEMORY_MODEL; }
+ virtual base::WaitableEvent* shutdown_event() { return NULL; }
+ private:
+ void CreateLocalState();
+ void CreateProfileManager();
+ void CreateMetricsService();
+
+ bool created_local_state_;
+ scoped_ptr<PrefService> local_state_;
+ bool created_metrics_service_;
+ scoped_ptr<MetricsService> metrics_service_;
+ bool created_profile_manager_;
+ scoped_ptr<ProfileManager> profile_manager_;
+ std::wstring locale_;
+};
+
+class FirstRunBrowserProcess : public BrowserProcessImpl {
+ public:
+ FirstRunBrowserProcess(CommandLine& command_line)
+ : BrowserProcessImpl(command_line) {
+ }
+ virtual ~FirstRunBrowserProcess() { }
+ virtual GoogleURLTracker* google_url_tracker() { return NULL; }
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FirstRunBrowserProcess);
+};
+
+class UserDataManager {
+ public:
+ static void Create();
+ static UserDataManager* Get();
+
+ explicit UserDataManager(const std::wstring& user_data_root) { }
+ private:
+ // Shared instance.
+ static UserDataManager* instance_;
+};
+
+class Profile {
+ public:
+ Profile(const std::wstring& user_data_dir);
+ virtual std::wstring GetPath() { return path_; }
+ virtual PrefService* GetPrefs();
+ private:
+ std::wstring GetPrefFilePath();
+
+ std::wstring path_;
+ scoped_ptr<PrefService> prefs_;
+};
+
+class ProfileManager : NonThreadSafe {
+ public:
+ ProfileManager() { }
+ virtual ~ProfileManager() { }
+ Profile* GetDefaultProfile(const std::wstring& user_data_dir);
+ static std::wstring GetDefaultProfileDir(const std::wstring& user_data_dir);
+ static std::wstring GetDefaultProfilePath(const std::wstring& profile_dir);
+ private:
+ DISALLOW_EVIL_CONSTRUCTORS(ProfileManager);
+};
+
+class MetricsService {
+ public:
+ MetricsService() { }
+ ~MetricsService() { }
+ void Start() { }
+ void StartRecordingOnly() { }
+ void Stop() { }
+ void SetUserPermitsUpload(bool enabled) { }
+};
+
+namespace browser {
+void RegisterAllPrefs(PrefService*, PrefService*);
+}
+
+namespace browser_shutdown {
+void ReadLastShutdownInfo();
+void Shutdown();
+}
+
+void OpenFirstRunDialog(Profile* profile);
+
+void InstallJankometer(const CommandLine&);
+
+#endif // CHROME_COMMON_TEMP_SCAFFOLDING_STUBS_H_