Chromium Code Reviews| Index: blimp/client/core/blimp_navigation_controller_impl.cc |
| diff --git a/blimp/client/core/blimp_navigation_controller_impl.cc b/blimp/client/core/blimp_navigation_controller_impl.cc |
| index 6c57ea09eb0aefe8f195ddde3362d4028c84236f..0f3dd60250fe6de7096d2887f77a1efa21ece8cb 100644 |
| --- a/blimp/client/core/blimp_navigation_controller_impl.cc |
| +++ b/blimp/client/core/blimp_navigation_controller_impl.cc |
| @@ -13,30 +13,78 @@ |
| namespace blimp { |
| namespace client { |
| +// TODO(shaktisahu): NavigationFeautre currently needs a tab_id. Remove this |
| +// later when it is fully integrated with BlimpClientSession. |
|
David Trainor- moved to gerrit
2016/07/25 15:57:31
BlimpClientSession -> BlimpClientContext
shaktisahu
2016/07/26 01:25:27
Done.
|
| +const int kDummyTabId = 0; |
|
David Trainor- moved to gerrit
2016/07/25 15:57:31
namespace {} around this?
shaktisahu
2016/07/26 01:25:27
Done.
|
| + |
| BlimpNavigationControllerImpl::BlimpNavigationControllerImpl( |
| BlimpNavigationControllerDelegate* delegate) |
| - : delegate_(delegate), weak_ptr_factory_(this) {} |
| + : // TODO(shaktisahu): Get the feature from BlimpClientSession. |
|
David Trainor- moved to gerrit
2016/07/25 15:57:31
BlimpClientSession -> BlimpClientContext?
shaktisahu
2016/07/26 01:25:27
Done.
|
| + navigation_feature_(new NavigationFeature), |
| + delegate_(delegate) { |
| + navigation_feature_->SetDelegate(kDummyTabId, this); |
| +} |
| BlimpNavigationControllerImpl::~BlimpNavigationControllerImpl() = default; |
| +void BlimpNavigationControllerImpl::SetNavigationFeatureForTesting( |
| + NavigationFeature* feature) { |
| + navigation_feature_ = feature; |
| + navigation_feature_->SetDelegate(kDummyTabId, this); |
| +} |
| + |
| void BlimpNavigationControllerImpl::LoadURL(const GURL& url) { |
| current_url_ = url; |
| - // Temporary trick to ensure that the delegate is not invoked before this |
| - // method has finished executing. This enables tests to test the |
| - // asynchronous nature of the API. |
| - // TODO(shaktisahu): Remove this after integration with NavigationFeature. |
| - base::ThreadTaskRunnerHandle::Get()->PostTask( |
| - FROM_HERE, |
| - base::Bind(&BlimpNavigationControllerImpl::NotifyDelegateURLLoaded, |
| - weak_ptr_factory_.GetWeakPtr(), url)); |
| + navigation_feature_->NavigateToUrlText(kDummyTabId, current_url_.spec()); |
| +} |
| + |
| +void BlimpNavigationControllerImpl::Reload() { |
| + navigation_feature_->Reload(kDummyTabId); |
| +} |
| + |
| +bool BlimpNavigationControllerImpl::CanGoBack() const { |
| + // TODO(shaktisahu): Implement the client-side logic. |
| + return false; |
| +} |
| + |
| +bool BlimpNavigationControllerImpl::CanGoForward() const { |
| + // TODO(shaktisahu): Implement the client-side logic. |
| + return false; |
| +} |
| + |
| +void BlimpNavigationControllerImpl::GoBack() { |
| + navigation_feature_->GoBack(kDummyTabId); |
| +} |
| + |
| +void BlimpNavigationControllerImpl::GoForward() { |
| + navigation_feature_->GoForward(kDummyTabId); |
| } |
| const GURL& BlimpNavigationControllerImpl::GetURL() { |
| return current_url_; |
| } |
| -void BlimpNavigationControllerImpl::NotifyDelegateURLLoaded(const GURL& url) { |
| - delegate_->NotifyURLLoaded(url); |
| +void BlimpNavigationControllerImpl::OnUrlChanged(int tab_id, const GURL& url) { |
| + delegate_->OnNavigationStateChanged(); |
| +} |
| + |
| +void BlimpNavigationControllerImpl::OnFaviconChanged(int tab_id, |
| + const SkBitmap& favicon) { |
| + delegate_->OnNavigationStateChanged(); |
| +} |
| + |
| +void BlimpNavigationControllerImpl::OnTitleChanged(int tab_id, |
| + const std::string& title) { |
| + delegate_->OnNavigationStateChanged(); |
| +} |
| + |
| +void BlimpNavigationControllerImpl::OnLoadingChanged(int tab_id, bool loading) { |
| + delegate_->OnNavigationStateChanged(); |
| +} |
| + |
| +void BlimpNavigationControllerImpl::OnPageLoadStatusUpdate(int tab_id, |
| + bool completed) { |
| + delegate_->OnNavigationStateChanged(); |
| } |
| } // namespace client |