Chromium Code Reviews| 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 "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "blimp/client/core/contents/navigation_feature.h" | |
| 10 #include "blimp/client/public/contents/blimp_navigation_controller.h" | 11 #include "blimp/client/public/contents/blimp_navigation_controller.h" |
| 11 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 12 | 13 |
| 14 class SkBitmap; | |
| 15 | |
| 13 namespace blimp { | 16 namespace blimp { |
| 14 namespace client { | 17 namespace client { |
| 15 | 18 |
| 16 class BlimpContentsObserver; | 19 class BlimpContentsObserver; |
| 17 class BlimpNavigationControllerDelegate; | 20 class BlimpNavigationControllerDelegate; |
| 18 | 21 |
| 19 // BlimpContentsImpl is the implementation of the core class in | 22 class BlimpNavigationControllerImpl |
| 20 // //blimp/client/core, the BlimpContents. | 23 : public BlimpNavigationController, |
| 21 // The BlimpNavigationControllerImpl is the implementation part of | 24 public NavigationFeature::NavigationFeatureDelegate { |
| 22 // BlimpNavigationController. It maintains the back-forward list for a | |
| 23 // BlimpContentsImpl and manages all navigation within that list. | |
| 24 class BlimpNavigationControllerImpl : public BlimpNavigationController { | |
| 25 public: | 25 public: |
| 26 explicit BlimpNavigationControllerImpl( | 26 explicit BlimpNavigationControllerImpl( |
| 27 BlimpNavigationControllerDelegate* delegate); | 27 BlimpNavigationControllerDelegate* delegate, |
| 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; |
| 33 void Reload() override; | |
| 34 bool CanGoBack() const override; | |
| 35 bool CanGoForward() const override; | |
| 36 void GoBack() override; | |
| 37 void GoForward() override; | |
| 38 | |
|
Kevin M
2016/07/29 21:05:32
Remove newline to keep these overrides together as
| |
| 32 const GURL& GetURL() override; | 39 const GURL& GetURL() override; |
| 33 | 40 |
| 41 // For testing only. | |
| 42 void SetNavigationFeatureForTesting(NavigationFeature* feature); | |
| 43 | |
| 34 private: | 44 private: |
| 35 void NotifyDelegateURLLoaded(const GURL& url); | 45 // NavigationFeatureDelegate implementation. |
| 46 void OnUrlChanged(int tab_id, const GURL& url) override; | |
| 47 void OnFaviconChanged(int tab_id, const SkBitmap& favicon) override; | |
| 48 void OnTitleChanged(int tab_id, const std::string& title) override; | |
| 49 void OnLoadingChanged(int tab_id, bool loading) override; | |
| 50 void OnPageLoadStatusUpdate(int tab_id, bool completed) override; | |
| 51 | |
| 52 // The |navigation_feature_| is responsible for sending and receiving the | |
| 53 // navigation state to the server over the proto channel. The life time of | |
| 54 // |navigation_feature_| must remain valid throughout |this|. | |
|
Kevin M
2016/07/29 21:05:32
Lifetime requirement comments should be documented
| |
| 55 NavigationFeature* navigation_feature_; | |
| 36 | 56 |
| 37 // The delegate contains functionality required for the navigation controller | 57 // The delegate contains functionality required for the navigation controller |
| 38 // to function correctly. It is also invoked on relevant state changes of the | 58 // to function correctly. It is also invoked on relevant state changes of the |
| 39 // navigation controller. | 59 // navigation controller. |
| 40 BlimpNavigationControllerDelegate* delegate_; | 60 BlimpNavigationControllerDelegate* delegate_; |
| 41 | 61 |
| 42 // The currently active URL. | 62 // The currently active URL. |
| 43 GURL current_url_; | 63 GURL current_url_; |
| 44 | 64 |
| 45 // TODO(shaktisahu): Remove this after integration with NavigationFeature. | |
| 46 base::WeakPtrFactory<BlimpNavigationControllerImpl> weak_ptr_factory_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(BlimpNavigationControllerImpl); | 65 DISALLOW_COPY_AND_ASSIGN(BlimpNavigationControllerImpl); |
| 49 }; | 66 }; |
| 50 | 67 |
| 51 } // namespace client | 68 } // namespace client |
| 52 } // namespace blimp | 69 } // namespace blimp |
| 53 | 70 |
| 54 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_NAVIGATION_CONTROLLER_IMPL_H_ | 71 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_NAVIGATION_CONTROLLER_IMPL_H_ |
| OLD | NEW |