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

Issue 1288903002: Refactor ShortcutHelper and merge in BookmarkUtils (Closed)

Created:
5 years, 4 months ago by Lalit Maganti
Modified:
5 years, 3 months ago
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactor ShortcutHelper and merge in BookmarkUtils This CL reworks the terminology used by classes which are used to add shortcuts to the homescreen. What it does exactly is: (1) Splits off all functions in ShortcutHelper which are only used by Add to Homescreen dialog into their own file called AddToHomescreenDialogHelper (both Java and C++ componenets) (2) Merges BookmarkUtils with the one remaining function from ShortcutHelper into a class called ShortcutHelper. BookmarkUtils is a bad name since these are not actually Chrome bookmarks and moreover, there is test utility class called BookmarkTestUtils which works on Chrome bookmarks. (3) Changes ShortcutDataFetcher to AddToHomescreenDialogFetcher to match the change in (1). (4) Fixes all usage of functions to be correct with the new names. BUG=508627 Committed: https://crrev.com/870920edb6dd146b86d84d99cbeee1c47c76ce53 Cr-Commit-Position: refs/heads/master@{#344595}

Patch Set 1 #

Patch Set 2 : Move test case over too #

Total comments: 5

Patch Set 3 : Rebase #

Total comments: 17

Patch Set 4 : Implement merge of ShortcutHelper and BookmarkUtils #

Patch Set 5 : Readd missing files #

Total comments: 8

Patch Set 6 : Fix comments on review + change AddToHomescreenDialogHelperObserver -> Observer #

Patch Set 7 : Fix build files #

Patch Set 8 : Fix build #

Patch Set 9 : Fix the build for real #

Patch Set 10 : Fix accidental changes of BookmarkUtils #

Patch Set 11 : Fix test file name #

Unified diffs Side-by-side diffs Delta from patch set Stats (+435 lines, -1212 lines) Patch
D chrome/android/java/src/org/chromium/chrome/browser/BookmarkUtils.java View 1 2 3 1 chunk +0 lines, -207 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java View 1 2 3 4 5 6 7 8 chunks +191 lines, -86 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/appmenu/ChromeAppMenuPropertiesDelegate.java View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/banners/AppBannerManager.java View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/bookmark/ShortcutActivity.java View 1 2 3 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/bookmarkswidget/BookmarkWidgetProxy.java View 1 2 3 2 chunks +1 line, -2 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java View 1 2 3 4 5 2 chunks +1 line, -2 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/document/DocumentUma.java View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialog.java View 1 2 3 4 5 2 chunks +3 lines, -4 lines 0 comments Download
A chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialogHelper.java View 1 2 3 4 5 1 chunk +104 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java View 1 2 3 4 5 2 chunks +1 line, -2 lines 0 comments Download
D chrome/android/javatests/src/org/chromium/chrome/browser/ShortcutHelperTest.java View 1 1 chunk +0 lines, -216 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/document/DocumentModeTest.java View 1 2 3 4 5 2 chunks +2 lines, -2 lines 0 comments Download
A + chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialogHelperTest.java View 1 2 3 4 5 6 7 8 9 10 6 chunks +13 lines, -9 lines 0 comments Download
M chrome/browser/android/chrome_jni_registrar.cc View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -0 lines 0 comments Download
D chrome/browser/android/shortcut_data_fetcher.h View 1 chunk +0 lines, -114 lines 0 comments Download
D chrome/browser/android/shortcut_data_fetcher.cc View 1 2 1 chunk +0 lines, -258 lines 0 comments Download
M chrome/browser/android/shortcut_helper.h View 1 chunk +3 lines, -47 lines 0 comments Download
M chrome/browser/android/shortcut_helper.cc View 1 2 3 4 5 2 chunks +2 lines, -127 lines 0 comments Download
A + chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h View 5 chunks +10 lines, -9 lines 0 comments Download
A + chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc View 1 2 11 chunks +27 lines, -22 lines 0 comments Download
A + chrome/browser/android/webapps/add_to_homescreen_dialog_helper.h View 1 2 3 4 3 chunks +20 lines, -23 lines 0 comments Download
A + chrome/browser/android/webapps/add_to_homescreen_dialog_helper.cc View 1 2 3 4 5 6 chunks +40 lines, -70 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 3 chunks +5 lines, -2 lines 0 comments Download

Messages

Total messages: 37 (12 generated)
Lalit Maganti
The patch compiles but I still need to split the test files as well for ...
5 years, 4 months ago (2015-08-13 12:26:19 UTC) #2
Lalit Maganti
Dan and Mounir: I've moved the test case over too so this should be ready ...
5 years, 4 months ago (2015-08-13 13:08:04 UTC) #3
mlamouri (slow - plz ping)
Could you double-check that the renamings are fine? lgtm with that and comments below applied. ...
5 years, 4 months ago (2015-08-13 13:18:26 UTC) #4
gone
Haven't reviewed yet, but your commit message doesn't make sense and is probably the result ...
5 years, 4 months ago (2015-08-13 20:38:23 UTC) #5
gone
Yeah, I'm confused by your choice of split since it seems that you believe that ...
5 years, 4 months ago (2015-08-13 20:54:28 UTC) #6
Lalit Maganti
On 2015/08/13 20:54:28, dfalcantara wrote: > Yeah, I'm confused by your choice of split since ...
5 years, 4 months ago (2015-08-13 21:00:05 UTC) #7
Lalit Maganti
On 2015/08/13 21:00:05, Lalit Maganti wrote: > On 2015/08/13 20:54:28, dfalcantara wrote: > > Yeah, ...
5 years, 4 months ago (2015-08-13 21:06:20 UTC) #8
gone
I get the gist of what you're doing, but you need to update the commit ...
5 years, 4 months ago (2015-08-13 21:43:15 UTC) #9
Lalit Maganti
On 2015/08/13 21:43:15, dfalcantara wrote: > I get the gist of what you're doing, but ...
5 years, 4 months ago (2015-08-13 21:50:00 UTC) #10
Lalit Maganti
On 2015/08/13 21:50:00, Lalit Maganti wrote: > On 2015/08/13 21:43:15, dfalcantara wrote: > > I ...
5 years, 4 months ago (2015-08-13 21:52:59 UTC) #11
gone
On 2015/08/13 21:52:59, Lalit Maganti wrote: > Probably isn't the best answer but even I ...
5 years, 4 months ago (2015-08-14 00:00:30 UTC) #12
Lalit Maganti
Previous patch seems to have made the refactoring a lot bigger but most files are ...
5 years, 4 months ago (2015-08-19 10:53:42 UTC) #13
mlamouri (slow - plz ping)
still lgtm
5 years, 4 months ago (2015-08-19 14:19:38 UTC) #14
gone
commit message: componenets -> components lgtm with the CL as is https://chromiumcodereview.appspot.com/1288903002/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java File chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java (right): ...
5 years, 4 months ago (2015-08-19 18:49:17 UTC) #15
Lalit Maganti
As well as addressing the comments, I've renamed AddToHomescreenDialogHelperObserver to Observer since it's an inner ...
5 years, 4 months ago (2015-08-20 17:12:18 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1288903002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1288903002/100001
5 years, 4 months ago (2015-08-20 17:13:31 UTC) #19
commit-bot: I haz the power
Try jobs failed on following builders: android_compile_dbg on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_compile_dbg/builds/50265) linux_android_rel_ng on tryserver.chromium.linux (JOB_FAILED, ...
5 years, 4 months ago (2015-08-20 17:29:23 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1288903002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1288903002/100001
5 years, 4 months ago (2015-08-20 17:34:03 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1288903002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1288903002/120001
5 years, 4 months ago (2015-08-20 17:44:51 UTC) #26
commit-bot: I haz the power
Try jobs failed on following builders: android_clang_dbg_recipe on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_clang_dbg_recipe/builds/111171)
5 years, 4 months ago (2015-08-20 18:02:09 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1288903002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1288903002/140001
5 years, 4 months ago (2015-08-20 19:17:37 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1288903002/200001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1288903002/200001
5 years, 4 months ago (2015-08-20 20:44:45 UTC) #34
commit-bot: I haz the power
Committed patchset #11 (id:200001)
5 years, 4 months ago (2015-08-20 22:06:09 UTC) #35
commit-bot: I haz the power
Patchset 11 (id:??) landed as https://crrev.com/870920edb6dd146b86d84d99cbeee1c47c76ce53 Cr-Commit-Position: refs/heads/master@{#344595}
5 years, 4 months ago (2015-08-20 22:06:47 UTC) #36
Lalit Maganti
5 years, 3 months ago (2015-08-26 13:57:08 UTC) #37
Message was sent while issue was closed.
https://codereview.chromium.org/1288903002/diff/40001/chrome/android/java/src...
File
chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialog.java
(right):

https://codereview.chromium.org/1288903002/diff/40001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialog.java:1:
// Copyright 2014 The Chromium Authors. All rights reserved.
On 2015/08/13 at 21:43:15, dfalcantara wrote:
> nit: 2015

Done in https://codereview.chromium.org/1321463002

https://codereview.chromium.org/1288903002/diff/40001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialog.java:24:
* logic to ShortcutHelper.
On 2015/08/13 at 21:43:15, dfalcantara wrote:
> Update all comments to reflect the split and what they do now.  Also refer to
the right classes.  May as well change valid references to "shortcut helper" to
"ShortcutHelper" while you're in here.

Done in https://codereview.chromium.org/1321463002

https://codereview.chromium.org/1288903002/diff/40001/chrome/android/java/src...
File
chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenHelper.java
(right):

https://codereview.chromium.org/1288903002/diff/40001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenHelper.java:17:
* This is a helper class to create shortcuts on the Android home screen.
On 2015/08/13 at 21:43:15, dfalcantara wrote:
> Change the comment to better describe what this thing does post-split.

Done in https://codereview.chromium.org/1321463002

https://codereview.chromium.org/1288903002/diff/40001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenHelper.java:84:
* @param userRequestedTitle Updated title for the shortcut.
On 2015/08/13 at 21:43:15, dfalcantara wrote:
> nit: Not sure what an "Updated title for the shortcut" means without any
context from places where this function is called.

Done in https://codereview.chromium.org/1321463002

https://codereview.chromium.org/1288903002/diff/40001/chrome/android/javatest...
File
chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenHelperTest.java
(right):

https://codereview.chromium.org/1288903002/diff/40001/chrome/android/javatest...
chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenHelperTest.java:27:
* Tests org.chromium.chrome.browser.webapps.AddToHomescreenHelper and it's C++
counterpart.
On 2015/08/13 at 21:43:15, dfalcantara wrote:
> nit: it's -> its

Done in https://codereview.chromium.org/1321463002

https://codereview.chromium.org/1288903002/diff/40001/chrome/browser/android/...
File chrome/browser/android/shortcut_helper.h (right):

https://codereview.chromium.org/1288903002/diff/40001/chrome/browser/android/...
chrome/browser/android/shortcut_helper.h:15: // from there via a JNI
(Initialize) call and MUST BE DESTROYED via Destroy().
On 2015/08/13 at 21:43:15, dfalcantara wrote:
> Update the class description.  There's no Destroy() call anymore (e.g.)

Done in https://codereview.chromium.org/1321463002

https://codereview.chromium.org/1288903002/diff/40001/chrome/browser/android/...
File chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h (right):

https://codereview.chromium.org/1288903002/diff/40001/chrome/browser/android/...
chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h:5: #ifndef
CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_
On 2015/08/13 at 21:43:15, dfalcantara wrote:
> Does it make sense to move these to the webapps/ directory, given that these
aren't used _just_ for webapps?

Since now this is exclusively used by the dialog it does make sense.

https://codereview.chromium.org/1288903002/diff/40001/chrome/browser/android/...
File chrome/browser/android/webapps/add_to_homescreen_helper.h (right):

https://codereview.chromium.org/1288903002/diff/40001/chrome/browser/android/...
chrome/browser/android/webapps/add_to_homescreen_helper.h:25: // ShortcutHelper
is the C++ counterpart of org.chromium.chrome.browser's
On 2015/08/13 at 20:54:28, dfalcantara wrote:
> you didn't change any of the comments to change the ShortcutHelper references

Done in https://codereview.chromium.org/1321463002

https://codereview.chromium.org/1288903002/diff/40001/chrome/browser/android/...
chrome/browser/android/webapps/add_to_homescreen_helper.h:25: // ShortcutHelper
is the C++ counterpart of org.chromium.chrome.browser's
On 2015/08/13 at 20:54:28, dfalcantara wrote:
> you didn't change any of the comments to change the ShortcutHelper references

Done in later patchset in this series.

Powered by Google App Engine
This is Rietveld 408576698