1 // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 // reserved. Use of this source code is governed by a BSD-style license that 3 // can be found in the LICENSE file. 4 5 #ifndef CEF_TESTS_CEFCLIENT_BROWSER_MAIN_CONTEXT_H_ 6 #define CEF_TESTS_CEFCLIENT_BROWSER_MAIN_CONTEXT_H_ 7 #pragma once 8 9 #include <string> 10 11 #include "include/base/cef_ref_counted.h" 12 #include "include/internal/cef_types_wrappers.h" 13 #include "tests/cefclient/browser/osr_renderer_settings.h" 14 15 namespace client { 16 17 class RootWindowManager; 18 19 // Used to store global context in the browser process. The methods of this 20 // class are thread-safe unless otherwise indicated. 21 class MainContext { 22 public: 23 // Returns the singleton instance of this object. 24 static MainContext* Get(); 25 26 // Returns the full path to the console log file. 27 virtual std::string GetConsoleLogPath() = 0; 28 29 // Returns the full path to |file_name|. 30 virtual std::string GetDownloadPath(const std::string& file_name) = 0; 31 32 // Returns the app working directory including trailing path separator. 33 virtual std::string GetAppWorkingDirectory() = 0; 34 35 // Returns the main application URL. 36 virtual std::string GetMainURL() = 0; 37 38 // Returns the background color. 39 virtual cef_color_t GetBackgroundColor() = 0; 40 41 // Returns true if the Chrome runtime will be used. 42 virtual bool UseChromeRuntime() = 0; 43 44 // Returns true if the Views framework will be used. 45 virtual bool UseViews() = 0; 46 47 // Returns true if windowless (off-screen) rendering will be used. 48 virtual bool UseWindowlessRendering() = 0; 49 50 // Returns true if touch events are enabled. 51 virtual bool TouchEventsEnabled() = 0; 52 53 // Populate |settings| based on command-line arguments. 54 virtual void PopulateSettings(CefSettings* settings) = 0; 55 virtual void PopulateBrowserSettings(CefBrowserSettings* settings) = 0; 56 virtual void PopulateOsrSettings(OsrRendererSettings* settings) = 0; 57 58 // Returns the object used to create/manage RootWindow instances. 59 virtual RootWindowManager* GetRootWindowManager() = 0; 60 61 protected: 62 MainContext(); 63 virtual ~MainContext(); 64 65 private: 66 DISALLOW_COPY_AND_ASSIGN(MainContext); 67 }; 68 69 } // namespace client 70 71 #endif // CEF_TESTS_CEFCLIENT_BROWSER_MAIN_CONTEXT_H_ 72