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

Unified Diff: blimp/client/core/blimp_navigation_controller_impl.cc

Issue 2058263002: Tied up BlimpNavigationController to NavigationFeature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blimp_core
Patch Set: Addressed code review comments Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698