summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_main.cc
diff options
context:
space:
mode:
authordenisromanov@chromium.org <denisromanov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-15 16:07:45 +0000
committerdenisromanov@chromium.org <denisromanov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-15 16:07:45 +0000
commit368ad4cad5cc624d86036ca4276c5da8486cbe6c (patch)
tree1f1945200082c5d20adbe9220bc8749afe432b0f /chrome/browser/browser_main.cc
parent031857d5c3e4019dca3ae999792d1fe6b0798bd1 (diff)
downloadchromium_src-368ad4cad5cc624d86036ca4276c5da8486cbe6c.zip
chromium_src-368ad4cad5cc624d86036ca4276c5da8486cbe6c.tar.gz
chromium_src-368ad4cad5cc624d86036ca4276c5da8486cbe6c.tar.bz2
Added --services-manifest switch, to provide Chrome OS OEM services customization manifest on the command line.
The manifest is parsed and specified OEM welcome page is opened on startup. BUG=cros:3176 TEST=Run out/Debug/chrome --services-manifest=chrome/browser/chromeos/testdata/services_manifest.json. An URL specified in the manifest as the initial_start_page should be opened (presently http://localhost). Review URL: http://codereview.chromium.org/2691003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49798 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_main.cc')
-rw-r--r--chrome/browser/browser_main.cc43
1 files changed, 42 insertions, 1 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 09ca41c..361be11 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -159,6 +159,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/screen_lock_library.h"
+#include "chrome/browser/chromeos/customization_document.h"
#include "chrome/browser/chromeos/external_metrics.h"
#include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/chromeos/login/user_manager.h"
@@ -600,6 +601,7 @@ void InitializeToolkit() {
#endif
#if defined(OS_CHROMEOS)
+
void OptionallyRunChromeOSLoginManager(const CommandLine& parsed_command_line) {
if (parsed_command_line.HasSwitch(switches::kLoginManager)) {
std::string first_screen =
@@ -619,11 +621,44 @@ void OptionallyRunChromeOSLoginManager(const CommandLine& parsed_command_line) {
browser::ShowLoginWizard(first_screen, size);
}
}
+
+bool OptionallyApplyServicesCustomizationFromCommandLine(
+ const CommandLine& parsed_command_line,
+ BrowserInit* browser_init) {
+ // For Chrome OS, we may need to fetch OEM partner's services customization
+ // manifest and apply the customizations. This happens on the very first run
+ // or if startup manifest is passed on the command line.
+ scoped_ptr<chromeos::ServicesCustomizationDocument> customization;
+ customization.reset(new chromeos::ServicesCustomizationDocument());
+ bool manifest_loaded = false;
+ if (parsed_command_line.HasSwitch(switches::kServicesManifest)) {
+ // Load manifest from file specified by command line switch.
+ FilePath manifest_path =
+ parsed_command_line.GetSwitchValuePath(switches::kServicesManifest);
+ manifest_loaded = customization->LoadManifestFromFile(manifest_path);
+ DCHECK(manifest_loaded) << manifest_path.value();
+ }
+ // If manifest was loaded successfully, apply the customizations.
+ if (manifest_loaded) {
+ browser_init->ApplyServicesCustomization(customization.get());
+ }
+ return manifest_loaded;
+}
+
#else
+
void OptionallyRunChromeOSLoginManager(const CommandLine& parsed_command_line) {
// Dummy empty function for non-ChromeOS builds to avoid extra ifdefs below.
}
-#endif
+
+bool OptionallyApplyServicesCustomizationFromCommandLine(
+ const CommandLine& parsed_command_line,
+ BrowserInit* browser_init) {
+ // Dummy empty function for non-ChromeOS builds to avoid extra ifdefs below.
+ return false;
+}
+
+#endif // defined(OS_CHROMEOS)
#if defined(OS_MACOSX)
OSStatus KeychainCallback(SecKeychainEvent keychain_event,
@@ -1218,6 +1253,12 @@ int BrowserMain(const MainFunctionParams& parameters) {
RegisterExtensionProtocols();
RegisterMetadataURLRequestHandler();
+ // If path to partner services customization document was passed on command
+ // line, apply the customizations (Chrome OS only).
+ // TODO(denisromanov): Remove this when not needed for testing.
+ OptionallyApplyServicesCustomizationFromCommandLine(parsed_command_line,
+ &browser_init);
+
// In unittest mode, this will do nothing. In normal mode, this will create
// the global GoogleURLTracker and IntranetRedirectDetector instances, which
// will promptly go to sleep for five and seven seconds, respectively (to