| 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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 8 #include "services/navigation/public/cpp/view_delegate.h" | 9 #include "services/navigation/public/cpp/view_delegate.h" |
| 9 #include "services/navigation/public/cpp/view_observer.h" | 10 #include "services/navigation/public/cpp/view_observer.h" |
| 10 #include "services/ui/public/cpp/window.h" | 11 #include "ui/aura/mus/window_port_mus.h" |
| 12 #include "ui/aura/window.h" |
| 11 | 13 |
| 12 namespace navigation { | 14 namespace navigation { |
| 15 namespace { |
| 16 |
| 17 // Callback with result of Embed(). |
| 18 void EmbedCallback(bool result) {} |
| 19 |
| 20 } // namespace |
| 13 | 21 |
| 14 //////////////////////////////////////////////////////////////////////////////// | 22 //////////////////////////////////////////////////////////////////////////////// |
| 15 // View, public: | 23 // View, public: |
| 16 | 24 |
| 17 View::View(mojom::ViewFactoryPtr factory) : binding_(this) { | 25 View::View(mojom::ViewFactoryPtr factory) : binding_(this) { |
| 18 mojom::ViewClientPtr client; | 26 mojom::ViewClientPtr client; |
| 19 binding_.Bind(GetProxy(&client)); | 27 binding_.Bind(GetProxy(&client)); |
| 20 factory->CreateView(std::move(client), GetProxy(&view_)); | 28 factory->CreateView(std::move(client), GetProxy(&view_)); |
| 21 } | 29 } |
| 22 | 30 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 86 } |
| 79 | 87 |
| 80 void View::ShowInterstitial(const std::string& html) { | 88 void View::ShowInterstitial(const std::string& html) { |
| 81 view_->ShowInterstitial(html); | 89 view_->ShowInterstitial(html); |
| 82 } | 90 } |
| 83 | 91 |
| 84 void View::HideInterstitial() { | 92 void View::HideInterstitial() { |
| 85 view_->HideInterstitial(); | 93 view_->HideInterstitial(); |
| 86 } | 94 } |
| 87 | 95 |
| 88 void View::EmbedInWindow(ui::Window* parent) { | 96 void View::EmbedInWindow(aura::Window* parent) { |
| 89 ui::mojom::WindowTreeClientPtr client; | 97 ui::mojom::WindowTreeClientPtr client; |
| 90 view_->GetWindowTreeClient(GetProxy(&client)); | 98 view_->GetWindowTreeClient(GetProxy(&client)); |
| 91 parent->Embed(std::move(client)); | 99 const uint32_t embed_flags = 0u; // Nothing special. |
| 100 aura::WindowPortMus::Get(parent)->Embed(std::move(client), embed_flags, |
| 101 base::Bind(&EmbedCallback)); |
| 92 } | 102 } |
| 93 | 103 |
| 94 //////////////////////////////////////////////////////////////////////////////// | 104 //////////////////////////////////////////////////////////////////////////////// |
| 95 // View, mojom::ViewClient implementation: | 105 // View, mojom::ViewClient implementation: |
| 96 | 106 |
| 97 void View::OpenURL(mojom::OpenURLParamsPtr params) { | 107 void View::OpenURL(mojom::OpenURLParamsPtr params) { |
| 98 if (delegate_) | 108 if (delegate_) |
| 99 delegate_->OpenURL(this, std::move(params)); | 109 delegate_->OpenURL(this, std::move(params)); |
| 100 } | 110 } |
| 101 | 111 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (from_front) { | 183 if (from_front) { |
| 174 auto it = navigation_list_.begin() + count; | 184 auto it = navigation_list_.begin() + count; |
| 175 navigation_list_.erase(navigation_list_.begin(), it); | 185 navigation_list_.erase(navigation_list_.begin(), it); |
| 176 } else { | 186 } else { |
| 177 auto it = navigation_list_.end() - count; | 187 auto it = navigation_list_.end() - count; |
| 178 navigation_list_.erase(it, navigation_list_.end()); | 188 navigation_list_.erase(it, navigation_list_.end()); |
| 179 } | 189 } |
| 180 } | 190 } |
| 181 | 191 |
| 182 } // namespace navigation | 192 } // namespace navigation |
| OLD | NEW |