diff options
author | zhenw <zhenw@chromium.org> | 2014-10-20 11:50:26 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-20 18:50:45 +0000 |
commit | 70986bd4cc0712a132247adcd17ad5fca9cb9bd8 (patch) | |
tree | 935c63509faa58f7843fb41076f529e681477d3d /content/browser/transition_request_manager.cc | |
parent | 91448dd9f5b184282a64d737680de639b725b7c5 (diff) | |
download | chromium_src-70986bd4cc0712a132247adcd17ad5fca9cb9bd8.zip chromium_src-70986bd4cc0712a132247adcd17ad5fca9cb9bd8.tar.gz chromium_src-70986bd4cc0712a132247adcd17ad5fca9cb9bd8.tar.bz2 |
Navigation transitions (web to native app): Get names and rects of transition elements (Chrome side)
Web to native app navigation transition uses Activity Transitions APIs in Android L. It requires the names and rects of transition elements. This CL gets the names and rects and pass them to TransitionRequestManager.
This is the Chrome side of the CL. Blink side will be done after this CL is landed. https://codereview.chromium.org/654953002/
Design doc: https://docs.google.com/a/chromium.org/document/d/17jg1RRL3RI969cLwbKBIcoGDsPwqaEdBxafGNYGwiY4/edit#
Demo video: https://drive.google.com/a/google.com/file/d/0B3hetueIc91Gd01DU25uT2hWU2M/view?usp=sharing
Activity Transitions in Android L: https://developer.android.com/preview/material/animations.html#transitions
BUG=370696
Review URL: https://codereview.chromium.org/652283002
Cr-Commit-Position: refs/heads/master@{#300304}
Diffstat (limited to 'content/browser/transition_request_manager.cc')
-rw-r--r-- | content/browser/transition_request_manager.cc | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/content/browser/transition_request_manager.cc b/content/browser/transition_request_manager.cc index e2c83ea..b863991 100644 --- a/content/browser/transition_request_manager.cc +++ b/content/browser/transition_request_manager.cc @@ -82,6 +82,22 @@ TransitionLayerData::TransitionLayerData() { TransitionLayerData::~TransitionLayerData() { } +TransitionRequestManager::TransitionRequestData::AllowedEntry::AllowedEntry( + const std::string& allowed_destination_host_pattern, + const std::string& css_selector, + const std::string& markup, + const std::vector<std::string>& names, + const std::vector<gfx::Rect>& rects) + : allowed_destination_host_pattern(allowed_destination_host_pattern), + css_selector(css_selector), + markup(markup), + names(names), + rects(rects) { +} + +TransitionRequestManager::TransitionRequestData::AllowedEntry::~AllowedEntry() { +} + void TransitionRequestManager::ParseTransitionStylesheetsFromHeaders( const scoped_refptr<net::HttpResponseHeaders>& headers, std::vector<GURL>& entering_stylesheets, @@ -112,10 +128,14 @@ TransitionRequestManager::TransitionRequestData::~TransitionRequestData() { void TransitionRequestManager::TransitionRequestData::AddEntry( const std::string& allowed_destination_host_pattern, const std::string& css_selector, - const std::string& markup) { + const std::string& markup, + const std::vector<std::string>& names, + const std::vector<gfx::Rect>& rects) { allowed_entries_.push_back(AllowedEntry(allowed_destination_host_pattern, css_selector, - markup)); + markup, + names, + rects)); } bool TransitionRequestManager::TransitionRequestData::FindEntry( @@ -133,6 +153,8 @@ bool TransitionRequestManager::TransitionRequestData::FindEntry( const AllowedEntry& allowed_entry = allowed_entries_[0]; transition_data->markup = allowed_entry.markup; transition_data->css_selector = allowed_entry.css_selector; + transition_data->names = allowed_entry.names; + transition_data->rects = allowed_entry.rects; return true; } @@ -155,13 +177,28 @@ void TransitionRequestManager::AddPendingTransitionRequestData( int render_frame_id, const std::string& allowed_destination_host_pattern, const std::string& css_selector, - const std::string& markup) { + const std::string& markup, + const std::vector<std::string>& names, + const std::vector<gfx::Rect>& rects) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + std::pair<int, int> key(render_process_id, render_frame_id); + pending_transition_frames_[key].AddEntry( + allowed_destination_host_pattern, css_selector, markup, names, rects); +} + +void TransitionRequestManager::AddPendingTransitionRequestDataForTesting( + int render_process_id, + int render_frame_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); std::pair<int, int> key(render_process_id, render_frame_id); - pending_transition_frames_[key].AddEntry(allowed_destination_host_pattern, - css_selector, - markup); + pending_transition_frames_[key].AddEntry( + "*", /* allowed_destination_host_pattern */ + "", /* css_selector */ + "", /* markup */ + std::vector<std::string>(), /* names */ + std::vector<gfx::Rect>()); /* rects */ } void TransitionRequestManager::ClearPendingTransitionRequestData( |