| 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 #include "blimp/client/core/contents/blimp_navigation_controller_impl.h" | 5 #include "blimp/client/core/contents/blimp_navigation_controller_impl.h" |
| 6 | 6 |
| 7 #include "blimp/client/core/contents/blimp_navigation_controller_delegate.h" | 7 #include "blimp/client/core/contents/blimp_navigation_controller_delegate.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 // TODO(shaktisahu): NavigationFeature currently needs a tab_id. Remove this | 10 // TODO(shaktisahu): NavigationFeature currently needs a tab_id. Remove this |
| 11 // later when it is fully integrated with BlimpClientContext. | 11 // later when it is fully integrated with BlimpClientContext. |
| 12 const int kDummyTabId = 0; | 12 const int kDummyTabId = 0; |
| 13 } // namespace | 13 } // namespace |
| 14 | 14 |
| 15 namespace blimp { | 15 namespace blimp { |
| 16 namespace client { | 16 namespace client { |
| 17 | 17 |
| 18 BlimpNavigationControllerImpl::BlimpNavigationControllerImpl( | 18 BlimpNavigationControllerImpl::BlimpNavigationControllerImpl( |
| 19 BlimpNavigationControllerDelegate* delegate, | 19 BlimpNavigationControllerDelegate* delegate, |
| 20 NavigationFeature* feature) | 20 NavigationFeature* feature) |
| 21 : navigation_feature_(feature), delegate_(delegate) { | 21 : navigation_feature_(feature), delegate_(delegate) { |
| 22 if (navigation_feature_) | 22 if (navigation_feature_) |
| 23 navigation_feature_->SetDelegate(kDummyTabId, this); | 23 navigation_feature_->SetDelegate(kDummyTabId, this); |
| 24 } | 24 } |
| 25 | 25 |
| 26 BlimpNavigationControllerImpl::~BlimpNavigationControllerImpl() = default; | 26 BlimpNavigationControllerImpl::~BlimpNavigationControllerImpl() = default; |
| 27 | 27 |
| 28 void BlimpNavigationControllerImpl::SetNavigationFeatureForTesting( | |
| 29 NavigationFeature* feature) { | |
| 30 navigation_feature_ = feature; | |
| 31 navigation_feature_->SetDelegate(kDummyTabId, this); | |
| 32 } | |
| 33 | |
| 34 void BlimpNavigationControllerImpl::LoadURL(const GURL& url) { | 28 void BlimpNavigationControllerImpl::LoadURL(const GURL& url) { |
| 35 current_url_ = url; | 29 current_url_ = url; |
| 36 navigation_feature_->NavigateToUrlText(kDummyTabId, current_url_.spec()); | 30 navigation_feature_->NavigateToUrlText(kDummyTabId, current_url_.spec()); |
| 37 } | 31 } |
| 38 | 32 |
| 39 void BlimpNavigationControllerImpl::Reload() { | 33 void BlimpNavigationControllerImpl::Reload() { |
| 40 navigation_feature_->Reload(kDummyTabId); | 34 navigation_feature_->Reload(kDummyTabId); |
| 41 } | 35 } |
| 42 | 36 |
| 43 bool BlimpNavigationControllerImpl::CanGoBack() const { | 37 bool BlimpNavigationControllerImpl::CanGoBack() const { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 delegate_->OnNavigationStateChanged(); | 74 delegate_->OnNavigationStateChanged(); |
| 81 } | 75 } |
| 82 | 76 |
| 83 void BlimpNavigationControllerImpl::OnPageLoadStatusUpdate(int tab_id, | 77 void BlimpNavigationControllerImpl::OnPageLoadStatusUpdate(int tab_id, |
| 84 bool completed) { | 78 bool completed) { |
| 85 delegate_->OnNavigationStateChanged(); | 79 delegate_->OnNavigationStateChanged(); |
| 86 } | 80 } |
| 87 | 81 |
| 88 } // namespace client | 82 } // namespace client |
| 89 } // namespace blimp | 83 } // namespace blimp |
| OLD | NEW |