Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Unified Diff: ui/ozone/platform/caca/caca_window.h

Issue 387953004: ozone: caca: Convert to PlatformWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/caca/caca_window.h
diff --git a/ui/ozone/platform/caca/caca_connection.h b/ui/ozone/platform/caca/caca_window.h
similarity index 51%
rename from ui/ozone/platform/caca/caca_connection.h
rename to ui/ozone/platform/caca/caca_window.h
index 052985e7266d25820ed9e1d681ec60a4e3de6c8f..493af8cbbe4b7c2bde6860b527d077eeadb8eb2d 100644
--- a/ui/ozone/platform/caca/caca_connection.h
+++ b/ui/ozone/platform/caca/caca_window.h
@@ -2,37 +2,65 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_OZONE_PLATFORM_CACA_CACA_CONNECTION_H_
-#define UI_OZONE_PLATFORM_CACA_CACA_CONNECTION_H_
+#ifndef UI_OZONE_PLATFORM_CACA_CACA_WINDOW_H_
+#define UI_OZONE_PLATFORM_CACA_CACA_WINDOW_H_
#include <caca.h>
+#include "base/debug/stack_trace.h"
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "ui/gfx/geometry/size.h"
+#include "ui/ozone/common/platform_window_base.h"
#include "ui/ozone/platform/caca/scoped_caca_types.h"
namespace ui {
+class CacaEventFactory;
+class CacaWindowManager;
+class PlatformWindowDelegate;
+
// Basic initialization of Libcaca. This needs to be shared between SFO and EFO
// since both need the |display_| to draw and process events respectively.
// Note, |canvas_| needs to be here since it is needed for creating a
// |display_|.
-class CacaConnection {
+class CacaWindow : public PlatformWindowBase {
public:
- CacaConnection();
- ~CacaConnection();
+ CacaWindow(PlatformWindowDelegate* delegate,
+ CacaWindowManager* manager,
+ CacaEventFactory* event_factory,
+ const gfx::Rect& bounds);
+ virtual ~CacaWindow();
bool Initialize();
+ virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
+
+ virtual gfx::Rect GetBounds() const OVERRIDE;
+
+ virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE {}
+
+ void OnCacaQuit();
+
+ void OnCacaResize();
+
// This is the Caca canvas size.
gfx::Size physical_size() const { return physical_size_; }
gfx::Size bitmap_size() const { return bitmap_size_; }
caca_display_t* display() const { return display_.get(); }
private:
+ // Event polling.
+ void TryProcessingEvent();
+
// Sync sizes with libcaca.
void UpdateDisplaySize();
+ PlatformWindowDelegate* delegate_;
+ CacaWindowManager* manager_;
+ CacaEventFactory* event_factory_;
+ gfx::AcceleratedWidget widget_;
+
ScopedCacaCanvas canvas_;
ScopedCacaDisplay display_;
@@ -43,9 +71,11 @@ class CacaConnection {
// Size of the backing buffer we draw into. Size in pixels.
gfx::Size bitmap_size_;
- DISALLOW_COPY_AND_ASSIGN(CacaConnection);
+ base::WeakPtrFactory<CacaWindow> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(CacaWindow);
};
} // namespace ui
-#endif // UI_OZONE_PLATFORM_CACA_CACA_CONNECTION_H_
+#endif // UI_OZONE_PLATFORM_CACA_CACA_WINDOW_H_

Powered by Google App Engine
This is Rietveld 408576698