OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mandoline/ui/browser/android/android_ui.h" | 5 #include "mandoline/ui/browser/android/android_ui.h" |
6 | 6 |
7 #include "components/view_manager/public/cpp/view.h" | 7 #include "components/view_manager/public/cpp/view.h" |
8 #include "mojo/converters/geometry/geometry_type_converters.h" | 8 #include "mojo/converters/geometry/geometry_type_converters.h" |
9 #include "ui/gfx/geometry/rect.h" | 9 #include "ui/gfx/geometry/rect.h" |
10 | 10 |
11 namespace mandoline { | 11 namespace mandoline { |
12 | 12 |
13 AndroidUI::AndroidUI(Browser* browser, mojo::Shell* shell) | 13 class Browser; |
| 14 |
| 15 AndroidUI::AndroidUI(Browser* browser, mojo::ApplicationImpl* application_impl) |
14 : browser_(browser), | 16 : browser_(browser), |
15 shell_(shell), | 17 application_impl_(application_impl), |
16 root_(nullptr), | 18 root_(nullptr), |
17 content_(nullptr) {} | 19 content_(nullptr) {} |
18 | 20 |
19 AndroidUI::~AndroidUI() { | 21 AndroidUI::~AndroidUI() { |
20 root_->RemoveObserver(this); | 22 root_->RemoveObserver(this); |
21 } | 23 } |
22 | 24 |
23 void AndroidUI::Init(mojo::View* root, mojo::View* content) { | 25 void AndroidUI::Init(mojo::View* root) { |
24 root_ = root; | 26 root_ = root; |
25 root_->AddObserver(this); | 27 root_->AddObserver(this); |
26 content_ = content; | |
27 | 28 |
28 content_->SetBounds(root_->bounds()); | 29 browser_->content()->SetBounds(root_->bounds()); |
| 30 } |
| 31 |
| 32 void AndroidUI::OnURLChanged() override { |
29 } | 33 } |
30 | 34 |
31 void AndroidUI::OnViewBoundsChanged(mojo::View* view, | 35 void AndroidUI::OnViewBoundsChanged(mojo::View* view, |
32 const mojo::Rect& old_bounds, | 36 const mojo::Rect& old_bounds, |
33 const mojo::Rect& new_bounds) { | 37 const mojo::Rect& new_bounds) { |
34 content_->SetBounds( | 38 content_->SetBounds( |
35 *mojo::Rect::From(gfx::Rect(0, 0, new_bounds.width, new_bounds.height))); | 39 *mojo::Rect::From(gfx::Rect(0, 0, new_bounds.width, new_bounds.height))); |
36 } | 40 } |
37 | 41 |
38 // static | 42 // static |
39 BrowserUI* BrowserUI::Create(Browser* browser, mojo::Shell* shell) { | 43 BrowserUI* BrowserUI::Create(Browser* browser, |
40 return new AndroidUI(browser, shell); | 44 mojo::ApplicationImpl* application_impl) { |
| 45 return new AndroidUI(browser, application_impl); |
41 } | 46 } |
42 | 47 |
43 } // namespace mandoline | 48 } // namespace mandoline |
OLD | NEW |