diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-20 17:32:16 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-20 17:32:16 +0000 |
commit | ec58ac7e44a7ea70cdbc4b17f2c4c1de62b86ee7 (patch) | |
tree | de56e2cced3943851e9f5a06392499f677b07168 /chrome/app/metro_driver_win.h | |
parent | 6722815ca4295ba65dcd646af28ebba6fa1eb480 (diff) | |
download | chromium_src-ec58ac7e44a7ea70cdbc4b17f2c4c1de62b86ee7.zip chromium_src-ec58ac7e44a7ea70cdbc4b17f2c4c1de62b86ee7.tar.gz chromium_src-ec58ac7e44a7ea70cdbc4b17f2c4c1de62b86ee7.tar.bz2 |
Load the metro driver dll at startup
When the metro_driver is present, we need to relinquish the browser main
thread to it, execution of chrome will continue on another thread, which
will be used as chrome main thread.
TEST=none, other that chrome should work.
BUG=118641
Review URL: https://chromiumcodereview.appspot.com/9718001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127714 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/metro_driver_win.h')
-rw-r--r-- | chrome/app/metro_driver_win.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/chrome/app/metro_driver_win.h b/chrome/app/metro_driver_win.h new file mode 100644 index 0000000..b99a9af --- /dev/null +++ b/chrome/app/metro_driver_win.h @@ -0,0 +1,33 @@ +// Copyright (c) 2011 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_APP_METRO_DRIVER_WIN_H_ +#define CHROME_APP_METRO_DRIVER_WIN_H_ + +#include <Windows.h> + +// Helper class to manage the metro driver dll. When present in the system, +// the main process thread needs to call InitMetro(), normal execution of +// chrome initialization will continue on a second thread while the main +// thread will be servicing the metro message loop. +class MetroDriver { + public: + typedef int (*MainFn)(HINSTANCE instance); + + MetroDriver(); + // returns true if chrome is being launched in metro. If so we should + // call RunInMetro(). If not then we should just run chrome as usual. + bool in_metro_mode() const { return (NULL != init_metro_fn_); } + + // Enter the metro main function, which will only return when chrome metro + // is closed. Once metro has initialized, the dll creates a new thread + // which runs |main_fn|. This method returns when the chrome metro session + // is closed by the user. + int RunInMetro(HINSTANCE instance, MainFn main_fn); + + private: + void* init_metro_fn_; +}; + +#endif // CHROME_APP_METRO_DRIVER_WIN_H_ |