Upstream version 10.38.222.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / api / system_display / display_info_provider.h
1 // Copyright 2013 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_BROWSER_EXTENSIONS_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "chrome/common/extensions/api/system_display.h"
12
13 namespace gfx {
14 class Display;
15 }
16
17 namespace extensions {
18
19 typedef std::vector<linked_ptr<
20     api::system_display::DisplayUnitInfo> > DisplayInfo;
21
22 class DisplayInfoProvider {
23  public :
24   static DisplayInfoProvider* Get();
25
26   DisplayInfoProvider();
27   virtual ~DisplayInfoProvider();
28
29   // This is for tests that run in its own process (e.g. browser_tests).
30   // Using this in other tests (e.g. unit_tests) will result in DCHECK failure.
31   static void InitializeForTesting(DisplayInfoProvider* display_info_provider);
32
33   DisplayInfo GetAllDisplaysInfo();
34
35   virtual bool SetInfo(const std::string& display_id,
36                        const api::system_display::DisplayProperties& info,
37                        std::string* error);
38
39  private:
40   // Update the content of the |unit| obtained for |display| using
41   // platform specific method.
42   virtual void UpdateDisplayUnitInfoForPlatform(
43       const gfx::Display& display,
44       extensions::api::system_display::DisplayUnitInfo* unit);
45
46   DISALLOW_COPY_AND_ASSIGN(DisplayInfoProvider);
47 };
48
49 }  // namespace extensions
50
51 #endif  // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_