Index: services/navigation/public/cpp/view.h |
diff --git a/services/navigation/public/cpp/view.h b/services/navigation/public/cpp/view.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a27aac5c8d4dcb4a80ef94110abece5c19101afd |
--- /dev/null |
+++ b/services/navigation/public/cpp/view.h |
@@ -0,0 +1,68 @@ |
+// 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. |
+ |
+#ifndef SERVICES_NAVIGATION_PUBLIC_CPP_VIEW_H_ |
+#define SERVICES_NAVIGATION_PUBLIC_CPP_VIEW_H_ |
+ |
+#include <string> |
+ |
+#include "mojo/public/cpp/bindings/binding.h" |
+#include "services/navigation/public/interfaces/view.mojom.h" |
+#include "ui/gfx/geometry/rect.h" |
+#include "url/gurl.h" |
+ |
+namespace navigation { |
+ |
+class ViewDelegate; |
+ |
+class View : public mojom::ViewClient { |
+ public: |
+ explicit View(ViewDelegate* delegate); |
+ View(const View&) = delete; |
+ ~View(); |
+ void operator=(const View&) = delete; |
+ |
+ void Init(mojom::ViewFactoryPtr view_factory); |
+ |
+ void NavigateTo(const GURL& url); |
+ void GoBack(); |
+ void GoForward(); |
+ void Reload(bool skip_cache); |
+ void Stop(); |
+ void ShowInterstitial(const std::string& html); |
+ void HideInterstitial(); |
+ void SetResizerSize(const gfx::Size& size); |
+ |
+ private: |
+ // mojom::ViewClient: |
+ void LoadingStateChanged(bool is_loading) override; |
+ void NavigationStateChanged(const GURL& url, |
+ const mojo::String& title, |
+ bool can_go_back, |
+ bool can_go_forward) override; |
+ void LoadProgressChanged(double progress) override; |
+ void UpdateHoverURL(const GURL& url) override; |
+ void ViewCreated(mojom::ViewPtr view, |
+ mojom::ViewClientRequest client, |
+ bool is_popup, |
+ const gfx::Rect& initial_rect, |
+ bool user_gesture) override; |
+ void Close(); |
+ |
+ bool is_loading_ = false; |
+ bool can_go_back_ = false; |
+ bool can_go_forward_ = false; |
+ double load_progress_ = 0.f; |
+ std::string title_; |
+ GURL hover_url_; |
+ |
+ ViewDelegate* delegate_; |
+ |
+ mojom::ViewPtr view_; |
+ mojo::Binding<mojom::ViewClient> binding_; |
+}; |
+ |
+} // namespace navigation |
+ |
+#endif // SERVICES_NAVIGATION_PUBLIC_CPP_VIEW_H_ |