| 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 #ifndef SERVICES_NAVIGATION_VIEW_IMPL_H_ | 5 #ifndef SERVICES_NAVIGATION_VIEW_IMPL_H_ |
| 6 #define SERVICES_NAVIGATION_VIEW_IMPL_H_ | 6 #define SERVICES_NAVIGATION_VIEW_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
| 13 #include "content/public/browser/web_contents_delegate.h" | 13 #include "content/public/browser/web_contents_delegate.h" |
| 14 #include "mojo/public/cpp/bindings/binding_set.h" | 14 #include "mojo/public/cpp/bindings/binding_set.h" |
| 15 #include "services/navigation/public/interfaces/view.mojom.h" | 15 #include "services/navigation/public/interfaces/view.mojom.h" |
| 16 #include "services/service_manager/public/cpp/connector.h" | 16 #include "services/service_manager/public/cpp/connector.h" |
| 17 #include "services/service_manager/public/cpp/interface_factory.h" | 17 #include "services/service_manager/public/cpp/interface_factory.h" |
| 18 #include "services/service_manager/public/cpp/service.h" | 18 #include "services/service_manager/public/cpp/service.h" |
| 19 #include "services/service_manager/public/cpp/service_context_ref.h" | 19 #include "services/service_manager/public/cpp/service_context_ref.h" |
| 20 #include "services/ui/public/cpp/window_tree_client_delegate.h" | 20 #include "ui/aura/mus/window_tree_client_delegate.h" |
| 21 #include "ui/gfx/geometry/size.h" | 21 #include "ui/gfx/geometry/size.h" |
| 22 #include "ui/views/widget/widget_delegate.h" | 22 #include "ui/views/widget/widget_delegate.h" |
| 23 | 23 |
| 24 namespace views { | 24 namespace views { |
| 25 class WebView; | 25 class WebView; |
| 26 class Widget; | 26 class Widget; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace navigation { | 29 namespace navigation { |
| 30 | 30 |
| 31 class ViewImpl : public mojom::View, | 31 class ViewImpl : public mojom::View, |
| 32 public content::WebContentsDelegate, | 32 public content::WebContentsDelegate, |
| 33 public content::NotificationObserver, | 33 public content::NotificationObserver, |
| 34 public ui::WindowTreeClientDelegate, | 34 public aura::WindowTreeClientDelegate, |
| 35 public views::WidgetDelegate { | 35 public views::WidgetDelegate { |
| 36 public: | 36 public: |
| 37 ViewImpl(std::unique_ptr<service_manager::Connector> connector, | 37 ViewImpl(std::unique_ptr<service_manager::Connector> connector, |
| 38 const std::string& client_user_id, | 38 const std::string& client_user_id, |
| 39 mojom::ViewClientPtr client, | 39 mojom::ViewClientPtr client, |
| 40 std::unique_ptr<service_manager::ServiceContextRef> ref); | 40 std::unique_ptr<service_manager::ServiceContextRef> ref); |
| 41 ~ViewImpl() override; | 41 ~ViewImpl() override; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 void DeleteTreeAndWidget(); |
| 45 |
| 44 // mojom::View: | 46 // mojom::View: |
| 45 void NavigateTo(const GURL& url) override; | 47 void NavigateTo(const GURL& url) override; |
| 46 void GoBack() override; | 48 void GoBack() override; |
| 47 void GoForward() override; | 49 void GoForward() override; |
| 48 void NavigateToOffset(int offset) override; | 50 void NavigateToOffset(int offset) override; |
| 49 void Reload(bool skip_cache) override; | 51 void Reload(bool skip_cache) override; |
| 50 void Stop() override; | 52 void Stop() override; |
| 51 void GetWindowTreeClient(ui::mojom::WindowTreeClientRequest request) override; | 53 void GetWindowTreeClient(ui::mojom::WindowTreeClientRequest request) override; |
| 52 void ShowInterstitial(const std::string& html) override; | 54 void ShowInterstitial(const std::string& html) override; |
| 53 void HideInterstitial() override; | 55 void HideInterstitial() override; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 69 content::InvalidateTypes changed_flags) override; | 71 content::InvalidateTypes changed_flags) override; |
| 70 void LoadProgressChanged(content::WebContents* source, | 72 void LoadProgressChanged(content::WebContents* source, |
| 71 double progress) override; | 73 double progress) override; |
| 72 void UpdateTargetURL(content::WebContents* source, const GURL& url) override; | 74 void UpdateTargetURL(content::WebContents* source, const GURL& url) override; |
| 73 | 75 |
| 74 // content::NotificationObserver: | 76 // content::NotificationObserver: |
| 75 void Observe(int type, | 77 void Observe(int type, |
| 76 const content::NotificationSource& source, | 78 const content::NotificationSource& source, |
| 77 const content::NotificationDetails& details) override; | 79 const content::NotificationDetails& details) override; |
| 78 | 80 |
| 79 // ui::WindowTreeClientDelegate: | 81 // aura::WindowTreeClientDelegate: |
| 80 void OnEmbed(ui::Window* root) override; | 82 void OnEmbed( |
| 81 void OnEmbedRootDestroyed(ui::Window* root) override; | 83 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) override; |
| 82 void OnLostConnection(ui::WindowTreeClient* client) override; | 84 void OnEmbedRootDestroyed(aura::WindowTreeHostMus* window_tree_host) override; |
| 85 void OnLostConnection(aura::WindowTreeClient* client) override; |
| 83 void OnPointerEventObserved(const ui::PointerEvent& event, | 86 void OnPointerEventObserved(const ui::PointerEvent& event, |
| 84 ui::Window* target) override; | 87 aura::Window* target) override; |
| 88 aura::client::CaptureClient* GetCaptureClient() override; |
| 89 aura::PropertyConverter* GetPropertyConverter() override; |
| 85 | 90 |
| 86 // views::WidgetDelegate: | 91 // views::WidgetDelegate: |
| 87 views::View* GetContentsView() override; | 92 views::View* GetContentsView() override; |
| 88 views::Widget* GetWidget() override; | 93 views::Widget* GetWidget() override; |
| 89 const views::Widget* GetWidget() const override; | 94 const views::Widget* GetWidget() const override; |
| 90 | 95 |
| 91 std::unique_ptr<service_manager::Connector> connector_; | 96 std::unique_ptr<service_manager::Connector> connector_; |
| 92 mojom::ViewClientPtr client_; | 97 mojom::ViewClientPtr client_; |
| 93 std::unique_ptr<service_manager::ServiceContextRef> ref_; | 98 std::unique_ptr<service_manager::ServiceContextRef> ref_; |
| 94 | 99 |
| 95 std::unique_ptr<ui::WindowTreeClient> window_tree_client_; | 100 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; |
| 96 | 101 |
| 97 views::WebView* web_view_; | 102 views::WebView* web_view_; |
| 98 | 103 |
| 99 std::unique_ptr<content::WebContents> web_contents_; | 104 std::unique_ptr<content::WebContents> web_contents_; |
| 100 | 105 |
| 101 content::NotificationRegistrar registrar_; | 106 content::NotificationRegistrar registrar_; |
| 102 | 107 |
| 108 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; |
| 103 std::unique_ptr<views::Widget> widget_; | 109 std::unique_ptr<views::Widget> widget_; |
| 104 | 110 |
| 105 DISALLOW_COPY_AND_ASSIGN(ViewImpl); | 111 DISALLOW_COPY_AND_ASSIGN(ViewImpl); |
| 106 }; | 112 }; |
| 107 | 113 |
| 108 } // navigation | 114 } // navigation |
| 109 | 115 |
| 110 #endif // SERVICES_NAVIGATION_VIEW_IMPL_H_ | 116 #endif // SERVICES_NAVIGATION_VIEW_IMPL_H_ |
| OLD | NEW |