Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: blimp/client/core/contents/blimp_navigation_controller_impl.h

Issue 2058263002: Tied up BlimpNavigationController to NavigationFeature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blimp_core
Patch Set: Moved NavigationFeature to blimp/client/core/contents Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // BlimpContentsImpl is the implementation of the core class in
Kevin M 2016/07/27 23:35:17 BlimpContentsImpl isn't defined here; is this comm
shaktisahu 2016/07/28 19:32:51 Removed the comment since it doesn't convey more t
20 // //blimp/client/core, the BlimpContents. 23 // //blimp/client/core, the BlimpContents.
21 // The BlimpNavigationControllerImpl is the implementation part of 24 // The BlimpNavigationControllerImpl is the implementation part of
22 // BlimpNavigationController. It maintains the back-forward list for a 25 // BlimpNavigationController. It maintains the back-forward list for a
23 // BlimpContentsImpl and manages all navigation within that list. 26 // BlimpContentsImpl and manages all navigation within that list.
24 class BlimpNavigationControllerImpl : public BlimpNavigationController { 27 class BlimpNavigationControllerImpl
28 : public BlimpNavigationController,
29 public NavigationFeature::NavigationFeatureDelegate {
25 public: 30 public:
31 // TODO(shaktisahu): Provide NavigationFeature* in the constructor.
Kevin M 2016/07/27 23:35:17 Obsolete comment?
shaktisahu 2016/07/28 19:32:51 Done.
26 explicit BlimpNavigationControllerImpl( 32 explicit BlimpNavigationControllerImpl(
Kevin M 2016/07/29 21:05:32 "explicit" not used for >1 param ctor
shaktisahu 2016/07/29 22:57:30 Done.
27 BlimpNavigationControllerDelegate* delegate); 33 BlimpNavigationControllerDelegate* delegate,
34 NavigationFeature* feature);
Kevin M 2016/07/27 23:35:17 Document the lifetime requirements of |feature| ?
shaktisahu 2016/07/28 19:32:51 Added comments in the variables section. Regarding
Kevin M 2016/07/29 21:05:32 I meant, is it possible that the NavigationControl
shaktisahu 2016/07/29 22:57:30 Possibly not. The |feature| lives in BlimpClientSe
28 ~BlimpNavigationControllerImpl() override; 35 ~BlimpNavigationControllerImpl() override;
29 36
30 // BlimpNavigationController implementation. 37 // BlimpNavigationController implementation.
Kevin M 2016/07/27 23:35:17 Overrides go below non-overrides.
shaktisahu 2016/07/28 19:32:51 Since the only other non-override method is a forT
Kevin M 2016/07/29 21:05:32 Even though it might be a less-important method, t
shaktisahu 2016/07/29 22:57:30 Done.
31 void LoadURL(const GURL& url) override; 38 void LoadURL(const GURL& url) override;
39 void Reload() override;
40 bool CanGoBack() const override;
41 bool CanGoForward() const override;
42 void GoBack() override;
43 void GoForward() override;
44
32 const GURL& GetURL() override; 45 const GURL& GetURL() override;
33 46
47 // For testing only.
Kevin M 2016/07/27 23:35:17 Is this method necessary given that the ctor takes
shaktisahu 2016/07/28 19:32:51 Yes. It is used in blimp_contents_impl_unittest.cc
Kevin M 2016/07/29 21:05:32 Right, but the constructor already takes |feature|
shaktisahu 2016/07/29 22:57:30 Because this object is created inside BlimpContent
Kevin M 2016/08/01 23:41:57 That's true right now, but BlimpContentsImpl can e
shaktisahu 2016/08/02 17:47:52 Sure, that's a good idea. In that case, we are pro
48 void SetNavigationFeatureForTesting(NavigationFeature* feature);
49
34 private: 50 private:
35 void NotifyDelegateURLLoaded(const GURL& url); 51 // NavigationFeatureDelegate implementation.
52 void OnUrlChanged(int tab_id, const GURL& url) override;
53 void OnFaviconChanged(int tab_id, const SkBitmap& favicon) override;
54 void OnTitleChanged(int tab_id, const std::string& title) override;
55 void OnLoadingChanged(int tab_id, bool loading) override;
56 void OnPageLoadStatusUpdate(int tab_id, bool completed) override;
57
58 // The |navigation_feature_| is responsible for sending and receiving the
59 // navigation state to the server over the proto channel.
60 NavigationFeature* navigation_feature_;
36 61
37 // The delegate contains functionality required for the navigation controller 62 // The delegate contains functionality required for the navigation controller
38 // to function correctly. It is also invoked on relevant state changes of the 63 // to function correctly. It is also invoked on relevant state changes of the
39 // navigation controller. 64 // navigation controller.
40 BlimpNavigationControllerDelegate* delegate_; 65 BlimpNavigationControllerDelegate* delegate_;
41 66
42 // The currently active URL. 67 // The currently active URL.
43 GURL current_url_; 68 GURL current_url_;
44 69
45 // TODO(shaktisahu): Remove this after integration with NavigationFeature.
46 base::WeakPtrFactory<BlimpNavigationControllerImpl> weak_ptr_factory_;
47
48 DISALLOW_COPY_AND_ASSIGN(BlimpNavigationControllerImpl); 70 DISALLOW_COPY_AND_ASSIGN(BlimpNavigationControllerImpl);
49 }; 71 };
50 72
51 } // namespace client 73 } // namespace client
52 } // namespace blimp 74 } // namespace blimp
53 75
54 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_NAVIGATION_CONTROLLER_IMPL_H_ 76 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_NAVIGATION_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698