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

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: Hooked up the Java layer Created 4 years, 6 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..459a18e69984cdfb71989e73d522959b992cabe3 100644
--- a/blimp/client/core/blimp_navigation_controller_impl.cc
+++ b/blimp/client/core/blimp_navigation_controller_impl.cc
@@ -13,30 +13,77 @@
namespace blimp {
namespace client {
+const int kDummyTabId = 0;
David Trainor- moved to gerrit 2016/06/29 17:27:15 Can we add a comment about this? We'll need to so
shaktisahu 2016/07/19 21:45:29 Done.
+
BlimpNavigationControllerImpl::BlimpNavigationControllerImpl(
BlimpNavigationControllerDelegate* delegate)
- : delegate_(delegate), weak_ptr_factory_(this) {}
+ : // TODO(shaktisahu): Hook up to the real one from BlimpClientSession
+ // later.
+ 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_->OnUrlChanged(url);
+}
+
+void BlimpNavigationControllerImpl::OnFaviconChanged(int tab_id,
+ const SkBitmap& favicon) {
+ delegate_->OnFaviconChanged(favicon);
+}
+
+void BlimpNavigationControllerImpl::OnTitleChanged(int tab_id,
+ const std::string& title) {
+ delegate_->OnTitleChanged(title);
+}
+
+void BlimpNavigationControllerImpl::OnLoadingChanged(int tab_id, bool loading) {
+ delegate_->OnLoadingChanged(loading);
+}
+
+void BlimpNavigationControllerImpl::OnPageLoadStatusUpdate(int tab_id,
+ bool completed) {
+ delegate_->OnPageLoadStatusUpdate(completed);
}
} // namespace client

Powered by Google App Engine
This is Rietveld 408576698