Home | History | Annotate | Download | only in app
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_APP_METRO_DRIVER_WIN_H_
      6 #define CHROME_APP_METRO_DRIVER_WIN_H_
      7 
      8 #include <Windows.h>
      9 
     10 // Helper class to manage the metro driver dll. When present in the system,
     11 // the main process thread needs to call InitMetro(), normal execution of
     12 // chrome initialization will continue on a second thread while the main
     13 // thread will be servicing the metro message loop.
     14 class MetroDriver {
     15  public:
     16   typedef int (*MainFn)(HINSTANCE instance);
     17 
     18   MetroDriver();
     19   // returns true if chrome is being launched in metro. If so we should
     20   // call RunInMetro(). If not then we should just run chrome as usual.
     21   bool in_metro_mode() const {  return (NULL != init_metro_fn_); }
     22 
     23   // Enter the metro main function, which will only return when chrome metro
     24   // is closed. Once metro has initialized, the dll creates a new thread
     25   // which runs |main_fn|. This method returns when the chrome metro session
     26   // is closed by the user.
     27   int RunInMetro(HINSTANCE instance, MainFn main_fn);
     28 
     29  private:
     30   void* init_metro_fn_;
     31 };
     32 
     33 #endif  // CHROME_APP_METRO_DRIVER_WIN_H_
     34