| Index: services/navigation/public/cpp/view.cc
|
| diff --git a/services/navigation/public/cpp/view.cc b/services/navigation/public/cpp/view.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6cc8159fa877f95d663e12e3f291dc127b2c040d
|
| --- /dev/null
|
| +++ b/services/navigation/public/cpp/view.cc
|
| @@ -0,0 +1,103 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "services/navigation/public/cpp/view.h"
|
| +
|
| +#include "services/navigation/public/cpp/view_delegate.h"
|
| +
|
| +namespace navigation {
|
| +
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// View, public:
|
| +
|
| +View::View(ViewDelegate* delegate) : delegate_(delegate), binding_(this) {}
|
| +View::~View() {}
|
| +
|
| +void View::Init(mojom::ViewFactoryPtr factory) {
|
| + factory->CreateView(binding_.CreateInterfacePtrAndBind(), GetProxy(&view_));
|
| +}
|
| +
|
| +void View::NavigateTo(const GURL& url) {
|
| + view_->NavigateTo(url);
|
| +}
|
| +
|
| +void View::GoBack() {
|
| + if (can_go_back_)
|
| + view_->GoBack();
|
| +}
|
| +
|
| +void View::GoForward() {
|
| + if (can_go_forward_)
|
| + view_->GoForward();
|
| +}
|
| +
|
| +void View::Reload(bool skip_cache) {
|
| + view_->Reload(skip_cache);
|
| +}
|
| +
|
| +void View::Stop() {
|
| + view_->Stop();
|
| +}
|
| +
|
| +void View::ShowInterstitial(const std::string& html) {
|
| + view_->ShowInterstitial(html);
|
| +}
|
| +
|
| +void View::HideInterstitial() {
|
| + view_->HideInterstitial();
|
| +}
|
| +
|
| +void View::SetResizerSize(const gfx::Size& size) {
|
| + view_->SetResizerSize(size);
|
| +}
|
| +
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// View, mojom::ViewClient implementation:
|
| +
|
| +void View::LoadingStateChanged(bool is_loading) {
|
| + is_loading_ = is_loading;
|
| + if (delegate_)
|
| + delegate_->LoadingStateChanged(is_loading);
|
| +}
|
| +
|
| +void View::NavigationStateChanged(const GURL& url,
|
| + const mojo::String& title,
|
| + bool can_go_back,
|
| + bool can_go_forward) {
|
| + title_ = title;
|
| + can_go_back_ = can_go_back;
|
| + can_go_forward_ = can_go_forward;
|
| + if (delegate_)
|
| + delegate_->NavigationStateChanged(url, title, can_go_back, can_go_forward);
|
| +}
|
| +
|
| +void View::LoadProgressChanged(double progress) {
|
| + load_progress_ = progress;
|
| + if (delegate_)
|
| + delegate_->LoadProgressChanged(progress);
|
| +}
|
| +
|
| +void View::UpdateHoverURL(const GURL& url) {
|
| + hover_url_ = url;
|
| + if (delegate_)
|
| + delegate_->UpdateHoverURL(url);
|
| +}
|
| +
|
| +void View::ViewCreated(mojom::ViewPtr view,
|
| + mojom::ViewClientRequest client,
|
| + bool is_popup,
|
| + const gfx::Rect& initial_rect,
|
| + bool user_gesture) {
|
| + if (!delegate_)
|
| + return;
|
| + delegate_->ViewCreated(std::move(view), std::move(client), is_popup,
|
| + initial_rect, user_gesture);
|
| +}
|
| +
|
| +void View::Close() {
|
| + if (delegate_)
|
| + delegate_->Close();
|
| +}
|
| +
|
| +} // namespace navigation
|
|
|