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

Unified Diff: mojo/examples/png_viewer/png_viewer.cc

Issue 383123006: Preliminary interactive layout of window manager's demo_launcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resize KeyboardManager, sync 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: mojo/examples/png_viewer/png_viewer.cc
diff --git a/mojo/examples/png_viewer/png_viewer.cc b/mojo/examples/png_viewer/png_viewer.cc
index a6f87417bad4f50a075919dd017923d6c46363a3..6098f868530a81d888a487cfcc66fb4602acac78 100644
--- a/mojo/examples/png_viewer/png_viewer.cc
+++ b/mojo/examples/png_viewer/png_viewer.cc
@@ -10,6 +10,7 @@
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/services/public/cpp/view_manager/node.h"
+#include "mojo/services/public/cpp/view_manager/node_observer.h"
#include "mojo/services/public/cpp/view_manager/types.h"
#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_manager.h"
@@ -111,7 +112,8 @@ class NavigatorImpl : public InterfaceImpl<navigation::Navigator> {
};
class PNGViewer : public ApplicationDelegate,
- public view_manager::ViewManagerDelegate {
+ public view_manager::ViewManagerDelegate,
+ public view_manager::NodeObserver {
public:
PNGViewer() : content_view_(NULL), zoom_percentage_(kDefaultZoomPercentage) {}
virtual ~PNGViewer() {}
@@ -164,6 +166,7 @@ class PNGViewer : public ApplicationDelegate,
content_view_ = view_manager::View::Create(view_manager);
root->SetActiveView(content_view_);
content_view_->SetColor(SK_ColorGRAY);
+ root->AddObserver(this);
sky 2014/07/14 19:15:28 Same thing about removing observer.
hansmuller 2014/07/14 22:16:42 Done.
if (!bitmap_.isNull())
DrawBitmap();
}
@@ -189,6 +192,12 @@ class PNGViewer : public ApplicationDelegate,
content_view_->SetContents(skia::GetTopDevice(*canvas)->accessBitmap(true));
}
+ virtual void OnNodeBoundsChanged(view_manager::Node* node,
+ const gfx::Rect&,
+ const gfx::Rect&) OVERRIDE {
+ DrawBitmap();
+ }
+
view_manager::View* content_view_;
SkBitmap bitmap_;
uint16_t zoom_percentage_;

Powered by Google App Engine
This is Rietveld 408576698