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

Unified Diff: mojo/examples/html_viewer/html_document_view.cc

Issue 383123006: Preliminary interactive layout of window manager's demo_launcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Looks Good 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
« no previous file with comments | « mojo/examples/html_viewer/html_document_view.h ('k') | mojo/examples/media_viewer/media_viewer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/examples/html_viewer/html_document_view.cc
diff --git a/mojo/examples/html_viewer/html_document_view.cc b/mojo/examples/html_viewer/html_document_view.cc
index 654161abd64e0fc51d93d9b056e341d985357cc0..becde3736f15fc30289343d3dede579bef9c1d21 100644
--- a/mojo/examples/html_viewer/html_document_view.cc
+++ b/mojo/examples/html_viewer/html_document_view.cc
@@ -80,6 +80,7 @@ HTMLDocumentView::HTMLDocumentView(ServiceProvider* service_provider,
: view_manager_(view_manager),
view_(view_manager::View::Create(view_manager_)),
web_view_(NULL),
+ root_(NULL),
repaint_pending_(false),
navigator_host_(service_provider),
weak_factory_(this) {
@@ -88,20 +89,23 @@ HTMLDocumentView::HTMLDocumentView(ServiceProvider* service_provider,
HTMLDocumentView::~HTMLDocumentView() {
view_->RemoveObserver(this);
-
if (web_view_)
web_view_->close();
+ if (root_)
+ root_->RemoveObserver(this);
}
void HTMLDocumentView::AttachToNode(view_manager::Node* node) {
- node->SetActiveView(view_);
+ root_ = node;
+ root_->SetActiveView(view_);
view_->SetColor(SK_ColorCYAN); // Dummy background color.
web_view_ = blink::WebView::create(this);
ConfigureSettings(web_view_->settings());
web_view_->setMainFrame(blink::WebLocalFrame::create(this));
+ web_view_->resize(root_->bounds().size());
- web_view_->resize(gfx::Size(node->bounds().size()));
+ root_->AddObserver(this);
}
void HTMLDocumentView::Load(URLResponsePtr response) {
@@ -184,6 +188,19 @@ void HTMLDocumentView::OnViewInputEvent(view_manager::View* view,
web_view_->handleInputEvent(*web_event);
}
+void HTMLDocumentView::OnNodeBoundsChanged(view_manager::Node* node,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) {
+ DCHECK_EQ(node, root_);
+ web_view_->resize(node->bounds().size());
+}
+
+void HTMLDocumentView::OnNodeDestroyed(view_manager::Node* node) {
+ DCHECK_EQ(node, root_);
+ node->RemoveObserver(this);
+ root_ = NULL;
+}
+
void HTMLDocumentView::Repaint() {
repaint_pending_ = false;
« no previous file with comments | « mojo/examples/html_viewer/html_document_view.h ('k') | mojo/examples/media_viewer/media_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698