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 "mandoline/ui/browser/browser.h" |
8 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
9 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
10 | 11 |
11 namespace mandoline { | 12 namespace mandoline { |
12 | 13 |
13 AndroidUI::AndroidUI(Browser* browser, mojo::Shell* shell) | 14 class Browser; |
| 15 |
| 16 AndroidUI::AndroidUI(Browser* browser, mojo::ApplicationImpl* application_impl) |
14 : browser_(browser), | 17 : browser_(browser), |
15 shell_(shell), | 18 application_impl_(application_impl), |
16 root_(nullptr), | 19 root_(nullptr), |
17 content_(nullptr) {} | 20 content_(nullptr) {} |
18 | 21 |
19 AndroidUI::~AndroidUI() { | 22 AndroidUI::~AndroidUI() { |
20 root_->RemoveObserver(this); | 23 root_->RemoveObserver(this); |
21 } | 24 } |
22 | 25 |
23 void AndroidUI::Init(mojo::View* root, mojo::View* content) { | 26 void AndroidUI::Init(mojo::View* root) { |
24 root_ = root; | 27 root_ = root; |
25 root_->AddObserver(this); | 28 root_->AddObserver(this); |
26 content_ = content; | |
27 | 29 |
28 content_->SetBounds(root_->bounds()); | 30 browser_->content()->SetBounds(root_->bounds()); |
| 31 } |
| 32 |
| 33 void AndroidUI::OnURLChanged() { |
29 } | 34 } |
30 | 35 |
31 void AndroidUI::OnViewBoundsChanged(mojo::View* view, | 36 void AndroidUI::OnViewBoundsChanged(mojo::View* view, |
32 const mojo::Rect& old_bounds, | 37 const mojo::Rect& old_bounds, |
33 const mojo::Rect& new_bounds) { | 38 const mojo::Rect& new_bounds) { |
34 content_->SetBounds( | 39 content_->SetBounds( |
35 *mojo::Rect::From(gfx::Rect(0, 0, new_bounds.width, new_bounds.height))); | 40 *mojo::Rect::From(gfx::Rect(0, 0, new_bounds.width, new_bounds.height))); |
36 } | 41 } |
37 | 42 |
38 // static | 43 // static |
39 BrowserUI* BrowserUI::Create(Browser* browser, mojo::Shell* shell) { | 44 BrowserUI* BrowserUI::Create(Browser* browser, |
40 return new AndroidUI(browser, shell); | 45 mojo::ApplicationImpl* application_impl) { |
| 46 return new AndroidUI(browser, application_impl); |
41 } | 47 } |
42 | 48 |
43 } // namespace mandoline | 49 } // namespace mandoline |
OLD | NEW |