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 BLIMP_CLIENT_CORE_CONTENTS_BLIMP_NAVIGATION_CONTROLLER_IMPL_H_ | 5 #ifndef BLIMP_CLIENT_CORE_CONTENTS_BLIMP_NAVIGATION_CONTROLLER_IMPL_H_ |
6 #define BLIMP_CLIENT_CORE_CONTENTS_BLIMP_NAVIGATION_CONTROLLER_IMPL_H_ | 6 #define BLIMP_CLIENT_CORE_CONTENTS_BLIMP_NAVIGATION_CONTROLLER_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "blimp/client/core/contents/navigation_feature.h" | 9 #include "blimp/client/core/contents/navigation_feature.h" |
10 #include "blimp/client/public/contents/blimp_navigation_controller.h" | 10 #include "blimp/client/public/contents/blimp_navigation_controller.h" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 | 12 |
13 class SkBitmap; | 13 class SkBitmap; |
14 | 14 |
15 namespace blimp { | 15 namespace blimp { |
16 namespace client { | 16 namespace client { |
17 | 17 |
18 class BlimpContentsObserver; | 18 class BlimpContentsObserver; |
19 class BlimpNavigationControllerDelegate; | 19 class BlimpNavigationControllerDelegate; |
20 | 20 |
21 class BlimpNavigationControllerImpl | 21 class BlimpNavigationControllerImpl |
22 : public BlimpNavigationController, | 22 : public BlimpNavigationController, |
23 public NavigationFeature::NavigationFeatureDelegate { | 23 public NavigationFeature::NavigationFeatureDelegate { |
24 public: | 24 public: |
25 // The life time of |feature| must remain valid throughout |this|. | 25 // The life time of |feature| must remain valid throughout |this|. |
26 BlimpNavigationControllerImpl(BlimpNavigationControllerDelegate* delegate, | 26 BlimpNavigationControllerImpl(int blimp_contents_id, |
| 27 BlimpNavigationControllerDelegate* delegate, |
27 NavigationFeature* feature); | 28 NavigationFeature* feature); |
28 ~BlimpNavigationControllerImpl() override; | 29 ~BlimpNavigationControllerImpl() override; |
29 | 30 |
30 // BlimpNavigationController implementation. | 31 // BlimpNavigationController implementation. |
31 void LoadURL(const GURL& url) override; | 32 void LoadURL(const GURL& url) override; |
32 void Reload() override; | 33 void Reload() override; |
33 bool CanGoBack() const override; | 34 bool CanGoBack() const override; |
34 bool CanGoForward() const override; | 35 bool CanGoForward() const override; |
35 void GoBack() override; | 36 void GoBack() override; |
36 void GoForward() override; | 37 void GoForward() override; |
37 const GURL& GetURL() override; | 38 const GURL& GetURL() override; |
38 const std::string& GetTitle(); | 39 const std::string& GetTitle(); |
39 | 40 |
40 private: | 41 private: |
41 // NavigationFeatureDelegate implementation. | 42 // NavigationFeatureDelegate implementation. |
42 void OnUrlChanged(int tab_id, const GURL& url) override; | 43 void OnUrlChanged(int tab_id, const GURL& url) override; |
43 void OnFaviconChanged(int tab_id, const SkBitmap& favicon) override; | 44 void OnFaviconChanged(int tab_id, const SkBitmap& favicon) override; |
44 void OnTitleChanged(int tab_id, const std::string& title) override; | 45 void OnTitleChanged(int tab_id, const std::string& title) override; |
45 void OnLoadingChanged(int tab_id, bool loading) override; | 46 void OnLoadingChanged(int tab_id, bool loading) override; |
46 void OnPageLoadStatusUpdate(int tab_id, bool completed) override; | 47 void OnPageLoadStatusUpdate(int tab_id, bool completed) override; |
47 | 48 |
| 49 // The ID for the BlimpContentsImpl this is a controller for. |
| 50 int blimp_contents_id_; |
| 51 |
48 // The |navigation_feature_| is responsible for sending and receiving the | 52 // The |navigation_feature_| is responsible for sending and receiving the |
49 // navigation state to the server over the proto channel. | 53 // navigation state to the server over the proto channel. |
50 NavigationFeature* navigation_feature_; | 54 NavigationFeature* navigation_feature_; |
51 | 55 |
52 // The delegate contains functionality required for the navigation controller | 56 // The delegate contains functionality required for the navigation controller |
53 // to function correctly. It is also invoked on relevant state changes of the | 57 // to function correctly. It is also invoked on relevant state changes of the |
54 // navigation controller. | 58 // navigation controller. |
55 BlimpNavigationControllerDelegate* delegate_; | 59 BlimpNavigationControllerDelegate* delegate_; |
56 | 60 |
57 // The currently active URL. | 61 // The currently active URL. |
58 GURL current_url_; | 62 GURL current_url_; |
59 | 63 |
60 // Title of the currently active page. | 64 // Title of the currently active page. |
61 std::string current_title_; | 65 std::string current_title_; |
62 | 66 |
63 DISALLOW_COPY_AND_ASSIGN(BlimpNavigationControllerImpl); | 67 DISALLOW_COPY_AND_ASSIGN(BlimpNavigationControllerImpl); |
64 }; | 68 }; |
65 | 69 |
66 } // namespace client | 70 } // namespace client |
67 } // namespace blimp | 71 } // namespace blimp |
68 | 72 |
69 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_NAVIGATION_CONTROLLER_IMPL_H_ | 73 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_NAVIGATION_CONTROLLER_IMPL_H_ |
OLD | NEW |