| 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() { |
| 27 if (navigation_feature_) |
| 28 navigation_feature_->RemoveDelegate(kDummyTabId); |
| 29 } |
| 27 | 30 |
| 28 void BlimpNavigationControllerImpl::LoadURL(const GURL& url) { | 31 void BlimpNavigationControllerImpl::LoadURL(const GURL& url) { |
| 29 current_url_ = url; | 32 current_url_ = url; |
| 30 navigation_feature_->NavigateToUrlText(kDummyTabId, current_url_.spec()); | 33 navigation_feature_->NavigateToUrlText(kDummyTabId, current_url_.spec()); |
| 31 } | 34 } |
| 32 | 35 |
| 33 void BlimpNavigationControllerImpl::Reload() { | 36 void BlimpNavigationControllerImpl::Reload() { |
| 34 navigation_feature_->Reload(kDummyTabId); | 37 navigation_feature_->Reload(kDummyTabId); |
| 35 } | 38 } |
| 36 | 39 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 delegate_->OnLoadingStateChanged(loading); | 84 delegate_->OnLoadingStateChanged(loading); |
| 82 } | 85 } |
| 83 | 86 |
| 84 void BlimpNavigationControllerImpl::OnPageLoadStatusUpdate(int tab_id, | 87 void BlimpNavigationControllerImpl::OnPageLoadStatusUpdate(int tab_id, |
| 85 bool completed) { | 88 bool completed) { |
| 86 delegate_->OnNavigationStateChanged(); | 89 delegate_->OnNavigationStateChanged(); |
| 87 } | 90 } |
| 88 | 91 |
| 89 } // namespace client | 92 } // namespace client |
| 90 } // namespace blimp | 93 } // namespace blimp |
| OLD | NEW |