Nux Onboarding: fix race-condition crashes

There are a couple race-conditions happening in the code that
in combination causes 'undefined' to be passed to the C++ handler,
which crashes on a CHECK in BookmarkHandler:
- in some places toggleBookmarkBar() depends on isBookmarkBarShown()
   result, without taking into account that isBookmarkBarShown is async.
- multiple toggleBookmarkBar() async calls fire consecutively, overriding
   each other's effects.

The above two issues are fixed together by locally cached bookmark visibility
state that can be updated and retrieved synchronously (inside of the wrapper
BookmarkBarManager). There doesn't seem to be a way for toggling bookmark
visibility to fail in the backend. Even if that's possible, the best we can
do is to keep using the local cache value until the visibility state becomes
eventually consistent, so simply updating this local cache should suffice.

After the above fix, another timing issue is exposed:
- the navigation behavior's onRouteChange is always called in the order
that elements are created. This is problematic since sometimes module's
clean-up code run after another module's init code and causing conflicting
effects.

The above issue is fixed in this CL by adding additional enter and exit
hooks to each route, and navigation behavior will trigger them in the
expected order.

Bug: 908544
Change-Id: If462d2ec955ece0d8b17fc342fc7d1ce0225e72c
Reviewed-on: https://chromium-review.googlesource.com/c/1357523
Commit-Queue: Scott Chen <scottchen@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: Hector Carmona <hcarmona@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614604}
12 files changed