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

Issue 3560004: Refactor the code for loading icons into the PageInfoModel. (Closed)

Created:
10 years, 2 months ago by Robert Sesek
Modified:
9 years, 7 months ago
Reviewers:
Finnur, TVL, mattm
CC:
chromium-reviews, Paweł Hajdan Jr., ben+cc_chromium.org, pam+watch_chromium.org, brettw-cc_chromium.org, csilv
Base URL:
http://src.chromium.org/git/chromium.git
Visibility:
Public.

Description

Refactor the code for loading icons into the PageInfoModel. This code is basically duplicated twice on each platform. This consolidates all that into PageInfoModel::GetIconImage() and renames the SectionInfo.state to icon_id. BUG=none TEST=Page info windows and bubbles work as they did before across all platforms. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=61308

Patch Set 1 #

Patch Set 2 : Ready for review #

Total comments: 27

Patch Set 3 : Address comments #

Total comments: 4

Patch Set 4 : nits #

Patch Set 5 : cleanup #

Unified diffs Side-by-side diffs Delta from patch set Stats (+189 lines, -210 lines) Patch
M base/mac_util.h View 1 chunk +4 lines, -0 lines 0 comments Download
M base/mac_util.mm View 1 chunk +10 lines, -0 lines 0 comments Download
M base/mac_util_unittest.mm View 1 chunk +11 lines, -0 lines 0 comments Download
M chrome/browser/cocoa/page_info_bubble_controller.h View 1 chunk +0 lines, -6 lines 0 comments Download
M chrome/browser/cocoa/page_info_bubble_controller.mm View 7 chunks +2 lines, -42 lines 0 comments Download
M chrome/browser/cocoa/page_info_bubble_controller_unittest.mm View 1 2 6 chunks +12 lines, -10 lines 0 comments Download
M chrome/browser/cocoa/page_info_window_mac.h View 1 2 3 4 2 chunks +0 lines, -7 lines 0 comments Download
M chrome/browser/cocoa/page_info_window_mac.mm View 1 2 3 4 4 chunks +1 line, -15 lines 0 comments Download
M chrome/browser/cocoa/page_info_window_mac_unittest.mm View 1 2 7 chunks +12 lines, -11 lines 0 comments Download
M chrome/browser/gtk/page_info_bubble_gtk.cc View 1 3 chunks +2 lines, -32 lines 0 comments Download
M chrome/browser/gtk/page_info_window_gtk.cc View 3 chunks +1 line, -6 lines 0 comments Download
M chrome/browser/page_info_model.h View 1 2 3 4 5 chunks +46 lines, -8 lines 0 comments Download
M chrome/browser/page_info_model.cc View 1 2 3 13 chunks +73 lines, -17 lines 0 comments Download
M chrome/browser/views/page_info_bubble_view.cc View 1 2 3 4 6 chunks +8 lines, -30 lines 0 comments Download
M chrome/browser/views/page_info_window_view.cc View 1 8 chunks +7 lines, -26 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Robert Sesek
+finnur for Window and the model +mattm for Gtk +tvl for Mac
10 years, 2 months ago (2010-10-01 16:29:25 UTC) #1
TVL
http://codereview.chromium.org/3560004/diff/12001/13006 File chrome/browser/cocoa/page_info_bubble_controller_unittest.mm (right): http://codereview.chromium.org/3560004/diff/12001/13006#newcode21 chrome/browser/cocoa/page_info_bubble_controller_unittest.mm:21: void AddSection(SectionStateIcon state, change the var name too? http://codereview.chromium.org/3560004/diff/12001/13009 ...
10 years, 2 months ago (2010-10-01 17:17:16 UTC) #2
Finnur
I like where this is headed... A few comments. http://codereview.chromium.org/3560004/diff/12001/13012 File chrome/browser/page_info_model.cc (right): http://codereview.chromium.org/3560004/diff/12001/13012#newcode292 chrome/browser/page_info_model.cc:292: ...
10 years, 2 months ago (2010-10-01 17:46:02 UTC) #3
Robert Sesek
Thanks for the feedback. Addressed all comments. http://codereview.chromium.org/3560004/diff/12001/13006 File chrome/browser/cocoa/page_info_bubble_controller_unittest.mm (right): http://codereview.chromium.org/3560004/diff/12001/13006#newcode21 chrome/browser/cocoa/page_info_bubble_controller_unittest.mm:21: void AddSection(SectionStateIcon ...
10 years, 2 months ago (2010-10-01 20:37:27 UTC) #4
mattm
gtk bits LGTM
10 years, 2 months ago (2010-10-01 20:47:11 UTC) #5
TVL
lgtm http://codereview.chromium.org/3560004/diff/12001/13012 File chrome/browser/page_info_model.cc (right): http://codereview.chromium.org/3560004/diff/12001/13012#newcode44 chrome/browser/page_info_model.cc:44: icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_INFO)); On 2010/10/01 20:37:27, rsesek wrote: > On ...
10 years, 2 months ago (2010-10-01 20:50:58 UTC) #6
Finnur
LGTM with nits http://codereview.chromium.org/3560004/diff/12001/13013 File chrome/browser/page_info_model.h (right): http://codereview.chromium.org/3560004/diff/12001/13013#newcode49 chrome/browser/page_info_model.h:49: #endif Can you add a TODO ...
10 years, 2 months ago (2010-10-01 21:07:17 UTC) #7
Robert Sesek
10 years, 2 months ago (2010-10-01 21:50:13 UTC) #8
http://codereview.chromium.org/3560004/diff/12001/13012
File chrome/browser/page_info_model.cc (right):

http://codereview.chromium.org/3560004/diff/12001/13012#newcode44
chrome/browser/page_info_model.cc:44:
icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_INFO));
On 2010/10/01 20:50:58, TVL wrote:
> On 2010/10/01 20:37:27, rsesek wrote:
> > On 2010/10/01 17:17:16, TVL wrote:
> > > doesn't this mean we always load/decode the images that we might not need?
> > 
> > Yes, but I think that's a minimal cost.
> 
> Lazy load in the code where you fetch them?

Lazily loading significantly increases the complexity of this code. If you think
the cost/benefit is worth it, I'll do it, though.

http://codereview.chromium.org/3560004/diff/12001/13013
File chrome/browser/page_info_model.h (right):

http://codereview.chromium.org/3560004/diff/12001/13013#newcode49
chrome/browser/page_info_model.h:49: #endif
On 2010/10/01 21:07:17, Finnur wrote:
> Can you add a TODO then?

Done.

http://codereview.chromium.org/3560004/diff/9002/22012
File chrome/browser/page_info_model.cc (right):

http://codereview.chromium.org/3560004/diff/9002/22012#newcode290
chrome/browser/page_info_model.cc:290: icons_[ICON_STATE_WARNING_MAJOR];
On 2010/10/01 21:07:17, Finnur wrote:
> This return clause is really confusing... 
> 
> Why not:
> if (!command_line->HasSwitch(switches::kEnableNewPageInfoBubble) &&
>     icon_id != ICON_STATE_OK)) {
>   return icons_[ICON_STATE_WARNING_MAJOR];
> }

Nice.

http://codereview.chromium.org/3560004/diff/9002/22012#newcode331
chrome/browser/page_info_model.cc:331: (as_bubble) ? ICON_STATE_INFO :
ICON_STATE_OK,
On 2010/10/01 21:07:17, Finnur wrote:
> nit: why (as_bubble) as opposed to as_bubble?

Personal style habit. Done.

Powered by Google App Engine
This is Rietveld 408576698