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

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

Issue 2040813004: Add BlimpContents[,Observer] and BlimpNavigationController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git merge origin/master 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
new file mode 100644
index 0000000000000000000000000000000000000000..6c57ea09eb0aefe8f195ddde3362d4028c84236f
--- /dev/null
+++ b/blimp/client/core/blimp_navigation_controller_impl.cc
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "blimp/client/core/blimp_navigation_controller_impl.h"
+
+#include "base/bind.h"
+#include "base/location.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_task_runner_handle.h"
+#include "blimp/client/core/blimp_navigation_controller_delegate.h"
+
+namespace blimp {
+namespace client {
+
+BlimpNavigationControllerImpl::BlimpNavigationControllerImpl(
+ BlimpNavigationControllerDelegate* delegate)
+ : delegate_(delegate), weak_ptr_factory_(this) {}
+
+BlimpNavigationControllerImpl::~BlimpNavigationControllerImpl() = default;
+
+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));
+}
+
+const GURL& BlimpNavigationControllerImpl::GetURL() {
+ return current_url_;
+}
+
+void BlimpNavigationControllerImpl::NotifyDelegateURLLoaded(const GURL& url) {
+ delegate_->NotifyURLLoaded(url);
+}
+
+} // namespace client
+} // namespace blimp
« no previous file with comments | « blimp/client/core/blimp_navigation_controller_impl.h ('k') | blimp/client/core/blimp_navigation_controller_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698