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

Unified Diff: mandoline/ui/browser/android/android_ui.cc

Issue 1141453002: Makes browser resize content when root bounds change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move to androidui Created 5 years, 7 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 | « mandoline/ui/browser/android/android_ui.h ('k') | mandoline/ui/browser/browser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mandoline/ui/browser/android/android_ui.cc
diff --git a/mandoline/ui/browser/android/android_ui.cc b/mandoline/ui/browser/android/android_ui.cc
index d9973669167adf094defeeb31b8fd7ff95f36b35..7cdbc72201e099e59427f6d3956a8b45528a0ff1 100644
--- a/mandoline/ui/browser/android/android_ui.cc
+++ b/mandoline/ui/browser/android/android_ui.cc
@@ -5,6 +5,8 @@
#include "mandoline/ui/browser/android/android_ui.h"
#include "components/view_manager/public/cpp/view.h"
+#include "mojo/converters/geometry/geometry_type_converters.h"
+#include "ui/gfx/geometry/rect.h"
namespace mandoline {
@@ -13,15 +15,26 @@ AndroidUI::AndroidUI(Browser* browser, mojo::Shell* shell)
shell_(shell),
root_(nullptr),
content_(nullptr) {}
-AndroidUI::~AndroidUI() {}
+
+AndroidUI::~AndroidUI() {
+ root_->RemoveObserver(this);
+}
void AndroidUI::Init(mojo::View* root, mojo::View* content) {
root_ = root;
+ root_->AddObserver(this);
content_ = content;
content_->SetBounds(root_->bounds());
}
+void AndroidUI::OnViewBoundsChanged(mojo::View* view,
+ const mojo::Rect& old_bounds,
+ const mojo::Rect& new_bounds) {
+ content_->SetBounds(
+ *mojo::Rect::From(gfx::Rect(0, 0, new_bounds.width, new_bounds.height)));
+}
+
// static
BrowserUI* BrowserUI::Create(Browser* browser, mojo::Shell* shell) {
return new AndroidUI(browser, shell);
« no previous file with comments | « mandoline/ui/browser/android/android_ui.h ('k') | mandoline/ui/browser/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698