OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SERVICES_NAVIGATION_PUBLIC_CPP_VIEW_H_ |
| 6 #define SERVICES_NAVIGATION_PUBLIC_CPP_VIEW_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "mojo/public/cpp/bindings/binding.h" |
| 11 #include "services/navigation/public/interfaces/view.mojom.h" |
| 12 #include "ui/gfx/geometry/rect.h" |
| 13 #include "url/gurl.h" |
| 14 |
| 15 namespace navigation { |
| 16 |
| 17 class ViewDelegate; |
| 18 |
| 19 class View : public mojom::ViewClient { |
| 20 public: |
| 21 explicit View(ViewDelegate* delegate); |
| 22 View(const View&) = delete; |
| 23 ~View(); |
| 24 void operator=(const View&) = delete; |
| 25 |
| 26 void Init(mojom::ViewFactoryPtr view_factory); |
| 27 |
| 28 void NavigateTo(const GURL& url); |
| 29 void GoBack(); |
| 30 void GoForward(); |
| 31 void Reload(bool skip_cache); |
| 32 void Stop(); |
| 33 void ShowInterstitial(const std::string& html); |
| 34 void HideInterstitial(); |
| 35 void SetResizerSize(const gfx::Size& size); |
| 36 |
| 37 private: |
| 38 // mojom::ViewClient: |
| 39 void LoadingStateChanged(bool is_loading) override; |
| 40 void NavigationStateChanged(const GURL& url, |
| 41 const mojo::String& title, |
| 42 bool can_go_back, |
| 43 bool can_go_forward) override; |
| 44 void LoadProgressChanged(double progress) override; |
| 45 void UpdateHoverURL(const GURL& url) override; |
| 46 void ViewCreated(mojom::ViewPtr view, |
| 47 mojom::ViewClientRequest client, |
| 48 bool is_popup, |
| 49 const gfx::Rect& initial_rect, |
| 50 bool user_gesture) override; |
| 51 void Close(); |
| 52 |
| 53 bool is_loading_ = false; |
| 54 bool can_go_back_ = false; |
| 55 bool can_go_forward_ = false; |
| 56 double load_progress_ = 0.f; |
| 57 std::string title_; |
| 58 GURL hover_url_; |
| 59 |
| 60 ViewDelegate* delegate_; |
| 61 |
| 62 mojom::ViewPtr view_; |
| 63 mojo::Binding<mojom::ViewClient> binding_; |
| 64 }; |
| 65 |
| 66 } // namespace navigation |
| 67 |
| 68 #endif // SERVICES_NAVIGATION_PUBLIC_CPP_VIEW_H_ |
OLD | NEW |