Skip to content
  • mpearson's avatar
    Refactor Clipboard Last Modified Time Storage · 71dfbd1f
    mpearson authored
    This changelist is the first step to solving two problems:
    * clipboard last modified time isn't remembered from run to run.  It should be.
    * likewise, clipboard suggestion suppression (which happens after clearing
    browsing data) should also be preserved from run to run.
    
    The key to solving both these problems is to store the clipboard last modified
    time in prefs.  (Store a 0 to represent that the clipboard shouldn't be suggested.)
    
    To do this, we need a central place to own the last modified time value.  Upon
    consultation with dcheng@, we decided this should be clipboard_android.cc.
    Because Chrome on Android can be killed almost anytime, the best strategy
    to have clipboard_android.cc to always have the correct value is to have
    Clipboard.java "push" notification of the modification to clipboard_android.cc.
    
    After this changelist, I will submit a changelist that stores the last_modified_time
    information to prefs / reads it from prefs.
    
    As a consequence of this decision, this change makes
    
    * remove storage and retrieval of last modified time from Clipboard.java.
    clipboard_android.cc is the canonical source now.
    
    * clipboard_recent_content_generic.{cc,h} loses |last_modified_time_to_suppress_|, as
    that suppression logic is unnecessary.  Instead, when needing to suppress a
    suggestion, it tells clipboard_android to set its time to 0, which would cause
    suppression.  Adds a function ClearClipboardLastModifiedTime() to clipboard.h for
    this.
    
    * remove all the logic about hashing clipboard content from Clipboard.java.  This is
    not needed based on our usage of clipboard last modified time.  (This usage has been
    approved by privacy.)  This also means marking a related histogram as obsolete.
    
    * Because Clipboard.java sends clipboard changed messages now to
    clipboard_android, add support for sequence numbers to clipboard_android.
    
    * Likewise, because clipboard_android is "pushed" messages about the clipboard
    being updated, it knows when its local data is out of data.  It only "pulls" clipboard
    information from the Java side when someone asks it about the current state of the
    clipboard and it knows that it is out of date.
    
    * Delete ClipboardTest.java.  The only thing this tested was updating the last
    modified time in Clipboard.java, which doesn't exist anymore.
    
    TBR=sky,jif
    (sky@ for the trivial changes to ui/base/test/...)
    (jif@ for the refactoring / removal of logic from 	components/open_from_clipboard/...)
    
    BUG=682446,707366
    
    Review-Url: https://codereview.chromium.org/2812773002
    Cr-Commit-Position: refs/heads/master@{#464594}
    71dfbd1f