| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/navigation/public/cpp/view.h" | 5 #include "services/navigation/public/cpp/view.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "services/navigation/public/cpp/view_delegate.h" | 9 #include "services/navigation/public/cpp/view_delegate.h" |
| 10 #include "services/navigation/public/cpp/view_observer.h" | 10 #include "services/navigation/public/cpp/view_observer.h" |
| 11 #include "ui/aura/mus/window_port_mus.h" | 11 #include "ui/aura/mus/window_port_mus.h" |
| 12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 13 | 13 |
| 14 namespace navigation { | 14 namespace navigation { |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // Callback with result of Embed(). | 17 // Callback with result of Embed(). |
| 18 void EmbedCallback(bool result) {} | 18 void EmbedCallback(bool result) {} |
| 19 | 19 |
| 20 } // namespace | 20 } // namespace |
| 21 | 21 |
| 22 //////////////////////////////////////////////////////////////////////////////// | 22 //////////////////////////////////////////////////////////////////////////////// |
| 23 // View, public: | 23 // View, public: |
| 24 | 24 |
| 25 View::View(mojom::ViewFactoryPtr factory) : binding_(this) { | 25 View::View(mojom::ViewFactoryPtr factory) : binding_(this) { |
| 26 mojom::ViewClientPtr client; | 26 mojom::ViewClientPtr client; |
| 27 binding_.Bind(GetProxy(&client)); | 27 binding_.Bind(MakeRequest(&client)); |
| 28 factory->CreateView(std::move(client), GetProxy(&view_)); | 28 factory->CreateView(std::move(client), MakeRequest(&view_)); |
| 29 } | 29 } |
| 30 | 30 |
| 31 View::View(mojom::ViewPtr view, mojom::ViewClientRequest request) | 31 View::View(mojom::ViewPtr view, mojom::ViewClientRequest request) |
| 32 : view_(std::move(view)), binding_(this, std::move(request)) {} | 32 : view_(std::move(view)), binding_(this, std::move(request)) {} |
| 33 | 33 |
| 34 View::~View() {} | 34 View::~View() {} |
| 35 | 35 |
| 36 void View::AddObserver(ViewObserver* observer) { | 36 void View::AddObserver(ViewObserver* observer) { |
| 37 observers_.AddObserver(observer); | 37 observers_.AddObserver(observer); |
| 38 } | 38 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 void View::ShowInterstitial(const std::string& html) { | 88 void View::ShowInterstitial(const std::string& html) { |
| 89 view_->ShowInterstitial(html); | 89 view_->ShowInterstitial(html); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void View::HideInterstitial() { | 92 void View::HideInterstitial() { |
| 93 view_->HideInterstitial(); | 93 view_->HideInterstitial(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void View::EmbedInWindow(aura::Window* parent) { | 96 void View::EmbedInWindow(aura::Window* parent) { |
| 97 ui::mojom::WindowTreeClientPtr client; | 97 ui::mojom::WindowTreeClientPtr client; |
| 98 view_->GetWindowTreeClient(GetProxy(&client)); | 98 view_->GetWindowTreeClient(MakeRequest(&client)); |
| 99 const uint32_t embed_flags = 0u; // Nothing special. | 99 const uint32_t embed_flags = 0u; // Nothing special. |
| 100 aura::WindowPortMus::Get(parent)->Embed(std::move(client), embed_flags, | 100 aura::WindowPortMus::Get(parent)->Embed(std::move(client), embed_flags, |
| 101 base::Bind(&EmbedCallback)); | 101 base::Bind(&EmbedCallback)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 //////////////////////////////////////////////////////////////////////////////// | 104 //////////////////////////////////////////////////////////////////////////////// |
| 105 // View, mojom::ViewClient implementation: | 105 // View, mojom::ViewClient implementation: |
| 106 | 106 |
| 107 void View::OpenURL(mojom::OpenURLParamsPtr params) { | 107 void View::OpenURL(mojom::OpenURLParamsPtr params) { |
| 108 if (delegate_) | 108 if (delegate_) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 if (from_front) { | 183 if (from_front) { |
| 184 auto it = navigation_list_.begin() + count; | 184 auto it = navigation_list_.begin() + count; |
| 185 navigation_list_.erase(navigation_list_.begin(), it); | 185 navigation_list_.erase(navigation_list_.begin(), it); |
| 186 } else { | 186 } else { |
| 187 auto it = navigation_list_.end() - count; | 187 auto it = navigation_list_.end() - count; |
| 188 navigation_list_.erase(it, navigation_list_.end()); | 188 navigation_list_.erase(it, navigation_list_.end()); |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace navigation | 192 } // namespace navigation |
| OLD | NEW |