Updates the mic icon status based on the device's audio state (2nd)
[chromium-blink-merge.git] / chrome / browser / chromeos / display / overscan_calibrator.h
blob7def2d0306656ebab2148111bc0dd8c64a79954d
1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_CHROMEOS_DISPLAY_OVERSCAN_CALIBRATOR_H_
6 #define CHROME_BROWSER_CHROMEOS_DISPLAY_OVERSCAN_CALIBRATOR_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ui/compositor/layer_delegate.h"
11 #include "ui/gfx/display.h"
12 #include "ui/gfx/insets.h"
13 #include "ui/gfx/rect.h"
15 namespace ui {
16 class Layer;
19 namespace chromeos {
21 // This is used to show the visible feedback to the user's operations for
22 // calibrating display overscan settings.
23 class OverscanCalibrator : public ui::LayerDelegate {
24 public:
25 OverscanCalibrator(const gfx::Display& target_display,
26 const gfx::Insets& initial_insets);
27 virtual ~OverscanCalibrator();
29 // Commits the current insets data to the system.
30 void Commit();
32 // Reset the overscan insets to default value. If the display has
33 // overscan, the default value is the display's default overscan
34 // value. Otherwise, the default value is the old |initial_insets_|.
35 void Reset();
37 // Updates the insets and redraw the visual feedback.
38 void UpdateInsets(const gfx::Insets& insets);
40 const gfx::Insets& insets() const { return insets_; }
42 private:
43 // ui::LayerDelegate overrides:
44 virtual void OnPaintLayer(gfx::Canvas* canvas) override;
45 virtual void OnDelegatedFrameDamage(
46 const gfx::Rect& damage_rect_in_dip) override;
47 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override;
48 virtual base::Closure PrepareForLayerBoundsChange() override;
50 // The target display.
51 const gfx::Display display_;
53 // The current insets.
54 gfx::Insets insets_;
56 // The insets initially given. Stored so we can undo the insets later.
57 gfx::Insets initial_insets_;
59 // Whether the current insets are committed to the system or not.
60 bool committed_;
62 // The visualization layer for the current calibration region.
63 scoped_ptr<ui::Layer> calibration_layer_;
65 DISALLOW_COPY_AND_ASSIGN(OverscanCalibrator);
68 } // namespace chromeos
70 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_OVERSCAN_CALIBRATOR_H_