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