Drop all uses of //base except ObserverList from view mgr client lib

This removes all uses of //base from the view manager client C++ library
interface and implementation except for ObserverList. The tests still
use //base fairly extensively to set up message loops and whatnot.  Main
changes:

*) use int64_t + <stdint.h> instead of //base/basictypes.h + int64. This
is what //base/basictypes.h recommends doing anyway *) use lambdas to
construct callbacks instead of base::Bind. We were using
base::Unretained() anyway so bind's lifetime stuff didn't help us.  *)
Hand-expand the one use of DISALLOW_COPY_AND_ASSIGN *) Remove the one
used of scoped_ptr in the ViewManagerClientFactory variant used by the
window manager. This one is a bit unfortunate in that it needs a raw
pointer but we should be able to update it to std::unique_ptr<>
relatively soon and it's only used in two places (the window manager
common lib and one test).

The ObserverList dependency is a bit bigger.

R=sky@chromium.org

Review URL: https://codereview.chromium.org/911073005
diff --git a/mojo/services/view_manager/public/cpp/BUILD.gn b/mojo/services/view_manager/public/cpp/BUILD.gn
index b1a0bdb..72cb55e 100644
--- a/mojo/services/view_manager/public/cpp/BUILD.gn
+++ b/mojo/services/view_manager/public/cpp/BUILD.gn
@@ -45,6 +45,7 @@
     "mojo/public/c/gles2:headers",
     "mojo/public/cpp/application",
     "mojo/public/cpp/bindings:bindings",
+    "mojo/public/cpp/system",
     "mojo/public/interfaces/application",
   ]
 }
diff --git a/mojo/services/view_manager/public/cpp/lib/view.cc b/mojo/services/view_manager/public/cpp/lib/view.cc
index 1e8b2b0..bfbc67a 100644
--- a/mojo/services/view_manager/public/cpp/lib/view.cc
+++ b/mojo/services/view_manager/public/cpp/lib/view.cc
@@ -77,7 +77,7 @@
  private:
   ViewObserver::TreeChangeParams params_;
 
-  DISALLOW_COPY_AND_ASSIGN(ScopedTreeNotifier);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedTreeNotifier);
 };
 
 void RemoveChildImpl(View* child, View::Children* children) {
@@ -112,7 +112,7 @@
   View* relative_view_;
   OrderDirection direction_;
 
-  DISALLOW_COPY_AND_ASSIGN(ScopedOrderChangedNotifier);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedOrderChangedNotifier);
 };
 
 // Returns true if the order actually changed.
@@ -168,7 +168,7 @@
   const Rect old_bounds_;
   const Rect new_bounds_;
 
-  DISALLOW_COPY_AND_ASSIGN(ScopedSetBoundsNotifier);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedSetBoundsNotifier);
 };
 
 // Some operations are only permitted in the connection that created the view.
diff --git a/mojo/services/view_manager/public/cpp/lib/view_manager_client_factory.cc b/mojo/services/view_manager/public/cpp/lib/view_manager_client_factory.cc
index cfa2b79..bb39fc9 100644
--- a/mojo/services/view_manager/public/cpp/lib/view_manager_client_factory.cc
+++ b/mojo/services/view_manager/public/cpp/lib/view_manager_client_factory.cc
@@ -19,17 +19,16 @@
 }
 
 // static
-scoped_ptr<ViewManagerClient>
-ViewManagerClientFactory::WeakBindViewManagerToPipe(
+ViewManagerClient* ViewManagerClientFactory::WeakBindViewManagerToPipe(
     InterfaceRequest<ViewManagerClient> request,
     ViewManagerServicePtr view_manager_service,
     Shell* shell,
     ViewManagerDelegate* delegate) {
   const bool delete_on_error = false;
-  scoped_ptr<ViewManagerClientImpl> client(new ViewManagerClientImpl(
-      delegate, shell, request.Pass(), delete_on_error));
+  auto client = new ViewManagerClientImpl(delegate, shell, request.Pass(),
+                                          delete_on_error);
   client->SetViewManagerService(view_manager_service.Pass());
-  return client.Pass();
+  return client;
 }
 
 // InterfaceFactory<ViewManagerClient> implementation.
diff --git a/mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.cc b/mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.cc
index 574d300..b988903 100644
--- a/mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.cc
+++ b/mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.cc
@@ -4,9 +4,6 @@
 
 #include "view_manager/public/cpp/lib/view_manager_client_impl.h"
 
-#include "base/bind.h"
-#include "base/message_loop/message_loop.h"
-#include "base/stl_util.h"
 #include "mojo/public/cpp/application/application_impl.h"
 #include "mojo/public/cpp/application/connect.h"
 #include "mojo/public/cpp/application/service_provider_impl.h"
@@ -90,7 +87,7 @@
 
   View* root_;
 
-  DISALLOW_COPY_AND_ASSIGN(RootObserver);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(RootObserver);
 };
 
 ViewManagerClientImpl::ViewManagerClientImpl(
@@ -236,7 +233,9 @@
 Id ViewManagerClientImpl::CreateViewOnServer() {
   DCHECK(service_);
   const Id view_id = MakeTransportId(connection_id_, ++next_id_);
-  service_->CreateView(view_id, ActionCompletedCallbackWithErrorCode());
+  service_->CreateView(view_id, [this](ErrorCode code) {
+    OnActionCompleted(code == ERROR_CODE_NONE);
+  });
   return view_id;
 }
 
@@ -286,14 +285,21 @@
   root_->AddObserver(new RootObserver(root_));
 
   window_manager_.Bind(window_manager_pipe.Pass());
-  // base::Unretained() is safe here as |window_manager_| is bound to our
-  // lifetime.
   WindowManagerObserverPtr observer;
   wm_observer_binding_.Bind(GetProxy(&observer));
+  // binding to |this| is safe here as |window_manager_| is bound to our
+  // lifetime.
   window_manager_->GetFocusedAndActiveViews(
       observer.Pass(),
-      base::Bind(&ViewManagerClientImpl::OnGotFocusedAndActiveViews,
-                 base::Unretained(this)));
+      [this](uint32_t capture_view_id, uint32_t focused_view_id,
+             uint32_t active_view_id) {
+        if (GetViewById(capture_view_id) != capture_view_)
+          OnCaptureChanged(capture_view_id);
+        if (GetViewById(focused_view_id) != focused_view_)
+          OnFocusChanged(focused_view_id);
+        if (GetViewById(active_view_id) != activated_view_)
+          OnActiveWindowChanged(active_view_id);
+      });
 
   delegate_->OnEmbed(root_, services.Pass(), exposed_services.Pass());
 }
@@ -483,31 +489,8 @@
     change_acked_callback_.Run();
 }
 
-void ViewManagerClientImpl::OnActionCompletedWithErrorCode(ErrorCode code) {
-  OnActionCompleted(code == ERROR_CODE_NONE);
-}
-
-base::Callback<void(bool)> ViewManagerClientImpl::ActionCompletedCallback() {
-  return base::Bind(&ViewManagerClientImpl::OnActionCompleted,
-                    base::Unretained(this));
-}
-
-base::Callback<void(ErrorCode)>
-    ViewManagerClientImpl::ActionCompletedCallbackWithErrorCode() {
-  return base::Bind(&ViewManagerClientImpl::OnActionCompletedWithErrorCode,
-                    base::Unretained(this));
-}
-
-void ViewManagerClientImpl::OnGotFocusedAndActiveViews(
-    uint32_t capture_view_id,
-    uint32_t focused_view_id,
-    uint32_t active_view_id) {
-  if (GetViewById(capture_view_id) != capture_view_)
-    OnCaptureChanged(capture_view_id);
-  if (GetViewById(focused_view_id) != focused_view_)
-    OnFocusChanged(focused_view_id);
-  if (GetViewById(active_view_id) != activated_view_)
-    OnActiveWindowChanged(active_view_id);
+Callback<void(bool)> ViewManagerClientImpl::ActionCompletedCallback() {
+  return [this](bool success) { OnActionCompleted(success); };
 }
 
 }  // namespace mojo
diff --git a/mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.h b/mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.h
index c3a2ad5..94db93d 100644
--- a/mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.h
+++ b/mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.h
@@ -5,9 +5,6 @@
 #ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_
 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_
 
-#include "base/callback.h"
-#include "base/memory/scoped_vector.h"
-#include "base/memory/weak_ptr.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "view_manager/public/cpp/types.h"
 #include "view_manager/public/cpp/view.h"
@@ -66,12 +63,10 @@
              ServiceProviderPtr exposed_services);
   void Embed(Id view_id, ViewManagerClientPtr client);
 
-  void set_change_acked_callback(const base::Callback<void(void)>& callback) {
+  void set_change_acked_callback(const Callback<void(void)>& callback) {
     change_acked_callback_ = callback;
   }
-  void ClearChangeAckedCallback() {
-    change_acked_callback_ = base::Callback<void(void)>();
-  }
+  void ClearChangeAckedCallback() { change_acked_callback_.reset(); }
 
   // Start/stop tracking views. While tracked, they can be retrieved via
   // ViewManager::GetViewById.
@@ -136,22 +131,15 @@
   void RootDestroyed(View* root);
 
   void OnActionCompleted(bool success);
-  void OnActionCompletedWithErrorCode(ErrorCode code);
 
-  base::Callback<void(bool)> ActionCompletedCallback();
-  base::Callback<void(ErrorCode)> ActionCompletedCallbackWithErrorCode();
-
-  // Callback from server for initial request of capture/focused/active views.
-  void OnGotFocusedAndActiveViews(uint32_t capture_view_id,
-                                  uint32_t focused_view_id,
-                                  uint32_t active_view_id);
+  Callback<void(bool)> ActionCompletedCallback();
 
   ConnectionSpecificId connection_id_;
   ConnectionSpecificId next_id_;
 
   std::string creator_url_;
 
-  base::Callback<void(void)> change_acked_callback_;
+  Callback<void(void)> change_acked_callback_;
 
   ViewManagerDelegate* delegate_;
 
@@ -170,7 +158,7 @@
   ViewManagerServicePtr service_;
   const bool delete_on_error_;
 
-  DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl);
 };
 
 }  // namespace mojo
diff --git a/mojo/services/view_manager/public/cpp/lib/view_manager_context.cc b/mojo/services/view_manager/public/cpp/lib/view_manager_context.cc
index a47f59a..d1c2fd0 100644
--- a/mojo/services/view_manager/public/cpp/lib/view_manager_context.cc
+++ b/mojo/services/view_manager/public/cpp/lib/view_manager_context.cc
@@ -28,7 +28,9 @@
 
 ViewManagerContext::ViewManagerContext(ApplicationImpl* application_impl)
     : state_(new InternalState(application_impl)) {}
-ViewManagerContext::~ViewManagerContext() {}
+ViewManagerContext::~ViewManagerContext() {
+  delete state_;
+}
 
 void ViewManagerContext::Embed(const String& url) {
   Embed(url, nullptr, nullptr);
diff --git a/mojo/services/view_manager/public/cpp/lib/view_observer.cc b/mojo/services/view_manager/public/cpp/lib/view_observer.cc
index 456147c..7e6acc0 100644
--- a/mojo/services/view_manager/public/cpp/lib/view_observer.cc
+++ b/mojo/services/view_manager/public/cpp/lib/view_observer.cc
@@ -4,17 +4,16 @@
 
 #include "view_manager/public/cpp/view_observer.h"
 
-#include "base/basictypes.h"
-
 namespace mojo {
 
 ////////////////////////////////////////////////////////////////////////////////
 // ViewObserver, public:
 
 ViewObserver::TreeChangeParams::TreeChangeParams()
-    : target(NULL),
-      old_parent(NULL),
-      new_parent(NULL),
-      receiver(NULL) {}
+    : target(nullptr),
+      old_parent(nullptr),
+      new_parent(nullptr),
+      receiver(nullptr) {
+}
 
 }  // namespace mojo
diff --git a/mojo/services/view_manager/public/cpp/lib/view_private.h b/mojo/services/view_manager/public/cpp/lib/view_private.h
index 1c54567..dc37196 100644
--- a/mojo/services/view_manager/public/cpp/lib/view_private.h
+++ b/mojo/services/view_manager/public/cpp/lib/view_private.h
@@ -5,8 +5,6 @@
 #ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_PRIVATE_H_
 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_PRIVATE_H_
 
-#include "base/basictypes.h"
-
 #include "view_manager/public/cpp/view.h"
 
 namespace mojo {
@@ -65,7 +63,7 @@
  private:
   View* view_;
 
-  DISALLOW_COPY_AND_ASSIGN(ViewPrivate);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ViewPrivate);
 };
 
 }  // namespace mojo
diff --git a/mojo/services/view_manager/public/cpp/tests/BUILD.gn b/mojo/services/view_manager/public/cpp/tests/BUILD.gn
index 3414d33..96810c6 100644
--- a/mojo/services/view_manager/public/cpp/tests/BUILD.gn
+++ b/mojo/services/view_manager/public/cpp/tests/BUILD.gn
@@ -18,6 +18,7 @@
     "//base",
     "//base/test:test_support",
     "//mojo/public/cpp/application",
+    "//mojo/public/cpp/system",
     "//mojo/services/geometry/public/cpp",
     "//mojo/services/geometry/public/interfaces",
     "//mojo/services/view_manager/public/cpp",
diff --git a/mojo/services/view_manager/public/cpp/tests/view_manager_test_suite.h b/mojo/services/view_manager/public/cpp/tests/view_manager_test_suite.h
index ef81661..547efc2 100644
--- a/mojo/services/view_manager/public/cpp/tests/view_manager_test_suite.h
+++ b/mojo/services/view_manager/public/cpp/tests/view_manager_test_suite.h
@@ -6,6 +6,7 @@
 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_TESTS_VIEW_MANAGER_TEST_SUITE_H_
 
 #include "base/test/test_suite.h"
+#include "mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 
@@ -18,7 +19,7 @@
   void Initialize() override;
 
  private:
-  DISALLOW_COPY_AND_ASSIGN(ViewManagerTestSuite);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ViewManagerTestSuite);
 };
 
 }  // namespace mojo
diff --git a/mojo/services/view_manager/public/cpp/tests/view_manager_unittest.cc b/mojo/services/view_manager/public/cpp/tests/view_manager_unittest.cc
index bc69464..fd08fab 100644
--- a/mojo/services/view_manager/public/cpp/tests/view_manager_unittest.cc
+++ b/mojo/services/view_manager/public/cpp/tests/view_manager_unittest.cc
@@ -7,6 +7,7 @@
 #include "base/auto_reset.h"
 #include "base/bind.h"
 #include "base/logging.h"
+#include "base/memory/scoped_vector.h"
 #include "mojo/public/cpp/application/application_connection.h"
 #include "mojo/public/cpp/application/application_delegate.h"
 #include "mojo/public/cpp/application/application_impl.h"
@@ -91,7 +92,7 @@
   LoadedCallback callback_;
   scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_;
 
-  DISALLOW_COPY_AND_ASSIGN(ConnectApplicationLoader);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ConnectApplicationLoader);
 };
 
 class BoundsChangeObserver : public ViewObserver {
@@ -110,7 +111,7 @@
 
   View* view_;
 
-  DISALLOW_COPY_AND_ASSIGN(BoundsChangeObserver);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(BoundsChangeObserver);
 };
 
 // Wait until the bounds of the supplied view change.
@@ -152,7 +153,7 @@
   View* tree_;
   size_t tree_size_;
 
-  DISALLOW_COPY_AND_ASSIGN(TreeSizeMatchesObserver);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(TreeSizeMatchesObserver);
 };
 
 void WaitForTreeSizeToMatch(View* view, size_t tree_size) {
@@ -187,7 +188,7 @@
 
   std::set<Id>* views_;
 
-  DISALLOW_COPY_AND_ASSIGN(DestructionObserver);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(DestructionObserver);
 };
 
 void WaitForDestruction(ViewManager* view_manager, std::set<Id>* views) {
@@ -220,7 +221,7 @@
 
   View* view_;
 
-  DISALLOW_COPY_AND_ASSIGN(OrderChangeObserver);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(OrderChangeObserver);
 };
 
 void WaitForOrderChange(ViewManager* view_manager, View* view) {
@@ -251,7 +252,7 @@
   int id_;
   View* view_;
 
-  DISALLOW_COPY_AND_ASSIGN(ViewTracker);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ViewTracker);
 };
 
 }  // namespace
@@ -337,7 +338,7 @@
   ViewManager* window_manager_;
   int commit_count_;
 
-  DISALLOW_COPY_AND_ASSIGN(ViewManagerTest);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ViewManagerTest);
 };
 
 // TODO(sky): all of these tests are disabled as each test triggers running
@@ -543,7 +544,7 @@
 
   View* view_;
 
-  DISALLOW_COPY_AND_ASSIGN(VisibilityChangeObserver);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(VisibilityChangeObserver);
 };
 
 }  // namespace
@@ -606,7 +607,7 @@
 
   View* view_;
 
-  DISALLOW_COPY_AND_ASSIGN(DrawnChangeObserver);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(DrawnChangeObserver);
 };
 
 }  // namespace
diff --git a/mojo/services/view_manager/public/cpp/tests/view_unittest.cc b/mojo/services/view_manager/public/cpp/tests/view_unittest.cc
index 149eb3a..abbd712 100644
--- a/mojo/services/view_manager/public/cpp/tests/view_unittest.cc
+++ b/mojo/services/view_manager/public/cpp/tests/view_unittest.cc
@@ -27,7 +27,7 @@
   ~TestView() {}
 
  private:
-  DISALLOW_COPY_AND_ASSIGN(TestView);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(TestView);
 };
 
 TEST_F(ViewTest, AddChild) {
@@ -148,7 +148,7 @@
 
  private:
   static TestProperty* last_deleted_;
-  DISALLOW_COPY_AND_ASSIGN(TestProperty);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(TestProperty);
 };
 
 TestProperty* TestProperty::last_deleted_ = NULL;
@@ -222,7 +222,7 @@
   View* observee_;
   std::vector<TreeChangeParams> received_params_;
 
-  DISALLOW_COPY_AND_ASSIGN(TreeChangeObserver);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(TreeChangeObserver);
 };
 
 // Adds/Removes v11 to v1.
@@ -463,7 +463,7 @@
   View* observee_;
   Changes changes_;
 
-  DISALLOW_COPY_AND_ASSIGN(OrderChangeObserver);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(OrderChangeObserver);
 };
 
 }  // namespace
@@ -613,7 +613,7 @@
   View* view_;
   Changes changes_;
 
-  DISALLOW_COPY_AND_ASSIGN(BoundsChangeObserver);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(BoundsChangeObserver);
 };
 
 }  // namespace
@@ -669,7 +669,7 @@
   View* view_;
   Changes changes_;
 
-  DISALLOW_COPY_AND_ASSIGN(VisibilityChangeObserver);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(VisibilityChangeObserver);
 };
 
 }  // namespace
@@ -775,7 +775,7 @@
   View* view_;
   Changes changes_;
 
-  DISALLOW_COPY_AND_ASSIGN(SharedPropertyChangeObserver);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(SharedPropertyChangeObserver);
 };
 
 }  // namespace
@@ -856,7 +856,7 @@
   const void* property_key_;
   intptr_t old_property_value_;
 
-  DISALLOW_COPY_AND_ASSIGN(LocalPropertyChangeObserver);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(LocalPropertyChangeObserver);
 };
 
 }  // namespace
diff --git a/mojo/services/view_manager/public/cpp/view.h b/mojo/services/view_manager/public/cpp/view.h
index d888ef0..a48dbc2 100644
--- a/mojo/services/view_manager/public/cpp/view.h
+++ b/mojo/services/view_manager/public/cpp/view.h
@@ -5,12 +5,13 @@
 #ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_
 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_
 
+#include <stdint.h>
 #include <vector>
 
-#include "base/basictypes.h"
 #include "base/observer_list.h"
 #include "geometry/public/interfaces/geometry.mojom.h"
 #include "mojo/public/cpp/bindings/array.h"
+#include "mojo/public/cpp/system/macros.h"
 #include "mojo/public/interfaces/application/service_provider.mojom.h"
 #include "surfaces/public/interfaces/surface_id.mojom.h"
 #include "view_manager/public/cpp/types.h"
@@ -87,7 +88,7 @@
   void ClearLocalProperty(const ViewProperty<T>* property);
 
   // Type of a function to delete a property that this view owns.
-  typedef void (*PropertyDeallocator)(int64 value);
+  typedef void (*PropertyDeallocator)(int64_t value);
 
   // A View is drawn if the View and all its ancestors are visible and the
   // View is attached to the root.
@@ -141,12 +142,13 @@
   View(ViewManager* manager, Id id);
 
   // Called by the public {Set,Get,Clear}Property functions.
-  int64 SetLocalPropertyInternal(const void* key,
-                                 const char* name,
-                                 PropertyDeallocator deallocator,
-                                 int64 value,
-                                 int64 default_value);
-  int64 GetLocalPropertyInternal(const void* key, int64 default_value) const;
+  int64_t SetLocalPropertyInternal(const void* key,
+                                   const char* name,
+                                   PropertyDeallocator deallocator,
+                                   int64_t value,
+                                   int64_t default_value);
+  int64_t GetLocalPropertyInternal(const void* key,
+                                   int64_t default_value) const;
 
   void LocalDestroy();
   void LocalAddChild(View* child);
@@ -193,13 +195,13 @@
   // WindowProperty<>.
   struct Value {
     const char* name;
-    int64 value;
+    int64_t value;
     PropertyDeallocator deallocator;
   };
 
   std::map<const void*, Value> prop_map_;
 
-  DISALLOW_COPY_AND_ASSIGN(View);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(View);
 };
 
 }  // namespace mojo
diff --git a/mojo/services/view_manager/public/cpp/view_manager_client_factory.h b/mojo/services/view_manager/public/cpp/view_manager_client_factory.h
index edb5ca3..e47da3d 100644
--- a/mojo/services/view_manager/public/cpp/view_manager_client_factory.h
+++ b/mojo/services/view_manager/public/cpp/view_manager_client_factory.h
@@ -5,7 +5,6 @@
 #ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_CLIENT_FACTORY_H_
 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_CLIENT_FACTORY_H_
 
-#include "base/memory/scoped_ptr.h"
 #include "mojo/public/cpp/application/interface_factory.h"
 #include "view_manager/public/interfaces/view_manager.mojom.h"
 
@@ -22,8 +21,9 @@
   ViewManagerClientFactory(Shell* shell, ViewManagerDelegate* delegate);
   ~ViewManagerClientFactory() override;
 
-  // Creates a ViewManagerClient from the supplied arguments.
-  static scoped_ptr<ViewManagerClient> WeakBindViewManagerToPipe(
+  // Creates a ViewManagerClient from the supplied arguments. Returns ownership
+  // to the caller.
+  static ViewManagerClient* WeakBindViewManagerToPipe(
       InterfaceRequest<ViewManagerClient> request,
       ViewManagerServicePtr view_manager_service,
       Shell* shell,
diff --git a/mojo/services/view_manager/public/cpp/view_manager_context.h b/mojo/services/view_manager/public/cpp/view_manager_context.h
index 1976598..de7b84b 100644
--- a/mojo/services/view_manager/public/cpp/view_manager_context.h
+++ b/mojo/services/view_manager/public/cpp/view_manager_context.h
@@ -8,9 +8,8 @@
 #include <string>
 #include <vector>
 
-#include "base/bind.h"
-#include "base/memory/scoped_ptr.h"
 #include "mojo/public/cpp/application/service_provider_impl.h"
+#include "mojo/public/cpp/system/macros.h"
 
 namespace mojo {
 class ApplicationImpl;
@@ -37,7 +36,7 @@
 
  private:
   class InternalState;
-  scoped_ptr<InternalState> state_;
+  InternalState* state_;
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(ViewManagerContext);
 };
diff --git a/mojo/services/view_manager/public/cpp/view_observer.h b/mojo/services/view_manager/public/cpp/view_observer.h
index f059e11..341a4f0 100644
--- a/mojo/services/view_manager/public/cpp/view_observer.h
+++ b/mojo/services/view_manager/public/cpp/view_observer.h
@@ -7,8 +7,6 @@
 
 #include <vector>
 
-#include "base/basictypes.h"
-
 #include "input_events/public/interfaces/input_events.mojom.h"
 #include "view_manager/public/cpp/view.h"
 
diff --git a/mojo/services/view_manager/public/cpp/view_property.h b/mojo/services/view_manager/public/cpp/view_property.h
index d3a345f..2dbd317 100644
--- a/mojo/services/view_manager/public/cpp/view_property.h
+++ b/mojo/services/view_manager/public/cpp/view_property.h
@@ -5,7 +5,7 @@
 #ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_PROPERTY_H_
 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_PROPERTY_H_
 
-#include "base/basictypes.h"
+#include <stdint.h>
 
 // This header should be included by code that defines ViewProperties. It
 // should not be included by code that only gets and sets ViewProperties.
@@ -43,27 +43,27 @@
 namespace mojo {
 namespace {
 
-// No single new-style cast works for every conversion to/from int64, so we
+// No single new-style cast works for every conversion to/from int64_t, so we
 // need this helper class. A third specialization is needed for bool because
 // MSVC warning C4800 (forcing value to bool) is not suppressed by an explicit
 // cast (!).
 template <typename T>
 class ViewPropertyCaster {
  public:
-  static int64 ToInt64(T x) { return static_cast<int64>(x); }
-  static T FromInt64(int64 x) { return static_cast<T>(x); }
+  static int64_t ToInt64(T x) { return static_cast<int64_t>(x); }
+  static T FromInt64(int64_t x) { return static_cast<T>(x); }
 };
 template <typename T>
 class ViewPropertyCaster<T*> {
  public:
-  static int64 ToInt64(T* x) { return reinterpret_cast<int64>(x); }
-  static T* FromInt64(int64 x) { return reinterpret_cast<T*>(x); }
+  static int64_t ToInt64(T* x) { return reinterpret_cast<int64_t>(x); }
+  static T* FromInt64(int64_t x) { return reinterpret_cast<T*>(x); }
 };
 template <>
 class ViewPropertyCaster<bool> {
  public:
-  static int64 ToInt64(bool x) { return static_cast<int64>(x); }
-  static bool FromInt64(int64 x) { return x != 0; }
+  static int64_t ToInt64(bool x) { return static_cast<int64_t>(x); }
+  static bool FromInt64(int64_t x) { return x != 0; }
 };
 
 }  // namespace
@@ -77,7 +77,7 @@
 
 template <typename T>
 void View::SetLocalProperty(const ViewProperty<T>* property, T value) {
-  int64 old = SetLocalPropertyInternal(
+  int64_t old = SetLocalPropertyInternal(
       property, property->name,
       value == property->default_value ? nullptr : property->deallocator,
       ViewPropertyCaster<T>::ToInt64(value),
@@ -111,23 +111,23 @@
       const mojo::ViewProperty<T>*);
 #define DECLARE_VIEW_PROPERTY_TYPE(T) DECLARE_EXPORTED_VIEW_PROPERTY_TYPE(, T)
 
-#define DEFINE_VIEW_PROPERTY_KEY(TYPE, NAME, DEFAULT)                      \
-  COMPILE_ASSERT(sizeof(TYPE) <= sizeof(int64), property_type_too_large);  \
-  namespace {                                                              \
-  const mojo::ViewProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr}; \
-  }                                                                        \
+#define DEFINE_VIEW_PROPERTY_KEY(TYPE, NAME, DEFAULT)                       \
+  COMPILE_ASSERT(sizeof(TYPE) <= sizeof(int64_t), property_type_too_large); \
+  namespace {                                                               \
+  const mojo::ViewProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr};  \
+  }                                                                         \
   const mojo::ViewProperty<TYPE>* const NAME = &NAME##_Value;
 
-#define DEFINE_LOCAL_VIEW_PROPERTY_KEY(TYPE, NAME, DEFAULT)                \
-  COMPILE_ASSERT(sizeof(TYPE) <= sizeof(int64), property_type_too_large);  \
-  namespace {                                                              \
-  const mojo::ViewProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr}; \
-  const mojo::ViewProperty<TYPE>* const NAME = &NAME##_Value;              \
+#define DEFINE_LOCAL_VIEW_PROPERTY_KEY(TYPE, NAME, DEFAULT)                 \
+  COMPILE_ASSERT(sizeof(TYPE) <= sizeof(int64_t), property_type_too_large); \
+  namespace {                                                               \
+  const mojo::ViewProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr};  \
+  const mojo::ViewProperty<TYPE>* const NAME = &NAME##_Value;               \
   }
 
 #define DEFINE_OWNED_VIEW_PROPERTY_KEY(TYPE, NAME, DEFAULT)            \
   namespace {                                                          \
-  void Deallocator##NAME(int64 p) {                                    \
+  void Deallocator##NAME(int64_t p) {                                  \
     enum { type_must_be_complete = sizeof(TYPE) };                     \
     delete mojo::ViewPropertyCaster<TYPE*>::FromInt64(p);              \
   }                                                                    \
diff --git a/mojo/services/view_manager/public/cpp/view_tracker.h b/mojo/services/view_manager/public/cpp/view_tracker.h
index 05325b7..1d6bf14 100644
--- a/mojo/services/view_manager/public/cpp/view_tracker.h
+++ b/mojo/services/view_manager/public/cpp/view_tracker.h
@@ -5,10 +5,10 @@
 #ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_TRACKER_H_
 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_TRACKER_H_
 
+#include <stdint.h>
 #include <set>
 
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
+#include "mojo/public/cpp/system/macros.h"
 #include "view_manager/public/cpp/view_observer.h"
 
 namespace mojo {
@@ -39,7 +39,7 @@
  private:
   Views views_;
 
-  DISALLOW_COPY_AND_ASSIGN(ViewTracker);
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ViewTracker);
 };
 
 }  // namespace mojo
diff --git a/services/window_manager/window_manager_app.cc b/services/window_manager/window_manager_app.cc
index 18d68e3..c35c5ff 100644
--- a/services/window_manager/window_manager_app.cc
+++ b/services/window_manager/window_manager_app.cc
@@ -371,11 +371,11 @@
 
 void WindowManagerApp::SetViewManagerClient(
     mojo::ScopedMessagePipeHandle view_manager_client_request) {
-  view_manager_client_ =
+  view_manager_client_.reset(
       mojo::ViewManagerClientFactory::WeakBindViewManagerToPipe(
           mojo::MakeRequest<mojo::ViewManagerClient>(
               view_manager_client_request.Pass()),
-          view_manager_service_.Pass(), shell_, this).Pass();
+          view_manager_service_.Pass(), shell_, this));
 }
 
 }  // namespace window_manager