• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_macros.h"
12 #include "include/base/cef_ref_counted.h"
13 #include "include/internal/cef_types_wrappers.h"
14 #include "tests/cefclient/browser/osr_renderer_settings.h"
15 
16 namespace client {
17 
18 class RootWindowManager;
19 
20 // Used to store global context in the browser process. The methods of this
21 // class are thread-safe unless otherwise indicated.
22 class MainContext {
23  public:
24   // Returns the singleton instance of this object.
25   static MainContext* Get();
26 
27   // Returns the full path to the console log file.
28   virtual std::string GetConsoleLogPath() = 0;
29 
30   // Returns the full path to |file_name|.
31   virtual std::string GetDownloadPath(const std::string& file_name) = 0;
32 
33   // Returns the app working directory including trailing path separator.
34   virtual std::string GetAppWorkingDirectory() = 0;
35 
36   // Returns the main application URL.
37   virtual std::string GetMainURL() = 0;
38 
39   // Returns the background color.
40   virtual cef_color_t GetBackgroundColor() = 0;
41 
42   // Returns true if the Chrome runtime will be used.
43   virtual bool UseChromeRuntime() = 0;
44 
45   // Returns true if the Views framework will be used.
46   virtual bool UseViews() = 0;
47 
48   // Returns true if windowless (off-screen) rendering will be used.
49   virtual bool UseWindowlessRendering() = 0;
50 
51   // Returns true if touch events are enabled.
52   virtual bool TouchEventsEnabled() = 0;
53 
54   // Populate |settings| based on command-line arguments.
55   virtual void PopulateSettings(CefSettings* settings) = 0;
56   virtual void PopulateBrowserSettings(CefBrowserSettings* settings) = 0;
57   virtual void PopulateOsrSettings(OsrRendererSettings* settings) = 0;
58 
59   // Returns the object used to create/manage RootWindow instances.
60   virtual RootWindowManager* GetRootWindowManager() = 0;
61 
62  protected:
63   MainContext();
64   virtual ~MainContext();
65 
66  private:
67   DISALLOW_COPY_AND_ASSIGN(MainContext);
68 };
69 
70 }  // namespace client
71 
72 #endif  // CEF_TESTS_CEFCLIENT_BROWSER_MAIN_CONTEXT_H_
73