Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Unified Diff: services/navigation/public/cpp/view.h

Issue 2046723002: Add navigation client lib for convenience (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@target
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/navigation/public/cpp/BUILD.gn ('k') | services/navigation/public/cpp/view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « services/navigation/public/cpp/BUILD.gn ('k') | services/navigation/public/cpp/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698