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

Issue 2812773002: Refactor Clipboard Last Modified Time Storage (Closed)

Created:
3 years, 8 months ago by Mark P
Modified:
3 years, 8 months ago
Reviewers:
Ted C, dcheng
CC:
chromium-reviews, asvitkine+watch_chromium.org, agrieve+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactor Clipboard Last Modified Time Storage 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} Committed: https://chromium.googlesource.com/chromium/src/+/71dfbd1f2228ae70efcea0656b3555ab539430fd

Patch Set 1 #

Patch Set 2 : load on startup #

Total comments: 9

Patch Set 3 : dcheng's comments #

Patch Set 4 : remove prefs stuff #

Patch Set 5 : rebase #

Patch Set 6 : rebase #

Total comments: 6

Patch Set 7 : one dcheng comment #

Patch Set 8 : itri-state enum #

Unified diffs Side-by-side diffs Delta from patch set Stats (+126 lines, -195 lines) Patch
M components/open_from_clipboard/clipboard_recent_content_generic.h View 1 chunk +0 lines, -5 lines 0 comments Download
M components/open_from_clipboard/clipboard_recent_content_generic.cc View 1 2 3 4 5 3 chunks +5 lines, -12 lines 0 comments Download
M components/open_from_clipboard/clipboard_recent_content_generic_unittest.cc View 1 2 5 chunks +7 lines, -11 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M ui/android/BUILD.gn View 1 2 3 4 1 chunk +0 lines, -2 lines 0 comments Download
M ui/android/java/src/org/chromium/ui/base/Clipboard.java View 1 2 3 4 5 chunks +5 lines, -70 lines 0 comments Download
D ui/android/junit/src/org/chromium/ui/base/ClipboardTest.java View 1 chunk +0 lines, -50 lines 0 comments Download
M ui/base/android/ui_base_jni_registrar.cc View 1 chunk +3 lines, -1 line 0 comments Download
M ui/base/clipboard/clipboard.h View 1 2 1 chunk +4 lines, -1 line 0 comments Download
M ui/base/clipboard/clipboard.cc View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M ui/base/clipboard/clipboard_android.h View 1 2 3 3 chunks +13 lines, -1 line 0 comments Download
M ui/base/clipboard/clipboard_android.cc View 1 2 3 4 5 6 7 12 chunks +73 lines, -36 lines 0 comments Download
M ui/base/test/test_clipboard.h View 1 2 2 chunks +4 lines, -3 lines 0 comments Download
M ui/base/test/test_clipboard.cc View 1 2 2 chunks +6 lines, -2 lines 0 comments Download

Messages

Total messages: 51 (29 generated)
Mark P
dcheng@, Can you please take a look at draft changelist and tell me what you ...
3 years, 8 months ago (2017-04-11 04:31:26 UTC) #7
dcheng
Sorry for the delayed review. The overall approach looks reasonable. As mentioned in the comments, ...
3 years, 8 months ago (2017-04-12 00:56:09 UTC) #8
Mark P
Thanks for your preliminary feedback. I'll get it this first thing tomorrow. Do you have ...
3 years, 8 months ago (2017-04-12 04:21:11 UTC) #9
dcheng
On 2017/04/12 04:21:11, Mark P wrote: > Thanks for your preliminary feedback. I'll get it ...
3 years, 8 months ago (2017-04-12 07:10:18 UTC) #10
Mark P
On Wed, Apr 12, 2017 at 12:10 AM, <dcheng@chromium.org> wrote: > On 2017/04/12 04:21:11, Mark ...
3 years, 8 months ago (2017-04-12 18:32:01 UTC) #11
Mark P
On Wed, Apr 12, 2017 at 11:31 AM, Mark Pearson <mpearson@chromium.org> wrote: > > On ...
3 years, 8 months ago (2017-04-12 18:46:26 UTC) #12
Mark P
Hey dcheng@ This changelist is complete and ready for review. It works. I ripped out ...
3 years, 8 months ago (2017-04-12 21:33:52 UTC) #15
Mark P
Ted, This will need your review too. Please take a look at the ui/android/... changes ...
3 years, 8 months ago (2017-04-12 23:55:32 UTC) #17
Ted C
On 2017/04/12 23:55:32, Mark P wrote: > Ted, > > This will need your review ...
3 years, 8 months ago (2017-04-13 18:01:15 UTC) #22
Mark P
Oy, apparently today is the branch, not tomorrow... --mark
3 years, 8 months ago (2017-04-13 19:57:46 UTC) #25
dcheng
Mostly LG. Two minor comments, and also just to double-check: since the clipboard code isn't ...
3 years, 8 months ago (2017-04-13 20:35:37 UTC) #30
Mark P
On 2017/04/13 20:35:37, dcheng wrote: > Mostly LG. Two minor comments, and also just to ...
3 years, 8 months ago (2017-04-13 20:54:05 UTC) #31
dcheng
https://codereview.chromium.org/2812773002/diff/100001/ui/base/clipboard/clipboard_android.cc File ui/base/clipboard/clipboard_android.cc (right): https://codereview.chromium.org/2812773002/diff/100001/ui/base/clipboard/clipboard_android.cc#newcode119 ui/base/clipboard/clipboard_android.cc:119: map_up_to_date_ = false; On 2017/04/13 20:54:05, Mark P wrote: ...
3 years, 8 months ago (2017-04-13 20:59:18 UTC) #34
Mark P
https://codereview.chromium.org/2812773002/diff/100001/ui/base/clipboard/clipboard_android.cc File ui/base/clipboard/clipboard_android.cc (right): https://codereview.chromium.org/2812773002/diff/100001/ui/base/clipboard/clipboard_android.cc#newcode119 ui/base/clipboard/clipboard_android.cc:119: map_up_to_date_ = false; On 2017/04/13 20:59:18, dcheng wrote: > ...
3 years, 8 months ago (2017-04-13 21:21:46 UTC) #35
dcheng
clipboard lgtm thanks for cleaning this up
3 years, 8 months ago (2017-04-13 21:23:40 UTC) #36
Mark P
On 2017/04/13 21:23:40, dcheng wrote: > clipboard lgtm To be clear, did you review the ...
3 years, 8 months ago (2017-04-13 21:25:20 UTC) #37
dcheng
sorry, i did look at the whole cl, so lgtm for the whole cl
3 years, 8 months ago (2017-04-13 21:29:46 UTC) #40
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2812773002/140001
3 years, 8 months ago (2017-04-13 22:36:56 UTC) #45
commit-bot: I haz the power
Committed patchset #8 (id:140001) as https://chromium.googlesource.com/chromium/src/+/71dfbd1f2228ae70efcea0656b3555ab539430fd
3 years, 8 months ago (2017-04-13 23:08:36 UTC) #48
Shimi Zhang
On 2017/04/13 23:08:36, commit-bot: I haz the power wrote: > Committed patchset #8 (id:140001) as ...
3 years, 8 months ago (2017-04-14 01:58:41 UTC) #49
Mark P
On 2017/04/14 01:58:41, Shimi Zhang wrote: > On 2017/04/13 23:08:36, commit-bot: I haz the power ...
3 years, 8 months ago (2017-04-14 04:01:48 UTC) #50
Shimi Zhang
3 years, 8 months ago (2017-04-14 16:41:43 UTC) #51
Message was sent while issue was closed.
On 2017/04/14 04:01:48, Mark P wrote:
> On 2017/04/14 01:58:41, Shimi Zhang wrote:
> > On 2017/04/13 23:08:36, commit-bot: I haz the power wrote:
> > > Committed patchset #8 (id:140001) as
> > >
> >
>
https://chromium.googlesource.com/chromium/src/+/71dfbd1f2228ae70efcea0656b35...
> > 
> > Hi mpearson@, I added a test in ClipboardTest.java
> > (https://codereview.chromium.org/2812933003) to ensure the functionality of
a
> > change to getHtmlText() in Clipboard.java. However, it seems git didn't
> resolve
> > the conflicts properly, so the whole ClipboardTest.java file got deleted,
can
> we
> > have a closer look on how to bring that test back? Thanks.
> 
> Oh, that's a weird behavior for git.  I'm glad to see your functional changes
> were submitted.
> 
> It shouldn't be hard to revive ClipboardTest.java and have it simply contain
> your new test.  I'm willing to do it if you don't want to.  (I'd start with
your
> ClipboardTest.java, remove the the beforeClass(), afterClass(), and
> testGetClipboardContentChangeTimeInMillis() functions, remove all the
> now-unnecessary includes, and re-add it to ui/android/BUILD.gn.  I think
that's
> it.)
> 
> --mark

Sounds cool, I will send a cl soon, and have both you and my reviewer check it
again. Thanks!

Powered by Google App Engine
This is Rietveld 408576698